+// PIXELCONVERT CLEANME
+ // Restore the header in a disk-consistent state
+ // (if user asks twice to get the pixels from disk)
+ if ( PixelRead != -1 ) // File was "read" before
+ {
+ RestoreInitialValues();
+ }
+ if ( PixelConverter->GetRGB() )
+ {
+ // now, it's an RGB image
+ // Lets's write it in the Header
+ std::string spp = "3"; // Samples Per Pixel
+ HeaderInternal->SetEntryByNumber(spp,0x0028,0x0002);
+ std::string rgb = "RGB "; // Photometric Interpretation
+ HeaderInternal->SetEntryByNumber(rgb,0x0028,0x0004);
+ std::string planConfig = "0"; // Planar Configuration
+ HeaderInternal->SetEntryByNumber(planConfig,0x0028,0x0006);
+ PixelRead = 0; // no PixelRaw
+ }
+ else
+ {
+ if ( HeaderInternal->HasLUT() )
+ {
+ // The LUT interpretation failed
+ std::string photometricInterpretation = "MONOCHROME1 ";
+ HeaderInternal->SetEntryByNumber( photometricInterpretation,
+ 0x0028, 0x0004 );
+ PixelRead = 0; // no PixelRaw
+ }
+ else
+ {
+ if ( PixelConverter->IsDecompressedRGB() )
+ {
+ ///////////////////////////////////////////////////
+ // now, it's an RGB image
+ // Lets's write it in the Header
+ // Droping Palette Color out of the Header
+ // has been moved to the Write process.
+ // TODO : move 'values' modification to the write process
+ // : save also (in order to be able to restore)
+ // : 'high bit' -when not equal to 'bits stored' + 1
+ // : 'bits allocated', when it's equal to 12 ?!
+ std::string spp = "3"; // Samples Per Pixel
+ std::string photInt = "RGB "; // Photometric Interpretation
+ std::string planConfig = "0"; // Planar Configuration
+ HeaderInternal->SetEntryByNumber(spp,0x0028,0x0002);
+ HeaderInternal->SetEntryByNumber(photInt,0x0028,0x0004);
+ HeaderInternal->SetEntryByNumber(planConfig,0x0028,0x0006);
+ }
+ PixelRead = 1; // PixelRaw
+ }
+ }