X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FgdcmPixelReadConvert.cxx;h=c54287df626a4a6d147dbb79c7c3941cbf6af291;hb=df832cf7f90b4ca5aca2f628c1756fb276779fac;hp=a236282066cf064baeb5ae379d7aaac880e542eb;hpb=6cfef0bc2e3ab5ba9c4665f8d985d79089daae27;p=gdcm.git diff --git a/src/gdcmPixelReadConvert.cxx b/src/gdcmPixelReadConvert.cxx index a2362820..c54287df 100644 --- a/src/gdcmPixelReadConvert.cxx +++ b/src/gdcmPixelReadConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelReadConvert.cxx,v $ Language: C++ - Date: $Date: 2007/10/03 09:35:27 $ - Version: $Revision: 1.125 $ + Date: $Date: 2007/10/26 16:06:57 $ + Version: $Revision: 1.127 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -45,7 +45,7 @@ bool gdcm_read_JPEG2000_file (void* raw, //----------------------------------------------------------------------------- // Constructor / Destructor /// Constructor -PixelReadConvert::PixelReadConvert() +PixelReadConvert::PixelReadConvert() { RGB = 0; RGBSize = 0; @@ -144,10 +144,10 @@ void PixelReadConvert::GrabInformationsFromFile( File *file, while (true) // shorter to write than 'if elseif elseif elseif' ... { // mind the order : check the most usual first. - if( IsRaw = Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian) break; - if( IsRaw = Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian ) break; - if( IsRaw = Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian) break; - if( IsRaw = Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRBigEndianPrivateGE) break; + if( IsRaw = (Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRLittleEndian)) break; + if( IsRaw = (Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRLittleEndian)) break; + if( IsRaw = (Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian)) break; + if( IsRaw = (Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ImplicitVRBigEndianPrivateGE)) break; // DeflatedExplicitVRLittleEndian syntax means the whole Dataset (Header + Pixels) is compressed ! // Not dealt with ! (Parser hangs) //if( IsRaw = Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::DeflatedExplicitVRLittleEndian) break; @@ -165,13 +165,14 @@ void PixelReadConvert::GrabInformationsFromFile( File *file, while(true) { // mind the order : check the most usual first. - if( IsJPEGLossy = Global::GetTS()->IsJPEGLossy(ts) ) break; - if( IsJPEGLossless = Global::GetTS()->IsJPEGLossless(ts) ) break; - if( IsRLELossless = Global::GetTS()->IsRLELossless(ts) ) break; - if( IsJPEG2000 = Global::GetTS()->IsJPEG2000(ts) ) break; - if( IsMPEG = Global::GetTS()->IsMPEG(ts) ) break; - if( IsJPEGLS = Global::GetTS()->IsJPEGLS(ts) ) break; - // DeflatedExplicitVRLittleEndian is considered as 'Unexpected' (we don't know yet how to process !) + if( IsJPEGLossy = (Global::GetTS()->IsJPEGLossy(ts))) break; + if( IsJPEGLossless = (Global::GetTS()->IsJPEGLossless(ts))) break; + if( IsRLELossless = (Global::GetTS()->IsRLELossless(ts))) break; + if( IsJPEG2000 = (Global::GetTS()->IsJPEG2000(ts))) break; + if( IsMPEG = (Global::GetTS()->IsMPEG(ts))) break; + if( IsJPEGLS = (Global::GetTS()->IsJPEGLS(ts))) break; + // DeflatedExplicitVRLittleEndian is considered as 'Unexpected' + // (we don't know yet how to process !) gdcmWarningMacro("Unexpected Transfer Syntax :[" << ts << "]"); break; } @@ -195,7 +196,43 @@ void PixelReadConvert::GrabInformationsFromFile( File *file, HasLUT = file->HasLUT(); if ( HasLUT ) { - // Just in case some access to a File element requires disk access. +/* + C.7.6.3.1.5 + The three values of Palette Color Lookup Table Descriptor (0028,1101-1103) + describe the format of the Lookup Table Data in the corresponding + Data Element (0028,1201-1203) or (0028,1221-1223). + + The first value is the number of entries in the lookup table. + When the number of table entries is equal to 2**16 then this value shall be 0. + + The second value is the first stored pixel value mapped. + This pixel value is mapped to the first entry in the Lookup Table Data. + All image pixel values less than the first entry value mapped are also + mapped to the first entry in the Lookup Table Data. + An image pixel value one greater than the first entry value mapped is + mapped to the second entry in the Lookup Table Data. + Subsequent image pixel values are mapped to the subsequent entries in + the Lookup Table Data up to an image pixel value equal to number of + entries + first entry value mapped - 1 which is mapped to the last entry + in the Lookup Table Data. + Image pixel values greater than or equal to number of entries + first entry + value mapped are also mapped to the last entry in the Lookup Table Data. + + The third value specifies the number of bits for each entry in the Lookup + Table Data. It shall take the value of 8 or 16. + The LUT Data shall be stored in a format equivalent to 8 or 16 bits + allocated where the high bit is equal to bits allocated-1. + + When the Palette Color Lookup Table Descriptor (0028,1101-1103) are used as + part of the Palette Color Lookup Table Module, the third value shall be + equal to 16. + + Note: A value of 16 indicates the Lookup Table Data will range from (0,0,0) + minimum intensity to (65535,65535,65535) maximum intensity. + +*/ + + // Just in case some access to a File element requires disk access. LutRedDescriptor = file->GetEntryString( 0x0028, 0x1101 ); LutGreenDescriptor = file->GetEntryString( 0x0028, 0x1102 ); LutBlueDescriptor = file->GetEntryString( 0x0028, 0x1103 ); @@ -884,7 +921,7 @@ void PixelReadConvert::BuildLUTRGBA() *a16 = 1; // Alpha component a16 += 4; } -/* Just to 'see' the LUT, at debug time +// Just to 'see' the LUT, at debug time // Don't remove this commented out code. a16=(uint16_t*)LutRGBA; @@ -894,7 +931,7 @@ void PixelReadConvert::BuildLUTRGBA() << *(a16+2) << " " << *(a16+3) << std::endl; a16+=4; } -*/ + } }