1 /*=========================================================================
4 Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
6 Date: $Date: 2005/02/05 01:37:09 $
7 Version: $Revision: 1.49 $
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 =========================================================================*/
19 #include "gdcmDebug.h"
21 #include "gdcmGlobal.h"
23 #include "gdcmPixelReadConvert.h"
24 #include "gdcmDocEntry.h"
25 #include "gdcmRLEFramesInfo.h"
26 #include "gdcmJPEGFragmentsInfo.h"
29 #include <stdio.h> //for sscanf
33 //-----------------------------------------------------------------------------
34 #define str2num(str, typeNum) *((typeNum *)(str))
36 //-----------------------------------------------------------------------------
37 // Constructor / Destructor
39 PixelReadConvert::PixelReadConvert()
51 /// Canonical Destructor
52 PixelReadConvert::~PixelReadConvert()
57 //-----------------------------------------------------------------------------
60 * \brief Predicate to know whether the image[s] (once Raw) is RGB.
61 * \note See comments of \ref ConvertHandleColor
63 bool PixelReadConvert::IsRawRGB()
66 || PlanarConfiguration == 2
74 * \brief Gets various usefull informations from the file header
75 * @param file gdcm::File pointer
77 void PixelReadConvert::GrabInformationsFromFile( File *file )
79 // Number of Bits Allocated for storing a Pixel is defaulted to 16
80 // when absent from the file.
81 BitsAllocated = file->GetBitsAllocated();
82 if ( BitsAllocated == 0 )
87 // Number of "Bits Stored", defaulted to number of "Bits Allocated"
88 // when absent from the file.
89 BitsStored = file->GetBitsStored();
90 if ( BitsStored == 0 )
92 BitsStored = BitsAllocated;
95 // High Bit Position, defaulted to "Bits Allocated" - 1
96 HighBitPosition = file->GetHighBitPosition();
97 if ( HighBitPosition == 0 )
99 HighBitPosition = BitsAllocated - 1;
102 XSize = file->GetXSize();
103 YSize = file->GetYSize();
104 ZSize = file->GetZSize();
105 SamplesPerPixel = file->GetSamplesPerPixel();
106 PixelSize = file->GetPixelSize();
107 PixelSign = file->IsSignedPixelData();
108 SwapCode = file->GetSwapCode();
109 std::string ts = file->GetTransferSyntax();
111 ( ! file->IsDicomV3() )
112 || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian
113 || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndianDLXGE
114 || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian
115 || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian
116 || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::DeflatedExplicitVRLittleEndian;
118 IsJPEG2000 = Global::GetTS()->IsJPEG2000(ts);
119 IsJPEGLS = Global::GetTS()->IsJPEGLS(ts);
120 IsJPEGLossy = Global::GetTS()->IsJPEGLossy(ts);
121 IsJPEGLossless = Global::GetTS()->IsJPEGLossless(ts);
122 IsRLELossless = Global::GetTS()->IsRLELossless(ts);
124 PixelOffset = file->GetPixelOffset();
125 PixelDataLength = file->GetPixelAreaLength();
126 RLEInfo = file->GetRLEInfo();
127 JPEGInfo = file->GetJPEGInfo();
129 PlanarConfiguration = file->GetPlanarConfiguration();
130 IsMonochrome = file->IsMonochrome();
131 IsPaletteColor = file->IsPaletteColor();
132 IsYBRFull = file->IsYBRFull();
134 /////////////////////////////////////////////////////////////////
136 HasLUT = file->HasLUT();
139 // Just in case some access to a File element requires disk access.
140 LutRedDescriptor = file->GetEntryValue( 0x0028, 0x1101 );
141 LutGreenDescriptor = file->GetEntryValue( 0x0028, 0x1102 );
142 LutBlueDescriptor = file->GetEntryValue( 0x0028, 0x1103 );
144 // Depending on the value of Document::MAX_SIZE_LOAD_ELEMENT_VALUE
145 // [ refer to invocation of Document::SetMaxSizeLoadEntry() in
146 // Document::Document() ], the loading of the value (content) of a
147 // [Bin|Val]Entry occurence migth have been hindered (read simply NOT
148 // loaded). Hence, we first try to obtain the LUTs data from the file
149 // and when this fails we read the LUTs data directly from disk.
150 // \TODO Reading a [Bin|Val]Entry directly from disk is a kludge.
151 // We should NOT bypass the [Bin|Val]Entry class. Instead
152 // an access to an UNLOADED content of a [Bin|Val]Entry occurence
153 // (e.g. BinEntry::GetBinArea()) should force disk access from
154 // within the [Bin|Val]Entry class itself. The only problem
155 // is that the [Bin|Val]Entry is unaware of the FILE* is was
156 // parsed from. Fix that. FIXME.
159 file->LoadEntryBinArea(0x0028, 0x1201);
160 LutRedData = (uint8_t*)file->GetEntryBinArea( 0x0028, 0x1201 );
163 gdcmWarningMacro( "Unable to read Red LUT data" );
167 file->LoadEntryBinArea(0x0028, 0x1202);
168 LutGreenData = (uint8_t*)file->GetEntryBinArea(0x0028, 0x1202 );
171 gdcmWarningMacro( "Unable to read Green LUT data" );
175 file->LoadEntryBinArea(0x0028, 0x1203);
176 LutBlueData = (uint8_t*)file->GetEntryBinArea( 0x0028, 0x1203 );
179 gdcmWarningMacro( "Unable to read Blue LUT data" );
183 ComputeRawAndRGBSizes();
186 /// \brief Reads from disk and decompresses Pixels
187 bool PixelReadConvert::ReadAndDecompressPixelData( std::ifstream *fp )
189 // ComputeRawAndRGBSizes is already made by
190 // ::GrabInformationsFromfile. So, the structure sizes are
194 //////////////////////////////////////////////////
195 //// First stage: get our hands on the Pixel Data.
198 gdcmWarningMacro( "Unavailable file pointer." );
202 fp->seekg( PixelOffset, std::ios::beg );
203 if( fp->fail() || fp->eof())
205 gdcmWarningMacro( "Unable to find PixelOffset in file." );
211 //////////////////////////////////////////////////
212 //// Second stage: read from disk dans decompress.
213 if ( BitsAllocated == 12 )
215 ReadAndDecompress12BitsTo16Bits( fp);
219 // This problem can be found when some obvious informations are found
220 // after the field containing the image data. In this case, these
221 // bad data are added to the size of the image (in the PixelDataLength
222 // variable). But RawSize is the right size of the image !
223 if( PixelDataLength != RawSize)
225 gdcmWarningMacro( "Mismatch between PixelReadConvert : "
226 << PixelDataLength << " and RawSize : " << RawSize );
228 if( PixelDataLength > RawSize)
230 fp->read( (char*)Raw, RawSize);
234 fp->read( (char*)Raw, PixelDataLength);
237 if ( fp->fail() || fp->eof())
239 gdcmWarningMacro( "Reading of Raw pixel data failed." );
243 else if ( IsRLELossless )
245 if ( ! RLEInfo->DecompressRLEFile( fp, Raw, XSize, YSize, ZSize, BitsAllocated ) )
247 gdcmWarningMacro( "RLE decompressor failed." );
253 // Default case concerns JPEG family
254 if ( ! ReadAndDecompressJPEGFile( fp ) )
256 gdcmWarningMacro( "JPEG decompressor failed." );
261 ////////////////////////////////////////////
262 //// Third stage: twigle the bytes and bits.
263 ConvertReorderEndianity();
264 ConvertReArrangeBits();
265 ConvertHandleColor();
270 /// Deletes Pixels Area
271 void PixelReadConvert::Squeeze()
287 * \brief Build the RGB image from the Raw imagage and the LUTs.
289 bool PixelReadConvert::BuildRGBImage()
293 // The job is already done.
299 // The job can't be done
306 // The job can't be done
312 uint8_t *localRGB = RGB;
313 for (size_t i = 0; i < RawSize; ++i )
316 *localRGB++ = LutRGBA[j];
317 *localRGB++ = LutRGBA[j+1];
318 *localRGB++ = LutRGBA[j+2];
323 //-----------------------------------------------------------------------------
326 //-----------------------------------------------------------------------------
329 * \brief Read from file a 12 bits per pixel image and decompress it
330 * into a 16 bits per pixel image.
332 void PixelReadConvert::ReadAndDecompress12BitsTo16Bits( std::ifstream *fp )
333 throw ( FormatError )
335 int nbPixels = XSize * YSize;
336 uint16_t *localDecompres = (uint16_t*)Raw;
338 for( int p = 0; p < nbPixels; p += 2 )
342 fp->read( (char*)&b0, 1);
343 if ( fp->fail() || fp->eof() )
345 throw FormatError( "PixelReadConvert::ReadAndDecompress12BitsTo16Bits()",
346 "Unfound first block" );
349 fp->read( (char*)&b1, 1 );
350 if ( fp->fail() || fp->eof())
352 throw FormatError( "PixelReadConvert::ReadAndDecompress12BitsTo16Bits()",
353 "Unfound second block" );
356 fp->read( (char*)&b2, 1 );
357 if ( fp->fail() || fp->eof())
359 throw FormatError( "PixelReadConvert::ReadAndDecompress12BitsTo16Bits()",
360 "Unfound second block" );
363 // Two steps are necessary to please VC++
365 // 2 pixels 12bit = [0xABCDEF]
366 // 2 pixels 16bit = [0x0ABD] + [0x0FCE]
368 *localDecompres++ = ((b0 >> 4) << 8) + ((b0 & 0x0f) << 4) + (b1 & 0x0f);
370 *localDecompres++ = ((b2 & 0x0f) << 8) + ((b1 >> 4) << 4) + (b2 >> 4);
372 /// \todo JPR Troubles expected on Big-Endian processors ?
377 * \brief Reads from disk the Pixel Data of JPEG Dicom encapsulated
378 * file and decompress it.
379 * @param fp File Pointer
382 bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp )
386 gdcmWarningMacro( "Sorry, JPEG2000 not yet taken into account" );
387 fp->seekg( JPEGInfo->GetFirstFragment()->GetOffset(), std::ios::beg);
388 // if ( ! gdcm_read_JPEG2000_file( fp,Raw ) )
394 gdcmWarningMacro( "Sorry, JPEG-LS not yet taken into account" );
395 fp->seekg( JPEGInfo->GetFirstFragment()->GetOffset(), std::ios::beg);
396 // if ( ! gdcm_read_JPEGLS_file( fp,Raw ) )
401 // Precompute the offset localRaw will be shifted with
402 int length = XSize * YSize * SamplesPerPixel;
403 int numberBytes = BitsAllocated / 8;
405 JPEGInfo->DecompressFromFile(fp, Raw, BitsStored, numberBytes, length );
410 * \brief Build Red/Green/Blue/Alpha LUT from File
411 * when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
412 * and (0028,1101),(0028,1102),(0028,1102)
413 * - xxx Palette Color Lookup Table Descriptor - are found
414 * and (0028,1201),(0028,1202),(0028,1202)
415 * - xxx Palette Color Lookup Table Data - are found
416 * \warning does NOT deal with :
417 * 0028 1100 Gray Lookup Table Descriptor (Retired)
418 * 0028 1221 Segmented Red Palette Color Lookup Table Data
419 * 0028 1222 Segmented Green Palette Color Lookup Table Data
420 * 0028 1223 Segmented Blue Palette Color Lookup Table Data
421 * no known Dicom reader deals with them :-(
422 * @return a RGBA Lookup Table
424 void PixelReadConvert::BuildLUTRGBA()
431 // http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
433 if ( ! IsPaletteColor )
438 if ( LutRedDescriptor == GDCM_UNFOUND
439 || LutGreenDescriptor == GDCM_UNFOUND
440 || LutBlueDescriptor == GDCM_UNFOUND )
445 ////////////////////////////////////////////
446 // Extract the info from the LUT descriptors
447 int lengthR; // Red LUT length in Bytes
448 int debR; // Subscript of the first Lut Value
449 int nbitsR; // Lut item size (in Bits)
450 int nbRead = sscanf( LutRedDescriptor.c_str(),
452 &lengthR, &debR, &nbitsR );
455 gdcmWarningMacro( "Wrong Red LUT descriptor" );
458 int lengthG; // Green LUT length in Bytes
459 int debG; // Subscript of the first Lut Value
460 int nbitsG; // Lut item size (in Bits)
461 nbRead = sscanf( LutGreenDescriptor.c_str(),
463 &lengthG, &debG, &nbitsG );
466 gdcmWarningMacro( "Wrong Green LUT descriptor" );
469 int lengthB; // Blue LUT length in Bytes
470 int debB; // Subscript of the first Lut Value
471 int nbitsB; // Lut item size (in Bits)
472 nbRead = sscanf( LutRedDescriptor.c_str(),
474 &lengthB, &debB, &nbitsB );
477 gdcmWarningMacro( "Wrong Blue LUT descriptor" );
480 ////////////////////////////////////////////////////////
481 if ( ( ! LutRedData ) || ( ! LutGreenData ) || ( ! LutBlueData ) )
486 ////////////////////////////////////////////////
487 // forge the 4 * 8 Bits Red/Green/Blue/Alpha LUT
488 LutRGBA = new uint8_t[ 1024 ]; // 256 * 4 (R, G, B, Alpha)
492 memset( LutRGBA, 0, 1024 );
495 if ( ( nbitsR == 16 ) && ( BitsAllocated == 8 ) )
497 // when LUT item size is different than pixel size
498 mult = 2; // high byte must be = low byte
502 // See PS 3.3-2003 C.11.1.1.2 p 619
506 // if we get a black image, let's just remove the '+1'
507 // from 'i*mult+1' and check again
508 // if it works, we shall have to check the 3 Palettes
509 // to see which byte is ==0 (first one, or second one)
511 // We give up the checking to avoid some (useless ?) overhead
512 // (optimistic asumption)
514 uint8_t *a = LutRGBA + 0;
515 for( i=0; i < lengthR; ++i )
517 *a = LutRedData[i*mult+1];
522 for( i=0; i < lengthG; ++i)
524 *a = LutGreenData[i*mult+1];
529 for(i=0; i < lengthB; ++i)
531 *a = LutBlueData[i*mult+1];
536 for(i=0; i < 256; ++i)
538 *a = 1; // Alpha component
544 * \brief Swap the bytes, according to \ref SwapCode.
546 void PixelReadConvert::ConvertSwapZone()
550 if( BitsAllocated == 16 )
552 uint16_t *im16 = (uint16_t*)Raw;
560 for( i = 0; i < RawSize / 2; i++ )
562 im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
566 gdcmWarningMacro("SwapCode value (16 bits) not allowed.");
569 else if( BitsAllocated == 32 )
574 uint32_t *im32 = (uint32_t*)Raw;
580 for( i = 0; i < RawSize / 4; i++ )
582 low = im32[i] & 0x0000ffff; // 4321
583 high = im32[i] >> 16;
584 high = ( high >> 8 ) | ( high << 8 );
585 low = ( low >> 8 ) | ( low << 8 );
587 im32[i] = ( s32 << 16 ) | high;
591 for( i = 0; i < RawSize / 4; i++ )
593 low = im32[i] & 0x0000ffff; // 2143
594 high = im32[i] >> 16;
595 high = ( high >> 8 ) | ( high << 8 );
596 low = ( low >> 8 ) | ( low << 8 );
598 im32[i] = ( s32 << 16 ) | low;
602 for( i = 0; i < RawSize / 4; i++ )
604 low = im32[i] & 0x0000ffff; // 3412
605 high = im32[i] >> 16;
607 im32[i] = ( s32 << 16 ) | high;
611 gdcmWarningMacro("SwapCode value (32 bits) not allowed." );
617 * \brief Deal with endianness i.e. re-arange bytes inside the integer
619 void PixelReadConvert::ConvertReorderEndianity()
621 if ( BitsAllocated != 8 )
626 // Special kludge in order to deal with xmedcon broken images:
627 if ( BitsAllocated == 16
628 && BitsStored < BitsAllocated
631 int l = (int)( RawSize / ( BitsAllocated / 8 ) );
632 uint16_t *deb = (uint16_t *)Raw;
633 for(int i = 0; i<l; i++)
645 * \brief Re-arrange the bits within the bytes.
648 bool PixelReadConvert::ConvertReArrangeBits() throw ( FormatError )
650 if ( BitsStored != BitsAllocated )
652 int l = (int)( RawSize / ( BitsAllocated / 8 ) );
653 if ( BitsAllocated == 16 )
655 uint16_t mask = 0xffff;
656 mask = mask >> ( BitsAllocated - BitsStored );
657 uint16_t *deb = (uint16_t*)Raw;
658 for(int i = 0; i<l; i++)
660 *deb = (*deb >> (BitsStored - HighBitPosition - 1)) & mask;
664 else if ( BitsAllocated == 32 )
666 uint32_t mask = 0xffffffff;
667 mask = mask >> ( BitsAllocated - BitsStored );
668 uint32_t *deb = (uint32_t*)Raw;
669 for(int i = 0; i<l; i++)
671 *deb = (*deb >> (BitsStored - HighBitPosition - 1)) & mask;
677 gdcmWarningMacro("Weird image");
678 throw FormatError( "Weird image !?" );
685 * \brief Convert (Red plane, Green plane, Blue plane) to RGB pixels
686 * \warning Works on all the frames at a time
688 void PixelReadConvert::ConvertRGBPlanesToRGBPixels()
690 uint8_t *localRaw = Raw;
691 uint8_t *copyRaw = new uint8_t[ RawSize ];
692 memmove( copyRaw, localRaw, RawSize );
694 int l = XSize * YSize * ZSize;
696 uint8_t *a = copyRaw;
697 uint8_t *b = copyRaw + l;
698 uint8_t *c = copyRaw + l + l;
700 for (int j = 0; j < l; j++)
702 *(localRaw++) = *(a++);
703 *(localRaw++) = *(b++);
704 *(localRaw++) = *(c++);
710 * \brief Convert (cY plane, cB plane, cR plane) to RGB pixels
711 * \warning Works on all the frames at a time
713 void PixelReadConvert::ConvertYcBcRPlanesToRGBPixels()
715 uint8_t *localRaw = Raw;
716 uint8_t *copyRaw = new uint8_t[ RawSize ];
717 memmove( copyRaw, localRaw, RawSize );
719 // to see the tricks about YBR_FULL, YBR_FULL_422,
720 // YBR_PARTIAL_422, YBR_ICT, YBR_RCT have a look at :
721 // ftp://medical.nema.org/medical/dicom/final/sup61_ft.pdf
722 // and be *very* affraid
724 int l = XSize * YSize;
725 int nbFrames = ZSize;
727 uint8_t *a = copyRaw;
728 uint8_t *b = copyRaw + l;
729 uint8_t *c = copyRaw + l + l;
732 /// \todo : Replace by the 'well known' integer computation
733 /// counterpart. Refer to
734 /// http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf
735 /// for code optimisation.
737 for ( int i = 0; i < nbFrames; i++ )
739 for ( int j = 0; j < l; j++ )
741 R = 1.164 *(*a-16) + 1.596 *(*c -128) + 0.5;
742 G = 1.164 *(*a-16) - 0.813 *(*c -128) - 0.392 *(*b -128) + 0.5;
743 B = 1.164 *(*a-16) + 2.017 *(*b -128) + 0.5;
745 if (R < 0.0) R = 0.0;
746 if (G < 0.0) G = 0.0;
747 if (B < 0.0) B = 0.0;
748 if (R > 255.0) R = 255.0;
749 if (G > 255.0) G = 255.0;
750 if (B > 255.0) B = 255.0;
752 *(localRaw++) = (uint8_t)R;
753 *(localRaw++) = (uint8_t)G;
754 *(localRaw++) = (uint8_t)B;
763 /// \brief Deals with the color decoding i.e. handle:
764 /// - R, G, B planes (as opposed to RGB pixels)
765 /// - YBR (various) encodings.
766 /// - LUT[s] (or "PALETTE COLOR").
768 void PixelReadConvert::ConvertHandleColor()
770 //////////////////////////////////
771 // Deal with the color decoding i.e. handle:
772 // - R, G, B planes (as opposed to RGB pixels)
773 // - YBR (various) encodings.
774 // - LUT[s] (or "PALETTE COLOR").
776 // The classification in the color decoding schema is based on the blending
777 // of two Dicom tags values:
778 // * "Photometric Interpretation" for which we have the cases:
779 // - [Photo A] MONOCHROME[1|2] pictures,
780 // - [Photo B] RGB or YBR_FULL_422 (which acts as RGB),
781 // - [Photo C] YBR_* (with the above exception of YBR_FULL_422)
782 // - [Photo D] "PALETTE COLOR" which indicates the presence of LUT[s].
783 // * "Planar Configuration" for which we have the cases:
784 // - [Planar 0] 0 then Pixels are already RGB
785 // - [Planar 1] 1 then we have 3 planes : R, G, B,
786 // - [Planar 2] 2 then we have 1 gray Plane and 3 LUTs
788 // Now in theory, one could expect some coherence when blending the above
789 // cases. For example we should not encounter files belonging at the
790 // time to case [Planar 0] and case [Photo D].
791 // Alas, this was only theory ! Because in practice some odd (read ill
792 // formated Dicom) files (e.g. gdcmData/US-PAL-8-10x-echo.dcm) we encounter:
793 // - "Planar Configuration" = 0,
794 // - "Photometric Interpretation" = "PALETTE COLOR".
795 // Hence gdcm will use the folowing "heuristic" in order to be tolerant
796 // towards Dicom-non-conformance files:
797 // << whatever the "Planar Configuration" value might be, a
798 // "Photometric Interpretation" set to "PALETTE COLOR" forces
799 // a LUT intervention >>
801 // Now we are left with the following handling of the cases:
802 // - [Planar 0] OR [Photo A] no color decoding (since respectively
803 // Pixels are already RGB and monochrome pictures have no color :),
804 // - [Planar 1] AND [Photo B] handled with ConvertRGBPlanesToRGBPixels()
805 // - [Planar 1] AND [Photo C] handled with ConvertYcBcRPlanesToRGBPixels()
806 // - [Planar 2] OR [Photo D] requires LUT intervention.
810 // [Planar 2] OR [Photo D]: LUT intervention done outside
814 if ( PlanarConfiguration == 1 )
818 // [Planar 1] AND [Photo C] (remember YBR_FULL_422 acts as RGB)
819 ConvertYcBcRPlanesToRGBPixels();
823 // [Planar 1] AND [Photo C]
824 ConvertRGBPlanesToRGBPixels();
829 // When planarConf is 0, and RLELossless (forbidden by Dicom norm)
830 // pixels need to be RGB-fied anyway
833 ConvertRGBPlanesToRGBPixels();
835 // In *normal *case, when planarConf is 0, pixels are already in RGB
838 /// Computes the Pixels Size
839 void PixelReadConvert::ComputeRawAndRGBSizes()
841 int bitsAllocated = BitsAllocated;
842 // Number of "Bits Allocated" is fixed to 16 when it's 12, since
843 // in this case we will expand the image to 16 bits (see
844 // \ref ReadAndDecompress12BitsTo16Bits() )
845 if ( BitsAllocated == 12 )
850 RawSize = XSize * YSize * ZSize
851 * ( bitsAllocated / 8 )
855 RGBSize = 3 * RawSize;
863 /// Allocates room for RGB Pixels
864 void PixelReadConvert::AllocateRGB()
868 RGB = new uint8_t[RGBSize];
871 /// Allocates room for RAW Pixels
872 void PixelReadConvert::AllocateRaw()
876 Raw = new uint8_t[RawSize];
879 //-----------------------------------------------------------------------------
883 * @param indent Indentation string to be prepended during printing.
884 * @param os Stream to print to.
886 void PixelReadConvert::Print( std::ostream &os, std::string const &indent )
889 << "--- Pixel information -------------------------"
892 << "Pixel Data: offset " << PixelOffset
893 << " x(" << std::hex << PixelOffset << std::dec
894 << ") length " << PixelDataLength
895 << " x(" << std::hex << PixelDataLength << std::dec
902 RLEInfo->Print( os, indent );
906 gdcmWarningMacro("Set as RLE file but NO RLEinfo present.");
910 if ( IsJPEG2000 || IsJPEGLossless || IsJPEGLossy || IsJPEGLS )
914 JPEGInfo->Print( os, indent );
918 gdcmWarningMacro("Set as JPEG file but NO JPEGinfo present.");
923 //-----------------------------------------------------------------------------
924 } // end namespace gdcm
926 // NOTES on File internal calls
929 // ---> GetImageDataIntoVector
930 // |---> GetImageDataIntoVectorRaw
931 // | lut intervention
933 // ---> GetImageDataRaw
934 // ---> GetImageDataIntoVectorRaw