1 /*=========================================================================
4 Module: $RCSfile: gdcmFile.cxx,v $
6 Date: $Date: 2005/01/12 11:33:39 $
7 Version: $Revision: 1.191 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 #include "gdcmGlobal.h"
22 #include "gdcmDocument.h"
23 #include "gdcmDebug.h"
25 #include "gdcmBinEntry.h"
26 #include "gdcmHeader.h"
27 #include "gdcmPixelReadConvert.h"
28 #include "gdcmPixelWriteConvert.h"
29 #include "gdcmDocEntryArchive.h"
35 typedef std::pair<TagDocEntryHT::iterator,TagDocEntryHT::iterator> IterHT;
37 //-------------------------------------------------------------------------
38 // Constructor / Destructor
40 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
41 * file (Header only deals with the ... header)
42 * Opens (in read only and when possible) an existing file and checks
43 * for DICOM compliance. Returns NULL on failure.
44 * It will be up to the user to load the pixels into memory
45 * (see GetImageData, GetImageDataRaw)
46 * \note the in-memory representation of all available tags found in
47 * the DICOM header is post-poned to first header information access.
48 * This avoid a double parsing of public part of the header when
49 * one sets an a posteriori shadow dictionary (efficiency can be
50 * seen as a side effect).
54 HeaderInternal = new Header( );
60 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
61 * file (Header only deals with the ... header)
62 * Opens (in read only and when possible) an existing file and checks
63 * for DICOM compliance. Returns NULL on failure.
64 * It will be up to the user to load the pixels into memory
65 * (see GetImageData, GetImageDataRaw)
66 * \note the in-memory representation of all available tags found in
67 * the DICOM header is post-poned to first header information access.
68 * This avoid a double parsing of public part of the header when
69 * user sets an a posteriori shadow dictionary (efficiency can be
70 * seen as a side effect).
71 * @param header already built Header
73 File::File(Header *header)
75 HeaderInternal = header;
81 * \brief Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3
82 * file (Header only deals with the ... header)
83 * Opens (in read only and when possible) an existing file and checks
84 * for DICOM compliance. Returns NULL on failure.
85 * It will be up to the user to load the pixels into memory
86 * (see GetImageData, GetImageDataRaw)
87 * \note the in-memory representation of all available tags found in
88 * the DICOM header is post-poned to first header information access.
89 * This avoid a double parsing of public part of the header when
90 * one sets an a posteriori shadow dictionary (efficiency can be
91 * seen as a side effect).
92 * @param filename file to be opened for parsing
94 File::File(std::string const & filename )
96 HeaderInternal = new Header( filename );
102 * \brief canonical destructor
103 * \note If the Header was created by the File constructor,
104 * it is destroyed by the File
108 if( PixelReadConverter )
110 delete PixelReadConverter;
112 if( PixelWriteConverter )
114 delete PixelWriteConverter;
123 delete HeaderInternal;
128 //-----------------------------------------------------------------------------
130 void File::Print(std::ostream &os)
132 HeaderInternal->SetPrintLevel(PrintLevel);
133 HeaderInternal->Print(os);
135 PixelReadConverter->SetPrintLevel(PrintLevel);
136 PixelReadConverter->Print(os);
139 //-----------------------------------------------------------------------------
142 * \brief Get the size of the image data
143 * If the image can be RGB (with a lut or by default), the size
144 * corresponds to the RGB image
145 * (use GetImageDataRawSize if you want to be sure to get *only*
146 * the size of the pixels)
147 * @return The image size
149 size_t File::GetImageDataSize()
151 if ( PixelWriteConverter->GetUserData() )
153 return PixelWriteConverter->GetUserDataSize();
156 return PixelReadConverter->GetRGBSize();
160 * \brief Get the size of the image data
161 * If the image could be converted to RGB using a LUT,
162 * this transformation is not taken into account by GetImageDataRawSize
163 * (use GetImageDataSize if you wish)
164 * @return The raw image size
166 size_t File::GetImageDataRawSize()
168 if ( PixelWriteConverter->GetUserData() )
170 return PixelWriteConverter->GetUserDataSize();
173 return PixelReadConverter->GetRawSize();
177 * \brief - Allocates necessary memory,
178 * - Reads the pixels from disk (uncompress if necessary),
179 * - Transforms YBR pixels, if any, into RGB pixels
180 * - Transforms 3 planes R, G, B, if any, into a single RGB Plane
181 * - Transforms single Grey plane + 3 Palettes into a RGB Plane
182 * - Copies the pixel data (image[s]/volume[s]) to newly allocated zone.
183 * @return Pointer to newly allocated pixel data.
184 * NULL if alloc fails
186 uint8_t *File::GetImageData()
188 if ( PixelWriteConverter->GetUserData() )
190 return PixelWriteConverter->GetUserData();
195 // If the decompression failed nothing can be done.
199 if ( HeaderInternal->HasLUT() && PixelReadConverter->BuildRGBImage() )
201 return PixelReadConverter->GetRGB();
205 // When no LUT or LUT conversion fails, return the Raw
206 return PixelReadConverter->GetRaw();
211 * \brief Allocates necessary memory,
212 * Transforms YBR pixels (if any) into RGB pixels
213 * Transforms 3 planes R, G, B (if any) into a single RGB Plane
214 * Copies the pixel data (image[s]/volume[s]) to newly allocated zone.
215 * DOES NOT transform Grey plane + 3 Palettes into a RGB Plane
216 * @return Pointer to newly allocated pixel data.
217 * \ NULL if alloc fails
219 uint8_t *File::GetImageDataRaw ()
226 * Read the pixels from disk (uncompress if necessary),
227 * Transforms YBR pixels, if any, into RGB pixels
228 * Transforms 3 planes R, G, B, if any, into a single RGB Plane
229 * Transforms single Grey plane + 3 Palettes into a RGB Plane
230 * Copies at most MaxSize bytes of pixel data to caller allocated
232 * \warning This function allows people that want to build a volume
233 * from an image stack *not to* have, first to get the image pixels,
234 * and then move them to the volume area.
235 * It's absolutely useless for any VTK user since vtk chooses
236 * to invert the lines of an image, that is the last line comes first
237 * (for some axis related reasons?). Hence he will have
238 * to load the image line by line, starting from the end.
239 * VTK users have to call GetImageData
241 * @param destination Address (in caller's memory space) at which the
242 * pixel data should be copied
243 * @param maxSize Maximum number of bytes to be copied. When MaxSize
244 * is not sufficient to hold the pixel data the copy is not
245 * executed (i.e. no partial copy).
246 * @return On success, the number of bytes actually copied. Zero on
247 * failure e.g. MaxSize is lower than necessary.
249 size_t File::GetImageDataIntoVector (void *destination, size_t maxSize)
253 // If the decompression failed nothing can be done.
257 if ( HeaderInternal->HasLUT() && PixelReadConverter->BuildRGBImage() )
259 if ( PixelReadConverter->GetRGBSize() > maxSize )
261 gdcmVerboseMacro( "Pixel data bigger than caller's expected MaxSize");
265 (void*)PixelReadConverter->GetRGB(),
266 PixelReadConverter->GetRGBSize() );
267 return PixelReadConverter->GetRGBSize();
270 // Either no LUT conversion necessary or LUT conversion failed
271 if ( PixelReadConverter->GetRawSize() > maxSize )
273 gdcmVerboseMacro( "Pixel data bigger than caller's expected MaxSize");
277 (void*)PixelReadConverter->GetRaw(),
278 PixelReadConverter->GetRawSize() );
279 return PixelReadConverter->GetRawSize();
283 * \brief Points the internal pointer to the callers inData
284 * image representation, BUT WITHOUT COPYING THE DATA.
285 * 'image' Pixels are presented as C-like 2D arrays : line per line.
286 * 'volume'Pixels are presented as C-like 3D arrays : plane per plane
287 * \warning Since the pixels are not copied, it is the caller's responsability
288 * not to deallocate it's data before gdcm uses them (e.g. with
289 * the Write() method.
290 * @param inData user supplied pixel area
291 * @param expectedSize total image size, in Bytes
295 void File::SetImageData(uint8_t *inData, size_t expectedSize)
297 SetUserData(inData,expectedSize);
301 * \brief Set the image datas defined by the user
302 * \warning When writting the file, this datas are get as default datas to write
304 void File::SetUserData(uint8_t *data, size_t expectedSize)
306 PixelWriteConverter->SetUserData(data,expectedSize);
310 * \brief Get the image datas defined by the user
311 * \warning When writting the file, this datas are get as default data to write
313 uint8_t *File::GetUserData()
315 return PixelWriteConverter->GetUserData();
319 * \brief Get the image data size defined by the user
320 * \warning When writting the file, this datas are get as default data to write
322 size_t File::GetUserDataSize()
324 return PixelWriteConverter->GetUserDataSize();
328 * \brief Get the image datas from the file.
329 * If a LUT is found, the data are expanded to be RGB
331 uint8_t *File::GetRGBData()
333 return PixelReadConverter->GetRGB();
337 * \brief Get the image data size from the file.
338 * If a LUT is found, the data are expanded to be RGB
340 size_t File::GetRGBDataSize()
342 return PixelReadConverter->GetRGBSize();
346 * \brief Get the image datas from the file.
347 * If a LUT is found, the datas are not expanded !
349 uint8_t *File::GetRawData()
351 return PixelReadConverter->GetRaw();
355 * \brief Get the image data size from the file.
356 * If a LUT is found, the data are not expanded !
358 size_t File::GetRawDataSize()
360 return PixelReadConverter->GetRawSize();
364 * \brief Writes on disk A SINGLE Dicom file
365 * NO test is performed on processor "Endiannity".
366 * It's up to the user to call his Reader properly
367 * @param fileName name of the file to be created
368 * (any already existing file is over written)
369 * @return false if write fails
372 bool File::WriteRawData(std::string const &fileName)
374 std::ofstream fp1(fileName.c_str(), std::ios::out | std::ios::binary );
377 gdcmVerboseMacro( "Fail to open (write) file:" << fileName.c_str());
381 if( PixelWriteConverter->GetUserData() )
383 fp1.write( (char*)PixelWriteConverter->GetUserData(),
384 PixelWriteConverter->GetUserDataSize() );
386 else if ( PixelReadConverter->GetRGB() )
388 fp1.write( (char*)PixelReadConverter->GetRGB(),
389 PixelReadConverter->GetRGBSize());
391 else if ( PixelReadConverter->GetRaw() )
393 fp1.write( (char*)PixelReadConverter->GetRaw(),
394 PixelReadConverter->GetRawSize());
398 gdcmErrorMacro( "Nothing written." );
407 * \brief Writes on disk A SINGLE Dicom file,
408 * using the Implicit Value Representation convention
409 * NO test is performed on processor "Endiannity".
410 * @param fileName name of the file to be created
411 * (any already existing file is overwritten)
412 * @return false if write fails
415 bool File::WriteDcmImplVR (std::string const &fileName)
417 SetWriteTypeToDcmImplVR();
418 return Write(fileName);
422 * \brief Writes on disk A SINGLE Dicom file,
423 * using the Explicit Value Representation convention
424 * NO test is performed on processor "Endiannity".
425 * @param fileName name of the file to be created
426 * (any already existing file is overwritten)
427 * @return false if write fails
430 bool File::WriteDcmExplVR (std::string const &fileName)
432 SetWriteTypeToDcmExplVR();
433 return Write(fileName);
437 * \brief Writes on disk A SINGLE Dicom file,
438 * using the ACR-NEMA convention
439 * NO test is performed on processor "Endiannity".
440 * (a l'attention des logiciels cliniques
441 * qui ne prennent en entrée QUE des images ACR ...
442 * \warning if a DICOM_V3 header is supplied,
443 * groups < 0x0008 and shadow groups are ignored
444 * \warning NO TEST is performed on processor "Endiannity".
445 * @param fileName name of the file to be created
446 * (any already existing file is overwritten)
447 * @return false if write fails
450 bool File::WriteAcr (std::string const &fileName)
453 return Write(fileName);
457 * \brief Writes on disk A SINGLE Dicom file,
458 * @param fileName name of the file to be created
459 * (any already existing file is overwritten)
460 * @return false if write fails
462 bool File::Write(std::string const &fileName)
467 SetWriteFileTypeToImplicitVR();
470 SetWriteFileTypeToExplicitVR();
474 SetWriteFileTypeToACR();
477 SetWriteFileTypeToExplicitVR();
480 // --------------------------------------------------------------
481 // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
483 // if recognition code tells us we dealt with a LibIDO image
484 // we reproduce on disk the switch between lineNumber and columnNumber
485 // just before writting ...
486 /// \todo the best trick would be *change* the recognition code
487 /// but pb expected if user deals with, e.g. COMPLEX images
488 if( WriteType == ACR_LIBIDO )
494 SetWriteToNoLibido();
496 // ----------------- End of Special Patch ----------------
508 bool check = CheckWriteIntegrity();
511 check = HeaderInternal->Write(fileName,WriteType);
515 RestoreWriteFileType();
517 // --------------------------------------------------------------
518 // Special Patch to allow gdcm to re-write ACR-LibIDO formated images
520 // ...and we restore the Header to be Dicom Compliant again
521 // just after writting
522 RestoreWriteOfLibido();
523 // ----------------- End of Special Patch ----------------
529 * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
530 * through it's (group, element) and modifies it's content with
532 * @param content new value (string) to substitute with
533 * @param group group number of the Dicom Element to modify
534 * @param elem element number of the Dicom Element to modify
536 bool File::SetEntry(std::string const &content,
537 uint16_t group, uint16_t elem)
539 return HeaderInternal->SetEntry(content,group,elem);
544 * \brief Accesses an existing DocEntry (i.e. a Dicom Element)
545 * through it's (group, element) and modifies it's content with
547 * @param content new value (void* -> uint8_t*) to substitute with
548 * @param lgth new value length
549 * @param group group number of the Dicom Element to modify
550 * @param elem element number of the Dicom Element to modify
552 bool File::SetEntry(uint8_t *content, int lgth,
553 uint16_t group, uint16_t elem)
555 return HeaderInternal->SetEntry(content,lgth,group,elem);
559 * \brief Modifies the value of a given Doc Entry (Dicom Element)
560 * when it exists. Create it with the given value when unexistant.
561 * @param content (string) Value to be set
562 * @param group Group number of the Entry
563 * @param elem Element number of the Entry
564 * \return pointer to the modified/created Header Entry (NULL when creation
567 bool File::ReplaceOrCreate(std::string const &content,
568 uint16_t group, uint16_t elem)
570 return HeaderInternal->ReplaceOrCreate(content,group,elem) != NULL;
574 * \brief Modifies the value of a given Header Entry (Dicom Element)
575 * when it exists. Create it with the given value when unexistant.
576 * A copy of the binArea is made to be kept in the Document.
577 * @param binArea (binary) value to be set
578 * @param group Group number of the Entry
579 * @param elem Element number of the Entry
580 * \return pointer to the modified/created Header Entry (NULL when creation
583 bool File::ReplaceOrCreate(uint8_t *binArea, int lgth,
584 uint16_t group, uint16_t elem)
586 return HeaderInternal->ReplaceOrCreate(binArea,lgth,group,elem) != NULL;
590 * \brief Access to the underlying \ref PixelReadConverter RGBA LUT
592 uint8_t* File::GetLutRGBA()
594 return PixelReadConverter->GetLutRGBA();
597 //-----------------------------------------------------------------------------
601 * \brief Check the write integrity
603 * The tests made are :
604 * - verify the size of the image to write with the possible write
605 * when the user set an image data
606 * @return true if the check successfulls
608 bool File::CheckWriteIntegrity()
610 if(PixelWriteConverter->GetUserData())
612 int numberBitsAllocated = HeaderInternal->GetBitsAllocated();
613 if ( numberBitsAllocated == 0 || numberBitsAllocated == 12 )
615 numberBitsAllocated = 16;
618 size_t decSize = HeaderInternal->GetXSize()
619 * HeaderInternal->GetYSize()
620 * HeaderInternal->GetZSize()
621 * ( numberBitsAllocated / 8 )
622 * HeaderInternal->GetSamplesPerPixel();
623 size_t rgbSize = decSize;
624 if( HeaderInternal->HasLUT() )
625 rgbSize = decSize * 3;
630 if( decSize!=PixelWriteConverter->GetUserDataSize() )
632 gdcmVerboseMacro( "Data size is incorrect (Raw)" << decSize
633 << " / " << PixelWriteConverter->GetUserDataSize() );
638 if( rgbSize!=PixelWriteConverter->GetUserDataSize() )
640 gdcmVerboseMacro( "Data size is incorrect (RGB)" << decSize
641 << " / " << PixelWriteConverter->GetUserDataSize() );
651 void File::SetWriteToRaw()
653 if( HeaderInternal->GetNumberOfScalarComponents() == 3
654 && !HeaderInternal->HasLUT())
660 ValEntry *photInt = CopyValEntry(0x0028,0x0004);
661 if(HeaderInternal->HasLUT())
663 photInt->SetValue("PALETTE COLOR ");
667 photInt->SetValue("MONOCHROME1 ");
670 PixelWriteConverter->SetReadData(PixelReadConverter->GetRaw(),
671 PixelReadConverter->GetRawSize());
674 CopyBinEntry(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel());
675 pixel->SetValue(GDCM_BINLOADED);
676 pixel->SetBinArea(PixelWriteConverter->GetData(),false);
677 pixel->SetLength(PixelWriteConverter->GetDataSize());
679 Archive->Push(photInt);
680 Archive->Push(pixel);
684 void File::SetWriteToRGB()
686 if(HeaderInternal->GetNumberOfScalarComponents()==3)
688 PixelReadConverter->BuildRGBImage();
690 ValEntry *spp = CopyValEntry(0x0028,0x0002);
693 ValEntry *planConfig = CopyValEntry(0x0028,0x0006);
694 planConfig->SetValue("0 ");
696 ValEntry *photInt = CopyValEntry(0x0028,0x0004);
697 photInt->SetValue("RGB ");
699 if(PixelReadConverter->GetRGB())
701 PixelWriteConverter->SetReadData(PixelReadConverter->GetRGB(),
702 PixelReadConverter->GetRGBSize());
706 PixelWriteConverter->SetReadData(PixelReadConverter->GetRaw(),
707 PixelReadConverter->GetRawSize());
711 CopyBinEntry(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel());
712 pixel->SetValue(GDCM_BINLOADED);
713 pixel->SetBinArea(PixelWriteConverter->GetData(),false);
714 pixel->SetLength(PixelWriteConverter->GetDataSize());
717 Archive->Push(planConfig);
718 Archive->Push(photInt);
719 Archive->Push(pixel);
722 Archive->Push(0x0028,0x1101);
723 Archive->Push(0x0028,0x1102);
724 Archive->Push(0x0028,0x1103);
725 Archive->Push(0x0028,0x1201);
726 Archive->Push(0x0028,0x1202);
727 Archive->Push(0x0028,0x1203);
730 // Thus, we have a RGB image and the bits allocated = 24 and
731 // samples per pixels = 1 (in the read file)
732 if(HeaderInternal->GetBitsAllocated()==24)
734 ValEntry *bitsAlloc = CopyValEntry(0x0028,0x0100);
735 bitsAlloc->SetValue("8 ");
737 ValEntry *bitsStored = CopyValEntry(0x0028,0x0101);
738 bitsStored->SetValue("8 ");
740 ValEntry *highBit = CopyValEntry(0x0028,0x0102);
741 highBit->SetValue("7 ");
743 Archive->Push(bitsAlloc);
744 Archive->Push(bitsStored);
745 Archive->Push(highBit);
754 void File::RestoreWrite()
756 Archive->Restore(0x0028,0x0002);
757 Archive->Restore(0x0028,0x0004);
758 Archive->Restore(0x0028,0x0006);
759 Archive->Restore(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel());
761 // For old ACR-NEMA (24 bits problem)
762 Archive->Restore(0x0028,0x0100);
763 Archive->Restore(0x0028,0x0101);
764 Archive->Restore(0x0028,0x0102);
767 Archive->Restore(0x0028,0x1101);
768 Archive->Restore(0x0028,0x1102);
769 Archive->Restore(0x0028,0x1103);
770 Archive->Restore(0x0028,0x1201);
771 Archive->Restore(0x0028,0x1202);
772 Archive->Restore(0x0028,0x1203);
775 void File::SetWriteFileTypeToACR()
777 Archive->Push(0x0002,0x0010);
780 void File::SetWriteFileTypeToExplicitVR()
782 std::string ts = Util::DicomString(
783 Global::GetTS()->GetSpecialTransferSyntax(TS::ExplicitVRLittleEndian) );
785 ValEntry *tss = CopyValEntry(0x0002,0x0010);
791 void File::SetWriteFileTypeToImplicitVR()
793 std::string ts = Util::DicomString(
794 Global::GetTS()->GetSpecialTransferSyntax(TS::ImplicitVRLittleEndian) );
796 ValEntry *tss = CopyValEntry(0x0002,0x0010);
802 void File::RestoreWriteFileType()
804 Archive->Restore(0x0002,0x0010);
807 void File::SetWriteToLibido()
809 ValEntry *oldRow = dynamic_cast<ValEntry *>
810 (HeaderInternal->GetDocEntry(0x0028, 0x0010));
811 ValEntry *oldCol = dynamic_cast<ValEntry *>
812 (HeaderInternal->GetDocEntry(0x0028, 0x0011));
814 if( oldRow && oldCol )
816 std::string rows, columns;
818 ValEntry *newRow=new ValEntry(oldRow->GetDictEntry());
819 ValEntry *newCol=new ValEntry(oldCol->GetDictEntry());
821 newRow->Copy(oldCol);
822 newCol->Copy(oldRow);
824 newRow->SetValue(oldCol->GetValue());
825 newCol->SetValue(oldRow->GetValue());
827 Archive->Push(newRow);
828 Archive->Push(newCol);
831 ValEntry *libidoCode = CopyValEntry(0x0008,0x0010);
832 libidoCode->SetValue("ACRNEMA_LIBIDO_1.1");
833 Archive->Push(libidoCode);
836 void File::SetWriteToNoLibido()
838 ValEntry *recCode = dynamic_cast<ValEntry *>
839 (HeaderInternal->GetDocEntry(0x0008,0x0010));
842 if( recCode->GetValue() == "ACRNEMA_LIBIDO_1.1" )
844 ValEntry *libidoCode = CopyValEntry(0x0008,0x0010);
845 libidoCode->SetValue("");
846 Archive->Push(libidoCode);
851 void File::RestoreWriteOfLibido()
853 Archive->Restore(0x0028,0x0010);
854 Archive->Restore(0x0028,0x0011);
855 Archive->Restore(0x0008,0x0010);
858 ValEntry *File::CopyValEntry(uint16_t group,uint16_t elem)
860 DocEntry *oldE = HeaderInternal->GetDocEntry(group, elem);
865 newE = new ValEntry(oldE->GetDictEntry());
870 newE = GetHeader()->NewValEntry(group,elem);
876 BinEntry *File::CopyBinEntry(uint16_t group,uint16_t elem)
878 DocEntry *oldE = HeaderInternal->GetDocEntry(group, elem);
883 newE = new BinEntry(oldE->GetDictEntry());
888 newE = GetHeader()->NewBinEntry(group,elem);
894 //-----------------------------------------------------------------------------
897 * \brief Factorization for various forms of constructors.
899 void File::Initialise()
901 WriteMode = WMODE_RAW;
902 WriteType = ExplicitVR;
904 PixelReadConverter = new PixelReadConvert;
905 PixelWriteConverter = new PixelWriteConvert;
906 Archive = new DocEntryArchive( HeaderInternal );
908 if ( HeaderInternal->IsReadable() )
910 PixelReadConverter->GrabInformationsFromHeader( HeaderInternal );
914 uint8_t *File::GetRaw()
916 uint8_t *raw = PixelReadConverter->GetRaw();
919 // The Raw image migth not be loaded yet:
920 std::ifstream *fp = HeaderInternal->OpenFile();
921 PixelReadConverter->ReadAndDecompressPixelData( fp );
923 HeaderInternal->CloseFile();
925 raw = PixelReadConverter->GetRaw();
928 gdcmVerboseMacro( "Read/decompress of pixel data apparently went wrong.");
936 //-----------------------------------------------------------------------------
939 //-----------------------------------------------------------------------------
940 } // end namespace gdcm