[Insight-users] Reading and writing 16bit grayscale images

Christoph Palm christoph.palm at web.de
Tue Feb 20 10:41:18 EST 2007


Hi Richard,

did you also adapted the OutputPixelType to unsigned int?

Regards

Christoph

On Tue, 2007-02-20 at 14:18 +0000, Sims Richard (RKB) Clinical Scientist
wrote:
> Hi
> 
>  
> 
> I am using the example code ImageReadCastWrite.cxx
> from /ITK/Examples/IO/ to read uint16 data in the form of a raw data
> file and attempting to write a uint16 dcm file. It appears to work ok
> but when I attempt to visualise the contents of the dcm file there is
> a problem with the pixel values. 
> 
>  
> 
> I edited the original example code to change the following line:
> 
>  
> 
> filter->SetOutputMaximum( 255 );
> 
>  
> 
> to:
> 
>  
> 
> filter->SetOutputMaximum( 65535 );
> 
>  
> 
> to ensure that the output is 16bit and not 8bit... but this
> unfortunately doesn't change the dcm file - it's the same size and the
> value remains as uint8.
> 
>  
> 
> If I convert the raw data file to uint8 at the very beginning, and
> leave the filter maximum at 255, the dcm file looks fine.
> 
>  
> 
> Can anyone help? Am I missing something simple?
> 
>  
> 
> Thanks in advance,
> 
> Richard.
> 
>  





More information about the Insight-users mailing list