OFFIS DCMTK  Version 3.6.0
dcdicdir.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Gerd Ehlers, Andreas Barth
17  *
18  * Purpose: Interface of class DcmDicomDir
19  *
20  * Last Update: $Author: uli $
21  * Update Date: $Date: 2010-11-15 13:58:43 $
22  * CVS/RCS Revision: $Revision: 1.28 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCDICDIR_H
30 #define DCDICDIR_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 
34 #include "dcmtk/dcmdata/dcdirrec.h"
35 #include "dcmtk/dcmdata/dcvrulup.h"
36 
37 
38 #define DEFAULT_DICOMDIR_NAME "DICOMDIR"
39 #define TEMPNAME_TEMPLATE "DDXXXXXX"
40 #define DICOMDIR_BACKUP_SUFFIX ".$$$"
41 #define DICOMDIR_DEFAULT_TRANSFERSYNTAX EXS_LittleEndianExplicit
42 
45 typedef struct
46 {
50  Uint32 fileOffset;
51 } ItemOffset;
52 
53 
59 {
60 public:
62  DcmDicomDir();
63 
69  DcmDicomDir( const char *fileName,
70  const char *fileSetID = NULL ); // only used for new DICOMDIR
71 
73  virtual ~DcmDicomDir();
74 
82  virtual void print(STD_NAMESPACE ostream&out,
83  const size_t flags = 0,
84  const int level = 0,
85  const char *pixelFileName = NULL,
86  size_t *pixelCounter = NULL);
87 
89  virtual OFCondition error();
90 
96 
100  virtual const char* getDirFileName();
101 
104 
107 
111  virtual DcmDirectoryRecord* matchFilename( const char *filename );
112 
117  virtual DcmDirectoryRecord* matchOrCreateMRDR( const char *filename );
118 
125  virtual OFCondition write(
126  const E_TransferSyntax oxfer = DICOMDIR_DEFAULT_TRANSFERSYNTAX,
127  const E_EncodingType enctype = EET_UndefinedLength,
128  const E_GrpLenEncoding glenc = EGL_withoutGL );
129 
134  virtual OFCondition verify( OFBool autocorrect = OFFalse );
135 
136  protected:
137 
138  // Manipulation of member variables
139  OFCondition createNewElements(const char* fileSetID); // in
140  DcmDataset& getDataset(void);
141 
142  // side-effect free methods for manipulation and conversion
143  DcmSequenceOfItems& getDirRecSeq( DcmDataset &dset ); // inout
144  DcmUnsignedLongOffset* lookForOffsetElem( DcmObject *obj, // in
145  const DcmTagKey &offsetTag ); // in
146  DcmDirectoryRecord* recurseMatchFile( DcmDirectoryRecord* startRec, // in
147  const char *filename ); // in
148  DcmDirectoryRecord* searchMatchFile( DcmSequenceOfItems& recSeq, // in
149  const char *filename ); // in
150  OFCondition resolveGivenOffsets( DcmObject *startPoint, // inout
151  ItemOffset *itOffsets, // in
152  const unsigned long numOffsets, // in
153  const DcmTagKey &offsetTag ); // in
154  OFCondition resolveAllOffsets( DcmDataset &dset ); // inout
155  OFCondition linkMRDRtoRecord( DcmDirectoryRecord *dRec ); // inout
156  OFCondition moveRecordToTree( DcmDirectoryRecord *startRec, // in
157  DcmSequenceOfItems &fromDirSQ, // inout
158  DcmDirectoryRecord *toRecord ); // inout
159  OFCondition moveMRDRbetweenSQs( DcmSequenceOfItems &fromSQ, // in
160  DcmSequenceOfItems &toDirSQ ); // inout
161  Uint32 lengthUntilSQ( DcmDataset &dset, // in
162  E_TransferSyntax oxfer, // in
163  E_EncodingType enctype ); // in
164  Uint32 lengthOfRecord( DcmItem *item, // in
165  E_TransferSyntax oxfer, // in
166  E_EncodingType enctype ); // in
167  OFCondition convertGivenPointer( DcmObject *startPoint, // inout
168  ItemOffset *itOffsets, // in
169  const unsigned long numOffsets, // in
170  const DcmTagKey &offsetTag ); // in
171  OFCondition convertAllPointer( DcmDataset &dset, // inout
172  Uint32 beginOfFileSet, // in
173  E_TransferSyntax oxfer, // in
174  E_EncodingType enctype ); // in
175  OFCondition copyRecordPtrToSQ( DcmDirectoryRecord *record, // in
176  DcmSequenceOfItems &toDirSQ, // inout
177  DcmDirectoryRecord **firstRec, // out
178  DcmDirectoryRecord **lastRec ); // out
179  OFCondition insertMediaSOPUID( DcmMetaInfo &metaInfo ); // inout
180  OFCondition countMRDRRefs( DcmDirectoryRecord *startRec, // in
181  ItemOffset *refCounter, // inout
182  const unsigned long numCounters ); // in
183  OFCondition checkMRDRRefCounter( DcmDirectoryRecord *startRec, // in
184  ItemOffset *refCounter, // inout
185  const unsigned long numCounters ); // in
186 
187  // complete re-organization of the managed directory records (side effect)
188  OFCondition convertLinearToTree();
189 
190  OFCondition convertTreeToLinear( Uint32 beginOfFileSet, // in
191  E_TransferSyntax oxfer, // in
192  E_EncodingType enctype, // in
193  E_GrpLenEncoding glenc, // in
194  DcmSequenceOfItems &unresRecs);// inout
195 
196  private:
197 
200 
202  DcmDicomDir( const DcmDicomDir &newDir );
203 
206 
209 
213  OFBool modified;
214 
217 
222 
225 
228 };
229 
230 #endif // DCDICDIR_H
231 
232 /*
233 ** CVS/RCS Log:
234 ** $Log: dcdicdir.h,v $
235 ** Revision 1.28 2010-11-15 13:58:43 uli
236 ** Fixed some errors in doxygen comments.
237 **
238 ** Revision 1.27 2010-10-14 13:15:40 joergr
239 ** Updated copyright header. Added reference to COPYRIGHT file.
240 **
241 ** Revision 1.26 2010-08-18 15:13:26 joergr
242 ** Added const specifier to char pointers where appropriate. Thanks to forum
243 ** user "takeos" for the report.
244 **
245 ** Revision 1.25 2010-03-01 09:08:44 uli
246 ** Removed some unnecessary include directives in the headers.
247 **
248 ** Revision 1.24 2010-02-22 11:39:53 uli
249 ** Remove some unneeded includes.
250 **
251 ** Revision 1.23 2009-11-04 09:58:07 uli
252 ** Switched to logging mechanism provided by the "new" oflog module
253 **
254 ** Revision 1.22 2007-11-29 14:30:19 meichel
255 ** Write methods now handle large raw data elements (such as pixel data)
256 ** without loading everything into memory. This allows very large images to
257 ** be sent over a network connection, or to be copied without ever being
258 ** fully in memory.
259 **
260 ** Revision 1.21 2007/06/29 14:17:49 meichel
261 ** Code clean-up: Most member variables in module dcmdata are now private,
262 ** not protected anymore.
263 **
264 ** Revision 1.20 2006/08/15 15:49:56 meichel
265 ** Updated all code in module dcmdata to correctly compile when
266 ** all standard C++ classes remain in namespace std.
267 **
268 ** Revision 1.19 2005/12/08 16:28:07 meichel
269 ** Changed include path schema for all DCMTK header files
270 **
271 ** Revision 1.18 2005/11/07 16:59:24 meichel
272 ** Cleaned up some copy constructors in the DcmObject hierarchy.
273 **
274 ** Revision 1.17 2003/08/14 09:00:56 meichel
275 ** Adapted type casts to new-style typecast operators defined in ofcast.h
276 **
277 ** Revision 1.16 2002/12/06 12:49:09 joergr
278 ** Enhanced "print()" function by re-working the implementation and replacing
279 ** the boolean "showFullData" parameter by a more general integer flag.
280 ** Added doc++ documentation.
281 ** Made source code formatting more consistent with other modules/files.
282 **
283 ** Revision 1.15 2001/09/25 17:19:25 meichel
284 ** Adapted dcmdata to class OFCondition
285 **
286 ** Revision 1.14 2001/06/01 15:48:36 meichel
287 ** Updated copyright header
288 **
289 ** Revision 1.13 2000/04/14 15:31:31 meichel
290 ** Removed default value from output stream passed to print() method.
291 ** Required for use in multi-thread environments.
292 **
293 ** Revision 1.12 2000/03/08 16:26:12 meichel
294 ** Updated copyright header.
295 **
296 ** Revision 1.11 2000/03/03 14:05:23 meichel
297 ** Implemented library support for redirecting error messages into memory
298 ** instead of printing them to stdout/stderr for GUI applications.
299 **
300 ** Revision 1.10 2000/02/10 10:50:50 joergr
301 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
302 ** pixel data/item value fields to raw files.
303 **
304 ** Revision 1.9 1999/03/31 09:24:34 meichel
305 ** Updated copyright header in module dcmdata
306 **
307 ** Revision 1.8 1998/07/15 15:48:44 joergr
308 ** Removed several compiler warnings reported by gcc 2.8.1 with
309 ** additional options, e.g. missing copy constructors and assignment
310 ** operators, initialization of member variables in the body of a
311 ** constructor instead of the member initialization list, hiding of
312 ** methods by use of identical names, uninitialized member variables,
313 ** missing const declaration of char pointers. Replaced tabs by spaces.
314 **
315 ** Revision 1.7 1997/09/11 15:02:16 hewett
316 ** Changed DcmDicomDir constructor to take const char* arguments.
317 **
318 ** Revision 1.6 1997/07/21 08:25:06 andreas
319 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
320 ** with one unique boolean type OFBool.
321 **
322 ** Revision 1.5 1997/05/16 08:31:19 andreas
323 ** - Revised handling of GroupLength elements and support of
324 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
325 ** got additional enumeration values (for a description see dctypes.h).
326 ** addGroupLength and removeGroupLength methods are replaced by
327 ** computeGroupLengthAndPadding. To support Padding, the parameters of
328 ** element and sequence write functions changed.
329 **
330 ** Revision 1.4 1997/04/24 12:08:28 hewett
331 ** Fixed DICOMDIR generation bug affecting inclusion of Group Length
332 ** attributes (file offsets were not being computed correctly).
333 **
334 ** Revision 1.3 1996/08/05 08:45:18 andreas
335 ** new print routine with additional parameters:
336 ** - print into files
337 ** - fix output length for elements
338 ** corrected error in search routine with parameter ESM_fromStackTop
339 **
340 ** Revision 1.2 1996/01/05 13:22:54 andreas
341 ** - changed to support new streaming facilities
342 ** - more cleanups
343 ** - merged read / write methods for block and file transfer
344 **
345 */
346 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2