1 /*=========================================================================
4 Module: $RCSfile: gdcmFileHelper.cxx,v $
7 Date: $Date: 2005/05/27 10:51:00 $
8 Version: $Revision: 1.42 $
10 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
11 l'Image). All rights reserved. See Doc/License.txt or
12 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notices for more information.
18 =========================================================================*/
20 #include "gdcmFileHelper.h"
21 #include "gdcmGlobal.h"
23 #include "gdcmDocument.h"
24 #include "gdcmDebug.h"
26 #include "gdcmBinEntry.h"
27 #include "gdcmValEntry.h"
28 #include "gdcmSeqEntry.h"
29 #include "gdcmSQItem.h"
30 #include "gdcmContentEntry.h"
32 #include "gdcmPixelReadConvert.h"
33 #include "gdcmPixelWriteConvert.h"
34 #include "gdcmDocEntryArchive.h"
35 #include "gdcmDictSet.h"
40 // ----------------------------- WARNING -------------------------
42 These lines will be moved to the document-to-be 'User's Guide'
44 // To read an image, user needs a gdcm::File
45 gdcm::File *f1 = new gdcm::File(fileName);
46 // user can now check some values
47 std::string v = f1->GetEntryValue(groupNb,ElementNb);
48 // to get the pixels, user needs a gdcm::FileHelper
49 gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
50 // user may ask not to convert Palette to RGB
51 uint8_t *pixels = fh1->GetImageDataRaw();
52 int imageLength = fh1->GetImageDataRawSize();
53 // He can now use the pixels, create a new image, ...
54 uint8_t *userPixels = ...
56 To re-write the image, user re-uses the gdcm::FileHelper
58 fh1->SetImageData( userPixels, userPixelsLength);
59 fh1->SetTypeToRaw(); // Even if it was possible to convert Palette to RGB
62 fh1->SetWriteTypeToDcmExpl(); // he wants Explicit Value Representation
63 // Little Endian is the default
64 // no other value is allowed
65 (-->SetWriteType(ExplicitVR);)
66 -->WriteType = ExplicitVR;
67 fh1->Write(newFileName); // overwrites the file, if any
70 fh1->WriteDcmExplVR(newFileName);
73 // ----------------------------- WARNING -------------------------
75 These lines will be moved to the document-to-be 'Developer's Guide'
77 WriteMode : WMODE_RAW / WMODE_RGB
78 WriteType : ImplicitVR, ExplicitVR, ACR, ACR_LIBIDO
80 fh1->Write(newFileName);
81 SetWriteFileTypeToImplicitVR() / SetWriteFileTypeToExplicitVR();
82 (modifies TransferSyntax)
83 SetWriteToRaw(); / SetWriteToRGB();
84 (modifies, when necessary : photochromatic interpretation,
85 samples per pixel, Planar configuration,
86 bits allocated, bits stored, high bit -ACR 24 bits-
87 Pixels element VR, pushes out the LUT )
88 CheckWriteIntegrity();
89 (checks user given pixels length)
90 FileInternal->Write(fileName,WriteType)
91 fp = opens file(fileName);
92 ComputeGroup0002Length(writetype);
94 RemoveEntryNoDestroy(palettes, etc)
95 Document::WriteContent(fp, writetype);
97 (moves back to the File all the archived elements)
98 RestoreWriteFileType();
99 (pushes back group 0002, with TransferSyntax)
107 //-------------------------------------------------------------------------
108 // Constructor / Destructor
110 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
111 * file (gdcm::File only deals with the ... header)
112 * Opens (in read only and when possible) an existing file and checks
113 * for DICOM compliance. Returns NULL on failure.
114 * It will be up to the user to load the pixels into memory
115 * \note the in-memory representation of all available tags found in
116 * the DICOM header is post-poned to first header information access.
117 * This avoid a double parsing of public part of the header when
118 * one sets an a posteriori shadow dictionary (efficiency can be
119 * seen as a side effect).
121 FileHelper::FileHelper( )
123 FileInternal = new File( );
129 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
130 * file (File only deals with the ... header)
131 * Opens (in read only and when possible) an existing file and checks
132 * for DICOM compliance. Returns NULL on failure.
133 * It will be up to the user to load the pixels into memory
134 * \note the in-memory representation of all available tags found in
135 * the DICOM header is post-poned to first header information access.
136 * This avoid a double parsing of public part of the header when
137 * user sets an a posteriori shadow dictionary (efficiency can be
138 * seen as a side effect).
139 * @param header already built Header
141 FileHelper::FileHelper(File *header)
143 FileInternal = header;
149 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
150 * file (gdcm::File only deals with the ... header)
151 * Opens (in read only and when possible) an existing file and checks
152 * for DICOM compliance. Returns NULL on failure.
153 * It will be up to the user to load the pixels into memory
154 * \note the in-memory representation of all available tags found in
155 * the DICOM header is post-poned to first header information access.
156 * This avoid a double parsing of public part of the header when
157 * one sets an a posteriori shadow dictionary (efficiency can be
158 * seen as a side effect).
159 * @param filename file to be opened for parsing
161 FileHelper::FileHelper(std::string const &filename )
163 FileInternal = new File( filename );
169 * \brief canonical destructor
170 * \note If the header (gdcm::File) was created by the FileHelper constructor,
171 * it is destroyed by the FileHelper
173 FileHelper::~FileHelper()
175 if( PixelReadConverter )
177 delete PixelReadConverter;
179 if( PixelWriteConverter )
181 delete PixelWriteConverter;
195 //-----------------------------------------------------------------------------
198 * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
199 * through it's (group, element) and modifies it's content with
201 * @param content new value (string) to substitute with
202 * @param group group number of the Dicom Element to modify
203 * @param elem element number of the Dicom Element to modify
204 * \return false if DocEntry not found
206 bool FileHelper::SetValEntry(std::string const &content,
207 uint16_t group, uint16_t elem)
209 return FileInternal->SetValEntry(content, group, elem);
214 * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
215 * through it's (group, element) and modifies it's content with
217 * @param content new value (void* -> uint8_t*) to substitute with
218 * @param lgth new value length
219 * @param group group number of the Dicom Element to modify
220 * @param elem element number of the Dicom Element to modify
221 * \return false if DocEntry not found
223 bool FileHelper::SetBinEntry(uint8_t *content, int lgth,
224 uint16_t group, uint16_t elem)
226 return FileInternal->SetBinEntry(content, lgth, group, elem);
230 * \brief Modifies the value of a given DocEntry (Dicom entry)
231 * when it exists. Creates it with the given value when unexistant.
232 * @param content (string)value to be set
233 * @param group Group number of the Entry
234 * @param elem Element number of the Entry
235 * \return pointer to the modified/created Dicom entry (NULL when creation
238 ValEntry *FileHelper::InsertValEntry(std::string const &content,
239 uint16_t group, uint16_t elem)
241 return FileInternal->InsertValEntry(content, group, elem);
245 * \brief Modifies the value of a given DocEntry (Dicom entry)
246 * when it exists. Creates it with the given value when unexistant.
247 * A copy of the binArea is made to be kept in the Document.
248 * @param binArea (binary)value to be set
249 * @param lgth new value length
250 * @param group Group number of the Entry
251 * @param elem Element number of the Entry
252 * \return pointer to the modified/created Dicom entry (NULL when creation
255 BinEntry *FileHelper::InsertBinEntry(uint8_t *binArea, int lgth,
256 uint16_t group, uint16_t elem)
258 return FileInternal->InsertBinEntry(binArea, lgth, group, elem);
262 * \brief Modifies the value of a given DocEntry (Dicom entry)
263 * when it exists. Creates it, empty (?!) when unexistant.
264 * @param group Group number of the Entry
265 * @param elem Element number of the Entry
266 * \return pointer to the modified/created Dicom entry (NULL when creation
269 SeqEntry *FileHelper::InsertSeqEntry(uint16_t group, uint16_t elem)
271 return FileInternal->InsertSeqEntry(group, elem);
275 * \brief Get the size of the image data
276 * If the image can be RGB (with a lut or by default), the size
277 * corresponds to the RGB image
278 * (use GetImageDataRawSize if you want to be sure to get *only*
279 * the size of the pixels)
280 * @return The image size
282 size_t FileHelper::GetImageDataSize()
284 if ( PixelWriteConverter->GetUserData() )
286 return PixelWriteConverter->GetUserDataSize();
288 return PixelReadConverter->GetRGBSize();
292 * \brief Get the size of the image data
293 * If the image could be converted to RGB using a LUT,
294 * this transformation is not taken into account by GetImageDataRawSize
295 * (use GetImageDataSize if you wish)
296 * @return The raw image size
298 size_t FileHelper::GetImageDataRawSize()
300 if ( PixelWriteConverter->GetUserData() )
302 return PixelWriteConverter->GetUserDataSize();
304 return PixelReadConverter->GetRawSize();
308 * \brief - Allocates necessary memory,
309 * - Reads the pixels from disk (uncompress if necessary),
310 * - Transforms YBR pixels, if any, into RGB pixels,
311 * - Transforms 3 planes R, G, B, if any, into a single RGB Plane
312 * - Transforms single Grey plane + 3 Palettes into a RGB Plane
313 * - Copies the pixel data (image[s]/volume[s]) to newly allocated zone.
314 * @return Pointer to newly allocated pixel data.
315 * NULL if alloc fails
317 uint8_t *FileHelper::GetImageData()
319 if ( PixelWriteConverter->GetUserData() )
321 return PixelWriteConverter->GetUserData();
326 // If the decompression failed nothing can be done.
330 if ( FileInternal->HasLUT() && PixelReadConverter->BuildRGBImage() )
332 return PixelReadConverter->GetRGB();
336 // When no LUT or LUT conversion fails, return the Raw
337 return PixelReadConverter->GetRaw();
342 * \brief Allocates necessary memory,
343 * Transforms YBR pixels (if any) into RGB pixels
344 * Transforms 3 planes R, G, B (if any) into a single RGB Plane
345 * Copies the pixel data (image[s]/volume[s]) to newly allocated zone.
346 * DOES NOT transform Grey plane + 3 Palettes into a RGB Plane
347 * @return Pointer to newly allocated pixel data.
348 * NULL if alloc fails
350 uint8_t *FileHelper::GetImageDataRaw ()
357 * Read the pixels from disk (uncompress if necessary),
358 * Transforms YBR pixels, if any, into RGB pixels
359 * Transforms 3 planes R, G, B, if any, into a single RGB Plane
360 * Transforms single Grey plane + 3 Palettes into a RGB Plane
361 * Copies at most MaxSize bytes of pixel data to caller allocated
363 * \warning This function allows people that want to build a volume
364 * from an image stack *not to* have, first to get the image pixels,
365 * and then move them to the volume area.
366 * It's absolutely useless for any VTK user since vtk chooses
367 * to invert the lines of an image, that is the last line comes first
368 * (for some axis related reasons?). Hence he will have
369 * to load the image line by line, starting from the end.
370 * VTK users have to call GetImageData
372 * @param destination Address (in caller's memory space) at which the
373 * pixel data should be copied
374 * @param maxSize Maximum number of bytes to be copied. When MaxSize
375 * is not sufficient to hold the pixel data the copy is not
376 * executed (i.e. no partial copy).
377 * @return On success, the number of bytes actually copied. Zero on
378 * failure e.g. MaxSize is lower than necessary.
380 size_t FileHelper::GetImageDataIntoVector (void *destination, size_t maxSize)
384 // If the decompression failed nothing can be done.
388 if ( FileInternal->HasLUT() && PixelReadConverter->BuildRGBImage() )
390 if ( PixelReadConverter->GetRGBSize() > maxSize )
392 gdcmWarningMacro( "Pixel data bigger than caller's expected MaxSize");
396 (void*)PixelReadConverter->GetRGB(),
397 PixelReadConverter->GetRGBSize() );
398 return PixelReadConverter->GetRGBSize();
401 // Either no LUT conversion necessary or LUT conversion failed
402 if ( PixelReadConverter->GetRawSize() > maxSize )
404 gdcmWarningMacro( "Pixel data bigger than caller's expected MaxSize");
408 (void *)PixelReadConverter->GetRaw(),
409 PixelReadConverter->GetRawSize() );
410 return PixelReadConverter->GetRawSize();
414 * \brief Points the internal pointer to the callers inData
415 * image representation, BUT WITHOUT COPYING THE DATA.
416 * 'image' Pixels are presented as C-like 2D arrays : line per line.
417 * 'volume'Pixels are presented as C-like 3D arrays : plane per plane
418 * \warning Since the pixels are not copied, it is the caller's responsability
419 * not to deallocate its data before gdcm uses them (e.g. with
420 * the Write() method )
421 * @param inData user supplied pixel area (uint8_t* is just for the compiler.
422 * user is allowed to pass any kind of pixelsn since the size is
424 * @param expectedSize total image size, *in Bytes*
426 void FileHelper::SetImageData(uint8_t *inData, size_t expectedSize)
428 SetUserData(inData, expectedSize);
432 * \brief Set the image data defined by the user
433 * \warning When writting the file, this data are get as default data to write
434 * @param inData user supplied pixel area (uint8_t* is just for the compiler.
435 * user is allowed to pass any kind of pixels since the size is
437 * @param expectedSize total image size, *in Bytes*
439 void FileHelper::SetUserData(uint8_t *inData, size_t expectedSize)
441 PixelWriteConverter->SetUserData(inData, expectedSize);
445 * \brief Get the image data defined by the user
446 * \warning When writting the file, this data are get as default data to write
448 uint8_t *FileHelper::GetUserData()
450 return PixelWriteConverter->GetUserData();
454 * \brief Get the image data size defined by the user
455 * \warning When writting the file, this data are get as default data to write
457 size_t FileHelper::GetUserDataSize()
459 return PixelWriteConverter->GetUserDataSize();
463 * \brief Get the image data from the file.
464 * If a LUT is found, the data are expanded to be RGB
466 uint8_t *FileHelper::GetRGBData()
468 return PixelReadConverter->GetRGB();
472 * \brief Get the image data size from the file.
473 * If a LUT is found, the data are expanded to be RGB
475 size_t FileHelper::GetRGBDataSize()
477 return PixelReadConverter->GetRGBSize();
481 * \brief Get the image data from the file.
482 * Even when a LUT is found, the data are not expanded to RGB!
484 uint8_t *FileHelper::GetRawData()
486 return PixelReadConverter->GetRaw();
490 * \brief Get the image data size from the file.
491 * Even when a LUT is found, the data are not expanded to RGB!
493 size_t FileHelper::GetRawDataSize()
495 return PixelReadConverter->GetRawSize();
499 * \brief Access to the underlying \ref PixelReadConverter RGBA LUT
501 uint8_t* FileHelper::GetLutRGBA()
503 return PixelReadConverter->GetLutRGBA();
507 * \brief Writes on disk A SINGLE Dicom file
508 * NO test is performed on processor "Endiannity".
509 * It's up to the user to call his Reader properly
510 * @param fileName name of the file to be created
511 * (any already existing file is over written)
512 * @return false if write fails
514 bool FileHelper::WriteRawData(std::string const &fileName)
516 std::ofstream fp1(fileName.c_str(), std::ios::out | std::ios::binary );
519 gdcmWarningMacro( "Fail to open (write) file:" << fileName.c_str());
523 if( PixelWriteConverter->GetUserData() )
525 fp1.write( (char *)PixelWriteConverter->GetUserData(),
526 PixelWriteConverter->GetUserDataSize() );
528 else if ( PixelReadConverter->GetRGB() )
530 fp1.write( (char *)PixelReadConverter->GetRGB(),
531 PixelReadConverter->GetRGBSize());
533 else if ( PixelReadConverter->GetRaw() )
535 fp1.write( (char *)PixelReadConverter->GetRaw(),
536 PixelReadConverter->GetRawSize());
540 gdcmErrorMacro( "Nothing written." );
549 * \brief Writes on disk A SINGLE Dicom file,
550 * using the Implicit Value Representation convention
551 * NO test is performed on processor "Endianity".
552 * @param fileName name of the file to be created
553 * (any already existing file is overwritten)
554 * @return false if write fails
557 bool FileHelper::WriteDcmImplVR (std::string const &fileName)
559 SetWriteTypeToDcmImplVR();
560 return Write(fileName);
564 * \brief Writes on disk A SINGLE Dicom file,
565 * using the Explicit Value Representation convention
566 * NO test is performed on processor "Endiannity".
567 * @param fileName name of the file to be created
568 * (any already existing file is overwritten)
569 * @return false if write fails
572 bool FileHelper::WriteDcmExplVR (std::string const &fileName)
574 SetWriteTypeToDcmExplVR();
575 return Write(fileName);
579 * \brief Writes on disk A SINGLE Dicom file,
580 * using the ACR-NEMA convention
581 * NO test is performed on processor "Endiannity".
582 * (a l'attention des logiciels cliniques
583 * qui ne prennent en entrée QUE des images ACR ...
584 * \warning if a DICOM_V3 header is supplied,
585 * groups < 0x0008 and shadow groups are ignored
586 * \warning NO TEST is performed on processor "Endiannity".
587 * @param fileName name of the file to be created
588 * (any already existing file is overwritten)
589 * @return false if write fails
592 bool FileHelper::WriteAcr (std::string const &fileName)
595 return Write(fileName);
599 * \brief Writes on disk A SINGLE Dicom file,
600 * @param fileName name of the file to be created
601 * (any already existing file is overwritten)
602 * @return false if write fails
604 bool FileHelper::Write(std::string const &fileName)
609 SetWriteFileTypeToImplicitVR();
611 case Unknown: // should never happen; ExplicitVR is the default value
613 SetWriteFileTypeToExplicitVR();
617 // NOTHING is done here just for LibIDO.
618 // Just to avoid further trouble if user creates a file ex-nihilo,
619 // wants to write it as an ACR-NEMA file,
620 // and forgets to create any Entry belonging to group 0008
622 // We add Recognition Code (RET)
623 if ( ! FileInternal->GetValEntry(0x0008, 0x0010) )
624 FileInternal->InsertValEntry("", 0x0008, 0x0010);
625 SetWriteFileTypeToACR();
626 // SetWriteFileTypeToImplicitVR(); // ACR IS implicit VR !
629 CheckMandatoryElements();
631 // --------------------------------------------------------------
632 // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
634 // if recognition code tells us we dealt with a LibIDO image
635 // we reproduce on disk the switch between lineNumber and columnNumber
636 // just before writting ...
637 /// \todo the best trick would be *change* the recognition code
638 /// but pb expected if user deals with, e.g. COMPLEX images
640 if( WriteType == ACR_LIBIDO )
646 SetWriteToNoLibido();
648 // ----------------- End of Special Patch ----------------
653 SetWriteToRaw(); // modifies and pushes to the archive, when necessary
656 SetWriteToRGB(); // modifies and pushes to the archive, when necessary
660 bool check = CheckWriteIntegrity(); // verifies length
663 check = FileInternal->Write(fileName,WriteType);
667 RestoreWriteFileType();
668 RestoreWriteMandatory();
670 // --------------------------------------------------------------
671 // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
673 // ...and we restore the header to be Dicom Compliant again
674 // just after writting
675 RestoreWriteOfLibido();
676 // ----------------- End of Special Patch ----------------
681 //-----------------------------------------------------------------------------
684 * \brief Checks the write integrity
686 * The tests made are :
687 * - verify the size of the image to write with the possible write
688 * when the user set an image data
689 * @return true if check is successfull
691 bool FileHelper::CheckWriteIntegrity()
693 if(PixelWriteConverter->GetUserData())
695 int numberBitsAllocated = FileInternal->GetBitsAllocated();
696 if ( numberBitsAllocated == 0 || numberBitsAllocated == 12 )
698 gdcmWarningMacro( "numberBitsAllocated changed from "
699 << numberBitsAllocated << " to 16 "
700 << " for consistency purpose" );
701 numberBitsAllocated = 16;
704 size_t decSize = FileInternal->GetXSize()
705 * FileInternal->GetYSize()
706 * FileInternal->GetZSize()
707 * FileInternal->GetSamplesPerPixel()
708 * ( numberBitsAllocated / 8 );
709 size_t rgbSize = decSize;
710 if( FileInternal->HasLUT() )
711 rgbSize = decSize * 3;
716 if( decSize!=PixelWriteConverter->GetUserDataSize() )
718 gdcmWarningMacro( "Data size (Raw) is incorrect. Should be "
719 << decSize << " / Found :"
720 << PixelWriteConverter->GetUserDataSize() );
725 if( rgbSize!=PixelWriteConverter->GetUserDataSize() )
727 gdcmWarningMacro( "Data size (RGB) is incorrect. Should be "
728 << decSize << " / Found "
729 << PixelWriteConverter->GetUserDataSize() );
739 * \brief Updates the File to write RAW data (as opposed to RGB data)
740 * (modifies, when necessary, photochromatic interpretation,
741 * bits allocated, Pixels element VR)
743 void FileHelper::SetWriteToRaw()
745 if( FileInternal->GetNumberOfScalarComponents() == 3
746 && !FileInternal->HasLUT())
752 ValEntry *photInt = CopyValEntry(0x0028,0x0004);
753 if(FileInternal->HasLUT())
755 photInt->SetValue("PALETTE COLOR ");
759 photInt->SetValue("MONOCHROME2 ");
762 PixelWriteConverter->SetReadData(PixelReadConverter->GetRaw(),
763 PixelReadConverter->GetRawSize());
765 std::string vr = "OB";
766 if( FileInternal->GetBitsAllocated()>8 )
768 if( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files
771 CopyBinEntry(GetFile()->GetGrPixel(),GetFile()->GetNumPixel(),vr);
772 pixel->SetValue(GDCM_BINLOADED);
773 pixel->SetBinArea(PixelWriteConverter->GetData(),false);
774 pixel->SetLength(PixelWriteConverter->GetDataSize());
776 Archive->Push(photInt);
777 Archive->Push(pixel);
782 * \brief Updates the File to write RGB data (as opposed to RAW data)
783 * (modifies, when necessary, photochromatic interpretation,
784 * samples per pixel, Planar configuration,
785 * bits allocated, bits stored, high bit -ACR 24 bits-
786 * Pixels element VR, pushes out the LUT, )
788 void FileHelper::SetWriteToRGB()
790 if(FileInternal->GetNumberOfScalarComponents()==3)
792 PixelReadConverter->BuildRGBImage();
794 ValEntry *spp = CopyValEntry(0x0028,0x0002);
797 ValEntry *planConfig = CopyValEntry(0x0028,0x0006);
798 planConfig->SetValue("0 ");
800 ValEntry *photInt = CopyValEntry(0x0028,0x0004);
801 photInt->SetValue("RGB ");
803 if(PixelReadConverter->GetRGB())
805 PixelWriteConverter->SetReadData(PixelReadConverter->GetRGB(),
806 PixelReadConverter->GetRGBSize());
810 PixelWriteConverter->SetReadData(PixelReadConverter->GetRaw(),
811 PixelReadConverter->GetRawSize());
814 std::string vr = "OB";
815 if( FileInternal->GetBitsAllocated()>8 )
817 if( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files
820 CopyBinEntry(GetFile()->GetGrPixel(),GetFile()->GetNumPixel(),vr);
821 pixel->SetValue(GDCM_BINLOADED);
822 pixel->SetBinArea(PixelWriteConverter->GetData(),false);
823 pixel->SetLength(PixelWriteConverter->GetDataSize());
826 Archive->Push(planConfig);
827 Archive->Push(photInt);
828 Archive->Push(pixel);
831 Archive->Push(0x0028,0x1101);
832 Archive->Push(0x0028,0x1102);
833 Archive->Push(0x0028,0x1103);
834 Archive->Push(0x0028,0x1201);
835 Archive->Push(0x0028,0x1202);
836 Archive->Push(0x0028,0x1203);
838 // For old '24 Bits' ACR-NEMA
839 // Thus, we have a RGB image and the bits allocated = 24 and
840 // samples per pixels = 1 (in the read file)
841 if(FileInternal->GetBitsAllocated()==24)
843 ValEntry *bitsAlloc = CopyValEntry(0x0028,0x0100);
844 bitsAlloc->SetValue("8 ");
846 ValEntry *bitsStored = CopyValEntry(0x0028,0x0101);
847 bitsStored->SetValue("8 ");
849 ValEntry *highBit = CopyValEntry(0x0028,0x0102);
850 highBit->SetValue("7 ");
852 Archive->Push(bitsAlloc);
853 Archive->Push(bitsStored);
854 Archive->Push(highBit);
864 * \brief Restore the File write mode
866 void FileHelper::RestoreWrite()
868 Archive->Restore(0x0028,0x0002);
869 Archive->Restore(0x0028,0x0004);
870 Archive->Restore(0x0028,0x0006);
871 Archive->Restore(GetFile()->GetGrPixel(),GetFile()->GetNumPixel());
873 // For old ACR-NEMA (24 bits problem)
874 Archive->Restore(0x0028,0x0100);
875 Archive->Restore(0x0028,0x0101);
876 Archive->Restore(0x0028,0x0102);
879 Archive->Restore(0x0028,0x1101);
880 Archive->Restore(0x0028,0x1102);
881 Archive->Restore(0x0028,0x1103);
882 Archive->Restore(0x0028,0x1201);
883 Archive->Restore(0x0028,0x1202);
884 Archive->Restore(0x0028,0x1203);
886 // group 0002 may be pushed out for ACR-NEMA writting purposes
887 Archive->Restore(0x0002,0x0000);
888 Archive->Restore(0x0002,0x0001);
889 Archive->Restore(0x0002,0x0002);
890 Archive->Restore(0x0002,0x0003);
891 Archive->Restore(0x0002,0x0010);
892 Archive->Restore(0x0002,0x0012);
893 Archive->Restore(0x0002,0x0013);
894 Archive->Restore(0x0002,0x0016);
895 Archive->Restore(0x0002,0x0100);
896 Archive->Restore(0x0002,0x0102);
900 * \brief Pushes out the whole group 0002
901 * FIXME : better, set a flag to tell the writer not to write it ...
902 * FIXME : method should probably have an other name !
903 * SetWriteFileTypeToACR is NOT opposed to
904 * SetWriteFileTypeToExplicitVR and SetWriteFileTypeToImplicitVR
906 void FileHelper::SetWriteFileTypeToACR()
908 Archive->Push(0x0002,0x0000);
909 Archive->Push(0x0002,0x0001);
910 Archive->Push(0x0002,0x0002);
911 Archive->Push(0x0002,0x0003);
912 Archive->Push(0x0002,0x0010);
913 Archive->Push(0x0002,0x0012);
914 Archive->Push(0x0002,0x0013);
915 Archive->Push(0x0002,0x0016);
916 Archive->Push(0x0002,0x0100);
917 Archive->Push(0x0002,0x0102);
921 * \brief Sets in the File the TransferSyntax to 'Explicit VR Little Endian"
923 void FileHelper::SetWriteFileTypeToExplicitVR()
925 std::string ts = Util::DicomString(
926 Global::GetTS()->GetSpecialTransferSyntax(TS::ExplicitVRLittleEndian) );
928 ValEntry *tss = CopyValEntry(0x0002,0x0010);
935 * \brief Sets in the File the TransferSyntax to 'Implicit VR Little Endian"
937 void FileHelper::SetWriteFileTypeToImplicitVR()
939 std::string ts = Util::DicomString(
940 Global::GetTS()->GetSpecialTransferSyntax(TS::ImplicitVRLittleEndian) );
942 ValEntry *tss = CopyValEntry(0x0002,0x0010);
950 * \brief Restore in the File the initial group 0002
952 void FileHelper::RestoreWriteFileType()
957 * \brief Set the Write not to Libido format
959 void FileHelper::SetWriteToLibido()
961 ValEntry *oldRow = dynamic_cast<ValEntry *>
962 (FileInternal->GetDocEntry(0x0028, 0x0010));
963 ValEntry *oldCol = dynamic_cast<ValEntry *>
964 (FileInternal->GetDocEntry(0x0028, 0x0011));
966 if( oldRow && oldCol )
968 std::string rows, columns;
970 ValEntry *newRow=new ValEntry(oldRow->GetDictEntry());
971 ValEntry *newCol=new ValEntry(oldCol->GetDictEntry());
973 newRow->Copy(oldCol);
974 newCol->Copy(oldRow);
976 newRow->SetValue(oldCol->GetValue());
977 newCol->SetValue(oldRow->GetValue());
979 Archive->Push(newRow);
980 Archive->Push(newCol);
983 ValEntry *libidoCode = CopyValEntry(0x0008,0x0010);
984 libidoCode->SetValue("ACRNEMA_LIBIDO_1.1");
985 Archive->Push(libidoCode);
989 * \brief Set the Write not to No Libido format
991 void FileHelper::SetWriteToNoLibido()
993 ValEntry *recCode = dynamic_cast<ValEntry *>
994 (FileInternal->GetDocEntry(0x0008,0x0010));
997 if( recCode->GetValue() == "ACRNEMA_LIBIDO_1.1" )
999 ValEntry *libidoCode = CopyValEntry(0x0008,0x0010);
1000 libidoCode->SetValue("");
1001 Archive->Push(libidoCode);
1007 * \brief Restore the Write format
1009 void FileHelper::RestoreWriteOfLibido()
1011 Archive->Restore(0x0028,0x0010);
1012 Archive->Restore(0x0028,0x0011);
1013 Archive->Restore(0x0008,0x0010);
1015 // Restore 'LibIDO-special' entries, if any
1016 Archive->Restore(0x0028,0x0015);
1017 Archive->Restore(0x0028,0x0016);
1018 Archive->Restore(0x0028,0x0017);
1019 Archive->Restore(0x0028,0x00199);
1023 * \brief Duplicates a ValEntry or creates it.
1024 * @param group Group number of the Entry
1025 * @param elem Element number of the Entry
1026 * \return pointer to the new Val Entry (NULL when creation failed).
1028 ValEntry *FileHelper::CopyValEntry(uint16_t group, uint16_t elem)
1030 DocEntry *oldE = FileInternal->GetDocEntry(group, elem);
1035 newE = new ValEntry(oldE->GetDictEntry());
1040 newE = GetFile()->NewValEntry(group, elem);
1047 * \brief Duplicates a BinEntry or creates it.
1048 * @param group Group number of the Entry
1049 * @param elem Element number of the Entry
1050 * @param vr Value Representation of the Entry
1051 * FIXME : what is it used for?
1052 * \return pointer to the new Bin Entry (NULL when creation failed).
1054 BinEntry *FileHelper::CopyBinEntry(uint16_t group, uint16_t elem,
1055 const std::string &vr)
1057 DocEntry *oldE = FileInternal->GetDocEntry(group, elem);
1061 if( oldE->GetVR()!=vr )
1066 newE = new BinEntry(oldE->GetDictEntry());
1071 newE = GetFile()->NewBinEntry(group, elem, vr);
1078 * \brief This method is called automatically, just before writting
1079 * in order to produce a 'True Dicom V3' image
1080 * We cannot know *how* the user made the File (reading an old ACR-NEMA
1081 * file or a not very clean DICOM file ...)
1083 * Just before writting :
1084 * - we check the Entries
1085 * - we create the mandatory entries if they are missing
1086 * - we modify the values if necessary
1087 * - we push the sensitive entries to the Archive
1088 * The writing process will restore the entries as they where before
1089 * entering FileHelper::CheckMandatoryElements, so the user will always
1090 * see the entries just as he left them.
1092 * \todo : - warn the user if we had to add some entries :
1093 * even if a mandatory entry is missing, we add it, with a default value
1094 * (we don't want to give up the writting process if user forgot to
1095 * specify Lena's Patient ID, for instance ...)
1096 * - read the whole PS 3.3 Part of DICOM (890 pages)
1097 * and write a *full* checker (probably one method per Modality ...)
1098 * Any contribution is welcome.
1099 * - write a user callable full checker, to allow post reading
1100 * and/or pre writting image consistency check.
1103 void FileHelper::CheckMandatoryElements()
1105 // just to remember : 'official' 0002 group
1106 if ( WriteType != ACR && WriteType != ACR_LIBIDO )
1108 // Group 000002 (Meta Elements) already pushed out
1110 //0002 0000 UL 1 Meta Group Length
1111 //0002 0001 OB 1 File Meta Information Version
1112 //0002 0002 UI 1 Media Stored SOP Class UID
1113 //0002 0003 UI 1 Media Stored SOP Instance UID
1114 //0002 0010 UI 1 Transfer Syntax UID
1115 //0002 0012 UI 1 Implementation Class UID
1116 //0002 0013 SH 1 Implementation Version Name
1117 //0002 0016 AE 1 Source Application Entity Title
1118 //0002 0100 UI 1 Private Information Creator
1119 //0002 0102 OB 1 Private Information
1121 // Create them if not found
1122 // Always modify the value
1123 // Push the entries to the archive.
1124 ValEntry *e_0002_0000 = CopyValEntry(0x0002,0x0000);
1125 e_0002_0000->SetValue("0"); // for the moment
1126 Archive->Push(e_0002_0000);
1128 BinEntry *e_0002_0001 = CopyBinEntry(0x0002,0x0001, "OB");
1129 e_0002_0001->SetBinArea((uint8_t*)Util::GetFileMetaInformationVersion(),
1131 e_0002_0001->SetLength(2);
1132 Archive->Push(e_0002_0001);
1134 // 'Media Stored SOP Class UID'
1135 ValEntry *e_0002_0002 = CopyValEntry(0x0002,0x0002);
1136 // [Secondary Capture Image Storage]
1137 e_0002_0002->SetValue("1.2.840.10008.5.1.4.1.1.7");
1138 Archive->Push(e_0002_0002);
1140 // 'Media Stored SOP Instance UID'
1141 ValEntry *e_0002_0003 = CopyValEntry(0x0002,0x0003);
1142 e_0002_0003->SetValue(Util::CreateUniqueUID());
1143 Archive->Push(e_0002_0003);
1145 // 'Implementation Class UID'
1146 ValEntry *e_0002_0012 = CopyValEntry(0x0002,0x0012);
1147 e_0002_0012->SetValue(Util::CreateUniqueUID());
1148 Archive->Push(e_0002_0012);
1150 // 'Implementation Version Name'
1151 ValEntry *e_0002_0013 = CopyValEntry(0x0002,0x0013);
1152 e_0002_0013->SetValue("GDCM 1.0");
1153 Archive->Push(e_0002_0013);
1155 //'Source Application Entity Title' Not Mandatory
1156 //ValEntry *e_0002_0016 = CopyValEntry(0x0002,0x0016);
1157 // e_0002_0016->SetValue("1.2.840.10008.5.1.4.1.1.7");
1158 // Archive->Push(e_0002_0016);
1161 // Push out 'LibIDO-special' entries, if any
1162 Archive->Push(0x0028,0x0015);
1163 Archive->Push(0x0028,0x0016);
1164 Archive->Push(0x0028,0x0017);
1165 Archive->Push(0x0028,0x00199);
1167 // Deal with the pb of (Bits Stored = 12)
1168 // - we're gonna write the image as Bits Stored = 16
1169 if ( FileInternal->GetEntryValue(0x0028,0x0100) == "12")
1171 ValEntry *e_0028_0100 = CopyValEntry(0x0028,0x0100);
1172 e_0028_0100->SetValue("16");
1173 Archive->Push(e_0028_0100);
1176 // Check if user wasn't drunk ;-)
1178 std::ostringstream s;
1179 // check 'Bits Allocated' vs decent values
1180 int nbBitsAllocated = FileInternal->GetBitsAllocated();
1181 if ( nbBitsAllocated == 0 || nbBitsAllocated > 32)
1183 ValEntry *e_0028_0100 = CopyValEntry(0x0028,0x0100);
1184 e_0028_0100->SetValue("16");
1185 Archive->Push(e_0028_0100);
1186 gdcmWarningMacro("(0028,0100) changed from "
1187 << nbBitsAllocated << " to 16 for consistency purpose");
1188 nbBitsAllocated = 16;
1190 // check 'Bits Stored' vs 'Bits Allocated'
1191 int nbBitsStored = FileInternal->GetBitsStored();
1192 if ( nbBitsStored == 0 || nbBitsStored > nbBitsAllocated )
1194 s << nbBitsAllocated;
1195 ValEntry *e_0028_0101 = CopyValEntry(0x0028,0x0101);
1196 e_0028_0101->SetValue( s.str() );
1197 Archive->Push(e_0028_0101);
1198 gdcmWarningMacro("(0028,0101) changed from "
1199 << nbBitsStored << " to " << nbBitsAllocated
1200 << " for consistency purpose" );
1201 nbBitsStored = nbBitsAllocated;
1203 // check 'Hight Bit Position' vs 'Bits Allocated' and 'Bits Stored'
1204 int highBitPosition = FileInternal->GetHighBitPosition();
1205 if ( highBitPosition == 0 ||
1206 highBitPosition > nbBitsAllocated-1 ||
1207 highBitPosition < nbBitsStored-1 )
1209 ValEntry *e_0028_0102 = CopyValEntry(0x0028,0x0102);
1211 s << nbBitsStored - 1;
1212 e_0028_0102->SetValue( s.str() );
1213 Archive->Push(e_0028_0102);
1214 gdcmWarningMacro("(0028,0102) changed from "
1215 << highBitPosition << " to " << nbBitsAllocated-1
1216 << " for consistency purpose");
1218 // --- Check UID-related Entries ---
1220 // If 'SOP Class UID' exists ('true DICOM' image)
1221 // we create the 'Source Image Sequence' SeqEntry
1222 // to hold informations about the Source Image
1224 ValEntry *e_0008_0016 = FileInternal->GetValEntry(0x0008, 0x0016);
1225 if ( e_0008_0016 != 0 )
1227 // Create 'Source Image Sequence' SeqEntry
1228 SeqEntry *sis = new SeqEntry (
1229 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x2112) );
1230 SQItem *sqi = new SQItem(1);
1231 // (we assume 'SOP Instance UID' exists too)
1232 // create 'Referenced SOP Class UID'
1233 ValEntry *e_0008_1150 = new ValEntry(
1234 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1150) );
1235 e_0008_1150->SetValue( e_0008_0016->GetValue());
1236 sqi->AddEntry(e_0008_1150);
1238 // create 'Referenced SOP Instance UID'
1239 ValEntry *e_0008_0018 = FileInternal->GetValEntry(0x0008, 0x0018);
1240 ValEntry *e_0008_1155 = new ValEntry(
1241 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1155) );
1242 e_0008_1155->SetValue( e_0008_0018->GetValue());
1243 sqi->AddEntry(e_0008_1155);
1245 sis->AddSQItem(sqi,1);
1246 // temporarily replaces any previous 'Source Image Sequence'
1249 // 'Image Type' (The written image is no longer an 'ORIGINAL' one)
1250 ValEntry *e_0008_0008 = CopyValEntry(0x0008,0x0008);
1251 e_0008_0008->SetValue("DERIVED\\PRIMARY");
1252 Archive->Push(e_0008_0008);
1256 // There was no 'SOP Class UID'.
1257 // the source image was NOT a true Dicom one.
1258 // We consider the image is a 'Secondary Capture' one
1260 e_0008_0016 = new ValEntry(
1261 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0016) );
1262 // [Secondary Capture Image Storage]
1263 e_0008_0016 ->SetValue("1.2.840.10008.5.1.4.1.1.7");
1264 Archive->Push(e_0008_0016);
1267 // ---- The user will never have to take any action on the following ----.
1269 // new value for 'SOP Instance UID'
1270 ValEntry *e_0008_0018 = new ValEntry(
1271 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0018) );
1272 e_0008_0018->SetValue( Util::CreateUniqueUID() );
1273 Archive->Push(e_0008_0018);
1275 // Instance Creation Date
1276 ValEntry *e_0008_0012 = CopyValEntry(0x0008,0x0012);
1277 std::string date = Util::GetCurrentDate();
1278 e_0008_0012->SetValue(date.c_str());
1279 Archive->Push(e_0008_0012);
1281 // Instance Creation Time
1282 ValEntry *e_0008_0013 = CopyValEntry(0x0008,0x0013);
1283 std::string time = Util::GetCurrentTime();
1284 e_0008_0013->SetValue(time.c_str());
1285 Archive->Push(e_0008_0013);
1287 // ----- Add Mandatory Entries if missing ---
1289 // Entries whose type is 1 are mandatory, with a mandatory value
1290 // Entries whose type is 1c are mandatory-inside-a-Sequence
1291 // Entries whose type is 2 are mandatory, with a optional value
1292 // Entries whose type is 2c are mandatory-inside-a-Sequence
1293 // Entries whose type is 3 are optional
1295 // 'Serie Instance UID'
1296 // Keep the value if exists
1297 // The user is allowed to create his own Series,
1298 // keeping the same 'Serie Instance UID' for various images
1299 // The user shouldn't add any image to a 'Manufacturer Serie'
1300 // but there is no way no to allowed him to do that
1301 ValEntry *e_0020_000e = FileInternal->GetValEntry(0x0020, 0x000e);
1304 e_0020_000e = new ValEntry(
1305 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0020, 0x000e) );
1306 e_0020_000e->SetValue(Util::CreateUniqueUID() );
1307 Archive->Push(e_0020_000e);
1310 // 'Study Instance UID'
1311 // Keep the value if exists
1312 // The user is allowed to create his own Study,
1313 // keeping the same 'Study Instance UID' for various images
1314 // The user may add images to a 'Manufacturer Study',
1315 // adding new series to an already existing Study
1316 ValEntry *e_0020_000d = FileInternal->GetValEntry(0x0020, 0x000d);
1319 e_0020_000d = new ValEntry(
1320 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0020, 0x000d) );
1321 e_0020_000d->SetValue(Util::CreateUniqueUID() );
1322 Archive->Push(e_0020_000d);
1325 // Modality : if missing we set it to 'OTher'
1326 ValEntry *e_0008_0060 = FileInternal->GetValEntry(0x0008, 0x0060);
1329 e_0008_0060 = new ValEntry(
1330 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0060) );
1331 e_0008_0060->SetValue("OT");
1332 Archive->Push(e_0008_0060);
1335 // Manufacturer : if missing we set it to 'GDCM Factory'
1336 ValEntry *e_0008_0070 = FileInternal->GetValEntry(0x0008, 0x0070);
1339 e_0008_0070 = new ValEntry(
1340 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0070) );
1341 e_0008_0070->SetValue("GDCM Factory");
1342 Archive->Push(e_0008_0070);
1345 // Institution Name : if missing we set it to 'GDCM Hospital'
1346 ValEntry *e_0008_0080 = FileInternal->GetValEntry(0x0008, 0x0080);
1349 e_0008_0080 = new ValEntry(
1350 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0080) );
1351 e_0008_0080->SetValue("GDCM Hospital");
1352 Archive->Push(e_0008_0080);
1355 // Patient's Name : if missing, we set it to 'GDCM^Patient'
1356 ValEntry *e_0010_0010 = FileInternal->GetValEntry(0x0010, 0x0010);
1359 e_0010_0010 = new ValEntry(
1360 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0010, 0x0010) );
1361 e_0010_0010->SetValue("GDCM^Patient");
1362 Archive->Push(e_0010_0010);
1365 // Patient's Birth Date : 'type 2' entry -> must exist, value not mandatory
1366 ValEntry *e_0010_0030 = FileInternal->GetValEntry(0x0010, 0x0030);
1369 e_0010_0030 = new ValEntry(
1370 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0010, 0x0030) );
1371 e_0010_0030->SetValue("");
1372 Archive->Push(e_0010_0030);
1375 // Patient's Sex :'type 2' entry -> must exist, value not mandatory
1376 ValEntry *e_0010_0040 = FileInternal->GetValEntry(0x0010, 0x0040);
1379 e_0010_0040 = new ValEntry(
1380 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0010, 0x0040) );
1381 e_0010_0040->SetValue("");
1382 Archive->Push(e_0010_0040);
1385 // Referring Physician's Name :'type 2' entry -> must exist, value not mandatory
1386 ValEntry *e_0008_0090 = FileInternal->GetValEntry(0x0008, 0x0090);
1389 e_0008_0090 = new ValEntry(
1390 Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0090) );
1391 e_0008_0090->SetValue("");
1392 Archive->Push(e_0008_0090);
1395 // Remove some inconstencies (probably some more will be added)
1397 // if (0028 0008)Number of Frames exists
1398 // Push out (0020 0052),Frame of Reference UID
1399 // (only meaningfull within a Serie)
1400 ValEntry *e_0028_0008 = FileInternal->GetValEntry(0x0028, 0x0008);
1403 Archive->Push(0x0020, 0X0052);
1408 * \brief Restore in the File the initial group 0002
1410 void FileHelper::RestoreWriteMandatory()
1412 // group 0002 may be pushed out for ACR-NEMA writting purposes
1413 Archive->Restore(0x0002,0x0000);
1414 Archive->Restore(0x0002,0x0001);
1415 Archive->Restore(0x0002,0x0002);
1416 Archive->Restore(0x0002,0x0003);
1417 Archive->Restore(0x0002,0x0010);
1418 Archive->Restore(0x0002,0x0012);
1419 Archive->Restore(0x0002,0x0013);
1420 Archive->Restore(0x0002,0x0016);
1421 Archive->Restore(0x0002,0x0100);
1422 Archive->Restore(0x0002,0x0102);
1424 Archive->Restore(0x0008,0x0012);
1425 Archive->Restore(0x0008,0x0013);
1426 Archive->Restore(0x0008,0x0016);
1427 Archive->Restore(0x0008,0x0018);
1428 Archive->Restore(0x0008,0x0060);
1429 Archive->Restore(0x0008,0x0070);
1430 Archive->Restore(0x0008,0x0080);
1431 Archive->Restore(0x0008,0x0090);
1432 Archive->Restore(0x0008,0x2112);
1434 Archive->Restore(0x0010,0x0010);
1435 Archive->Restore(0x0010,0x0030);
1436 Archive->Restore(0x0010,0x0040);
1438 Archive->Restore(0x0020,0x000d);
1439 Archive->Restore(0x0020,0x000e);
1443 //-----------------------------------------------------------------------------
1446 * \brief Factorization for various forms of constructors.
1448 void FileHelper::Initialize()
1450 WriteMode = WMODE_RAW;
1451 WriteType = ExplicitVR;
1453 PixelReadConverter = new PixelReadConvert;
1454 PixelWriteConverter = new PixelWriteConvert;
1455 Archive = new DocEntryArchive( FileInternal );
1457 if ( FileInternal->IsReadable() )
1459 PixelReadConverter->GrabInformationsFromFile( FileInternal );
1464 * \brief Reads/[decompresses] the pixels,
1465 * *without* making RGB from Palette Colors
1466 * @return the pixels area, whatever its type
1467 * (uint8_t is just for prototyping : feel free to Cast it)
1469 uint8_t *FileHelper::GetRaw()
1471 uint8_t *raw = PixelReadConverter->GetRaw();
1474 // The Raw image migth not be loaded yet:
1475 std::ifstream *fp = FileInternal->OpenFile();
1476 PixelReadConverter->ReadAndDecompressPixelData( fp );
1478 FileInternal->CloseFile();
1480 raw = PixelReadConverter->GetRaw();
1483 gdcmWarningMacro( "Read/decompress of pixel data apparently went wrong.");
1490 //-----------------------------------------------------------------------------
1492 * \brief Prints the common part of ValEntry, BinEntry, SeqEntry
1493 * @param os ostream we want to print in
1494 * @param indent (unused)
1496 void FileHelper::Print(std::ostream &os, std::string const &)
1498 FileInternal->SetPrintLevel(PrintLevel);
1499 FileInternal->Print(os);
1501 PixelReadConverter->SetPrintLevel(PrintLevel);
1502 PixelReadConverter->Print(os);
1505 //-----------------------------------------------------------------------------
1506 } // end namespace gdcm