[Dcmlib] Bug in writing RGB images

Jean-Pierre Roux Jean-Pierre.Roux at creatis.insa-lyon.fr
Tue Mar 21 09:53:05 CET 2006


Mathieu Malaterre wrote:

> If one do:
>
> file->SetWriteModeToRGB()
> then call
> file->Write( filename )
>
> the file will be refused to be written (function will return false).
>
> Fix:
> Explicitely set the Sample Per Pixel to be 3.
>
> header->InsertValEntry("3",0x0028,0x0002); // Samples per Pixel


In order to free user from such details, I modified 
gdcm::FileHelper:SetWriteMode() method as follow :
   void SetWriteMode(FileMode mode)   {
      WriteMode = mode;
      // Deal with Samples per Pixel   
      if (mode == WMODE_RGB) 
FileInternal->InsertValEntry("3",0x0028,0x0002);
   }
(was previously :
void SetWriteMode(FileMode mode)   { WriteMode = mode; }

JP

>
> HTH,
> Mathieu
> _______________________________________________
> Dcmlib mailing list
> Dcmlib at creatis.insa-lyon.fr
> http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
>




More information about the Dcmlib mailing list