-void PixelReadConvert::GrabInformationsFromHeader( Header *header )
-{
- // Number of Bits Allocated for storing a Pixel is defaulted to 16
- // when absent from the header.
- BitsAllocated = header->GetBitsAllocated();
- if ( BitsAllocated == 0 )
- {
- BitsAllocated = 16;
- }
-
- // Number of "Bits Stored" defaulted to number of "Bits Allocated"
- // when absent from the header.
- BitsStored = header->GetBitsStored();
- if ( BitsStored == 0 )
- {
- BitsStored = BitsAllocated;
- }
-
- // High Bit Position
- HighBitPosition = header->GetHighBitPosition();
- if ( HighBitPosition == 0 )
- {
- HighBitPosition = BitsAllocated - 1;
- }
-
- XSize = header->GetXSize();
- YSize = header->GetYSize();
- ZSize = header->GetZSize();
- SamplesPerPixel = header->GetSamplesPerPixel();
- PixelSize = header->GetPixelSize();
- PixelSign = header->IsSignedPixelData();
- SwapCode = header->GetSwapCode();
- std::string ts = header->GetTransferSyntax();
- IsRaw =
- ( ! header->IsDicomV3() )
- || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian
- || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndianDLXGE
- || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian
- || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian
- || Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::DeflatedExplicitVRLittleEndian;
- IsJPEG2000 = Global::GetTS()->IsJPEG2000(ts);
- IsJPEGLossless = Global::GetTS()->IsJPEGLossless(ts);
- IsRLELossless = Global::GetTS()->IsRLELossless(ts);
- PixelOffset = header->GetPixelOffset();
- PixelDataLength = header->GetPixelAreaLength();
- RLEInfo = header->GetRLEInfo();
- JPEGInfo = header->GetJPEGInfo();
-
- PlanarConfiguration = header->GetPlanarConfiguration();
- IsMonochrome = header->IsMonochrome();
- IsPaletteColor = header->IsPaletteColor();
- IsYBRFull = header->IsYBRFull();
-
- /////////////////////////////////////////////////////////////////
- // LUT section:
- HasLUT = header->HasLUT();
- if ( HasLUT )
- {
- // Just in case some access to a Header element requires disk access.
- LutRedDescriptor = header->GetEntry( 0x0028, 0x1101 );
- LutGreenDescriptor = header->GetEntry( 0x0028, 0x1102 );
- LutBlueDescriptor = header->GetEntry( 0x0028, 0x1103 );
-
- // Depending on the value of Document::MAX_SIZE_LOAD_ELEMENT_VALUE
- // [ refer to invocation of Document::SetMaxSizeLoadEntry() in
- // Document::Document() ], the loading of the value (content) of a
- // [Bin|Val]Entry occurence migth have been hindered (read simply NOT
- // loaded). Hence, we first try to obtain the LUTs data from the header
- // and when this fails we read the LUTs data directely from disk.
- /// \TODO Reading a [Bin|Val]Entry directly from disk is a kludge.
- /// We should NOT bypass the [Bin|Val]Entry class. Instead
- /// an access to an UNLOADED content of a [Bin|Val]Entry occurence
- /// (e.g. BinEntry::GetBinArea()) should force disk access from
- /// within the [Bin|Val]Entry class itself. The only problem
- /// is that the [Bin|Val]Entry is unaware of the FILE* is was
- /// parsed from. Fix that. FIXME.
-
- ////// Red round
- header->LoadEntryBinArea(0x0028, 0x1201);
- LutRedData = (uint8_t*)header->GetEntryBinArea( 0x0028, 0x1201 );
- if ( ! LutRedData )
- {
- gdcmVerboseMacro( "Unable to read Red LUT data" );
- }
-
- ////// Green round:
- header->LoadEntryBinArea(0x0028, 0x1202);
- LutGreenData = (uint8_t*)header->GetEntryBinArea(0x0028, 0x1202 );
- if ( ! LutGreenData)
- {
- gdcmVerboseMacro( "Unable to read Green LUT data" );
- }
-
- ////// Blue round:
- header->LoadEntryBinArea(0x0028, 0x1203);
- LutBlueData = (uint8_t*)header->GetEntryBinArea( 0x0028, 0x1203 );
- if ( ! LutBlueData )
- {
- gdcmVerboseMacro( "Unable to read Blue LUT data" );
- }
- }
-
- ComputeRawAndRGBSizes();
-}
-
-/**
- * \brief Build Red/Green/Blue/Alpha LUT from Header
- * when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
- * and (0028,1101),(0028,1102),(0028,1102)
- * - xxx Palette Color Lookup Table Descriptor - are found
- * and (0028,1201),(0028,1202),(0028,1202)
- * - xxx Palette Color Lookup Table Data - are found
- * \warning does NOT deal with :
- * 0028 1100 Gray Lookup Table Descriptor (Retired)
- * 0028 1221 Segmented Red Palette Color Lookup Table Data
- * 0028 1222 Segmented Green Palette Color Lookup Table Data
- * 0028 1223 Segmented Blue Palette Color Lookup Table Data
- * no known Dicom reader deals with them :-(
- * @return a RGBA Lookup Table
- */
-void PixelReadConvert::BuildLUTRGBA()