Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

dcdicdir.h

00001 /*
00002  *
00003  *  Copyright (C) 1994-2003, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module:  dcmdata
00019  *
00020  *  Author:  Gerd Ehlers, Andreas Barth
00021  *
00022  *  Purpose: Interface of class DcmDicomDir
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2003/08/14 09:00:56 $
00026  *  Source File:      $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcdicdir.h,v $
00027  *  CVS/RCS Revision: $Revision: 1.17 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 #ifndef DCDICDIR_H
00035 #define DCDICDIR_H
00036 
00037 #include "osconfig.h"    /* make sure OS specific configuration is included first */
00038 
00039 #include "ofconsol.h"
00040 #include "dctypes.h"
00041 #include "dcitem.h"
00042 #include "dcfilefo.h"
00043 #include "dcsequen.h"
00044 #include "dcdirrec.h"
00045 #include "dcvrulup.h"
00046 
00047 
00048 #define DEFAULT_DICOMDIR_NAME  "DICOMDIR"
00049 #define TEMPNAME_TEMPLATE      "DDXXXXXX"
00050 #define DICOMDIR_BACKUP_SUFFIX ".$$$"
00051 #define DICOMDIR_DEFAULT_TRANSFERSYNTAX  EXS_LittleEndianExplicit
00052 
00053 
00054 typedef struct
00055 {
00056     DcmItem *item;
00057     Uint32  fileOffset;
00058 } ItemOffset;
00059 
00060 
00061 class DcmDicomDir
00062 {
00063   private:
00064 
00065  // --- declarations to avoid compiler warnings
00066 
00067     DcmDicomDir &operator=(const DcmDicomDir &);
00068 
00069   protected:
00070     OFCondition errorFlag;
00071     char * dicomDirFileName;
00072     OFBool modified;              // wird wo gebraucht ?
00073     OFBool mustCreateNewDir;
00074     DcmFileFormat * DirFile;
00075     DcmDirectoryRecord * RootRec;
00076     DcmSequenceOfItems * MRDRSeq;
00077 
00078     // Manipulation der internen Datenelemente:
00079     OFCondition createNewElements(const char* fileSetID);  // in
00080     DcmDataset& getDataset(void);
00081 
00082     // Seiteneffekt-freie Methoden zur Manipulation und Konversion:
00083     DcmSequenceOfItems&    getDirRecSeq(      DcmDataset &dset );   // inout
00084     DcmUnsignedLongOffset* lookForOffsetElem( DcmObject *obj,       // in
00085                                               const DcmTagKey &offsetTag );// in
00086     DcmDirectoryRecord*    recurseMatchFile(  DcmDirectoryRecord* startRec,// in
00087                                               char *filename );            // in
00088     DcmDirectoryRecord*    searchMatchFile(   DcmSequenceOfItems& recSeq,  // in
00089                                               char *filename );            // in
00090     OFCondition resolveGivenOffsets( DcmObject *startPoint,         // inout
00091                                      ItemOffset *itOffsets,         // in
00092                                      const unsigned long numOffsets,  // in
00093                                      const DcmTagKey &offsetTag );  // in
00094     OFCondition resolveAllOffsets(   DcmDataset &dset );            // inout
00095     OFCondition linkMRDRtoRecord(    DcmDirectoryRecord *dRec );    // inout
00096     OFCondition moveRecordToTree(    DcmDirectoryRecord *startRec,  // in
00097                                      DcmSequenceOfItems &fromDirSQ, // inout
00098                                      DcmDirectoryRecord *toRecord );// inout
00099     OFCondition moveMRDRbetweenSQs(  DcmSequenceOfItems &fromSQ,    // in
00100                                      DcmSequenceOfItems &toDirSQ ); // inout
00101     Uint32     lengthUntilSQ(       DcmDataset &dset,              // in
00102                                      E_TransferSyntax oxfer,        // in
00103                                      E_EncodingType enctype );      // in
00104     Uint32     lengthOfRecord(      DcmItem *item,                 // in
00105                                      E_TransferSyntax oxfer,        // in
00106                                      E_EncodingType enctype );      // in
00107     OFCondition convertGivenPointer( DcmObject *startPoint,         // inout
00108                                      ItemOffset *itOffsets,         // in
00109                                      const unsigned long numOffsets,  // in
00110                                      const DcmTagKey &offsetTag );  // in
00111     OFCondition convertAllPointer(   DcmDataset &dset,              // inout
00112                                      Uint32 beginOfFileSet,        // in
00113                                      E_TransferSyntax oxfer,        // in
00114                                      E_EncodingType enctype );      // in
00115     OFCondition copyRecordPtrToSQ(   DcmDirectoryRecord *record,    // in
00116                                      DcmSequenceOfItems &toDirSQ,   // inout
00117                                      DcmDirectoryRecord **firstRec, // out
00118                                      DcmDirectoryRecord **lastRec );// out
00119     OFCondition insertMediaSOPUID(   DcmMetaInfo &metaInfo );       // inout
00120     OFCondition countMRDRRefs(       DcmDirectoryRecord *startRec,  // in
00121                                      ItemOffset *refCounter,        // inout
00122                                      const unsigned long numCounters );   // in
00123     OFCondition checkMRDRRefCounter( DcmDirectoryRecord *startRec,  // in
00124                                      ItemOffset *refCounter,        // inout
00125                                      const unsigned long numCounters );    // in
00126 
00127     // komplette Reorganisation der verwalteten Directory Records (Seiteneffekt)
00128     OFCondition convertLinearToTree();
00129     OFCondition convertTreeToLinear( Uint32 beginOfFileSet,         // in
00130                                      E_TransferSyntax oxfer,        // in
00131                                      E_EncodingType enctype,        // in
00132                                      E_GrpLenEncoding glenc,        // in
00133                                      DcmSequenceOfItems &unresRecs);// inout
00134 
00135 public:
00136     DcmDicomDir();
00137     DcmDicomDir( const char *fileName,
00138                  const char *fileSetID = NULL );  // only used for new DICOMDIR
00139     DcmDicomDir( const DcmDicomDir &newDir );
00140     virtual ~DcmDicomDir();
00141 
00142     virtual void print(ostream &out,
00143                        const size_t flags = 0,
00144                        const int level = 0,
00145                        const char *pixelFileName = NULL,
00146                        size_t *pixelCounter = NULL);
00147 
00148     virtual OFCondition         error();
00149     virtual DcmFileFormat&      getDirFileFormat();
00150     virtual const char*         getDirFileName();
00151     virtual DcmDirectoryRecord& getRootRecord();
00152     virtual DcmSequenceOfItems& getMRDRSequence();
00153     virtual DcmDirectoryRecord* matchFilename(     char *filename );
00154     virtual DcmDirectoryRecord* matchOrCreateMRDR( char *filename );
00155     virtual OFCondition         write(const E_TransferSyntax oxfer
00156                                             = DICOMDIR_DEFAULT_TRANSFERSYNTAX,
00157                                       const E_EncodingType enctype
00158                                             = EET_UndefinedLength,
00159                                       const E_GrpLenEncoding glenc
00160                                             = EGL_withoutGL );
00161 // PENDING: DICOM-konform, aber unvollstaendig
00162     virtual OFCondition         verify( OFBool autocorrect = OFFalse );
00163 };
00164 
00165 #endif // DCDICDIR_H
00166 
00167 /*
00168 ** CVS/RCS Log:
00169 ** $Log: dcdicdir.h,v $
00170 ** Revision 1.17  2003/08/14 09:00:56  meichel
00171 ** Adapted type casts to new-style typecast operators defined in ofcast.h
00172 **
00173 ** Revision 1.16  2002/12/06 12:49:09  joergr
00174 ** Enhanced "print()" function by re-working the implementation and replacing
00175 ** the boolean "showFullData" parameter by a more general integer flag.
00176 ** Added doc++ documentation.
00177 ** Made source code formatting more consistent with other modules/files.
00178 **
00179 ** Revision 1.15  2001/09/25 17:19:25  meichel
00180 ** Adapted dcmdata to class OFCondition
00181 **
00182 ** Revision 1.14  2001/06/01 15:48:36  meichel
00183 ** Updated copyright header
00184 **
00185 ** Revision 1.13  2000/04/14 15:31:31  meichel
00186 ** Removed default value from output stream passed to print() method.
00187 **   Required for use in multi-thread environments.
00188 **
00189 ** Revision 1.12  2000/03/08 16:26:12  meichel
00190 ** Updated copyright header.
00191 **
00192 ** Revision 1.11  2000/03/03 14:05:23  meichel
00193 ** Implemented library support for redirecting error messages into memory
00194 **   instead of printing them to stdout/stderr for GUI applications.
00195 **
00196 ** Revision 1.10  2000/02/10 10:50:50  joergr
00197 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
00198 ** pixel data/item value fields to raw files.
00199 **
00200 ** Revision 1.9  1999/03/31 09:24:34  meichel
00201 ** Updated copyright header in module dcmdata
00202 **
00203 ** Revision 1.8  1998/07/15 15:48:44  joergr
00204 ** Removed several compiler warnings reported by gcc 2.8.1 with
00205 ** additional options, e.g. missing copy constructors and assignment
00206 ** operators, initialization of member variables in the body of a
00207 ** constructor instead of the member initialization list, hiding of
00208 ** methods by use of identical names, uninitialized member variables,
00209 ** missing const declaration of char pointers. Replaced tabs by spaces.
00210 **
00211 ** Revision 1.7  1997/09/11 15:02:16  hewett
00212 ** Changed DcmDicomDir constructor to take const char* arguments.
00213 **
00214 ** Revision 1.6  1997/07/21 08:25:06  andreas
00215 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
00216 **   with one unique boolean type OFBool.
00217 **
00218 ** Revision 1.5  1997/05/16 08:31:19  andreas
00219 ** - Revised handling of GroupLength elements and support of
00220 **   DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
00221 **   got additional enumeration values (for a description see dctypes.h).
00222 **   addGroupLength and removeGroupLength methods are replaced by
00223 **   computeGroupLengthAndPadding. To support Padding, the parameters of
00224 **   element and sequence write functions changed.
00225 **
00226 ** Revision 1.4  1997/04/24 12:08:28  hewett
00227 ** Fixed DICOMDIR generation bug affecting inclusion of Group Length
00228 ** attributes (file offsets were not being computed correctly).
00229 **
00230 ** Revision 1.3  1996/08/05 08:45:18  andreas
00231 ** new print routine with additional parameters:
00232 **         - print into files
00233 **         - fix output length for elements
00234 ** corrected error in search routine with parameter ESM_fromStackTop
00235 **
00236 ** Revision 1.2  1996/01/05 13:22:54  andreas
00237 ** - changed to support new streaming facilities
00238 ** - more cleanups
00239 ** - merged read / write methods for block and file transfer
00240 **
00241 */
00242 


Generated on 26 Apr 2005 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.4.2