+ // Probabely the same stuff is to be done for 16 Bits Pixels
+ // with 65536 entries LUT ?!?
+ // Still looking for accurate info on the web :-(
+
+ gdcmWarningMacro( "Sorry Palette Color Lookup Tables not yet dealt with"
+ << " for 16 Bits Per Pixel images" );
+
+ // forge the 4 * 16 Bits Red/Green/Blue/Alpha LUT
+
+ LutRGBA = (uint8_t *)new uint16_t[ 65536*4 ]; // 2^16 * 4 (R, G, B, Alpha)
+ if ( !LutRGBA )
+ return;
+ memset( LutRGBA, 0, 65536*4*2 ); // 16 bits = 2 bytes ;-)
+
+ LutItemNumber = 65536;
+ LutItemSize = 16;
+
+ int i;
+ uint16_t *a16;
+
+ //take "Subscript of the first Lut Value" (debR,debG,debB) into account!
+
+ a16 = (uint16_t*)LutRGBA + 0 + debR;
+ for( i=0; i < lengthR; ++i )
+ {
+ *a16 = ((uint16_t*)LutRedData)[i];
+ a16 += 4;
+ }
+
+ a16 = (uint16_t*)LutRGBA + 1 + debG;
+ for( i=0; i < lengthG; ++i)
+ {
+ *a16 = ((uint16_t*)LutGreenData)[i];
+ a16 += 4;
+ }
+
+ a16 = (uint16_t*)LutRGBA + 2 + debB;
+ for(i=0; i < lengthB; ++i)
+ {
+ *a16 = ((uint16_t*)LutBlueData)[i];
+ a16 += 4;
+ }
+
+ a16 = (uint16_t*)LutRGBA + 3 ;
+ for(i=0; i < 65536; ++i)
+ {
+ *a16 = 1; // Alpha component
+ a16 += 4;
+ }
+/* Just to 'see' the LUT, at debug time
+
+ a16=(uint16_t*)LutRGBA;
+ for (int j=0;j<65536;j++)
+ {
+ std::cout << *a16 << " " << *(a16+1) << " "
+ << *(a16+2) << " " << *(a16+3) << std::endl;
+ a16+=4;
+ }
+*/