From: jpr Date: Mon, 13 Oct 2003 13:41:57 +0000 (+0000) Subject: According to PS 3.3-2003 C.11.1.1.2 p 619, when each pixel of a PLATTE COLOR X-Git-Tag: Version0.3.1~107 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;ds=sidebyside;h=1e1f7713e9728acb00f4fa5c254b03bfd33332d9;p=gdcm.git 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 ! --- 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