From 1e1f7713e9728acb00f4fa5c254b03bfd33332d9 Mon Sep 17 00:00:00 2001 From: jpr Date: Mon, 13 Oct 2003 13:41:57 +0000 Subject: [PATCH] According to PS 3.3-2003 C.11.1.1.2 p 619, when each pixel of a PLATTE COLOR is stored on 2 Bytes, theese 2 Bytes must be equal. But there are NOT. It's fixed ! --- src/gdcmFile.cxx | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 93510477..20178169 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -449,7 +449,11 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { return lgrTotale; } int planConf=GetPlanarConfiguration(); - + + // Whatever Planar Configuration is, "PALETTE COLOR " implies that we deal with the palette. + if (str_PhotometricInterpretation == "PALETTE COLOR ") + planConf=2; + switch (planConf) { case 0: // Pixels are already RGB @@ -559,21 +563,26 @@ size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) { unsigned char * x = newDest; - int j; + int j; // See PS 3.3-2003 C.11.1.1.2 p 619 // - int mult; - if ( GetLUTNbits()==16 && nb==8) mult=2; // See PS 3.3 - else mult=1; + int mult; + if ( GetLUTNbits()==16 && nb==8) mult=2; // See PS 3.3 + else mult=1; + + // if we get a black image, let's just remove the '+1' + // and check again + // if it works, we shall have to check the 3 Palettes + // to see which byte is ==0 (first one, on second one) - for (int i=0;i