[Insight-users] writing a png file

Mathieu Malaterre Mathieu . Malaterre at creatis . insa-lyon . fr
Wed, 25 Jun 2003 16:41:18 +0200


Gwen,
	Are you sure the value are in a range from 0 to 255 ?
	If not use RescaleIntensityImageFilter:

http://www . itk . org/Doxygen/html/classitk_1_1RescaleIntensityImageFilter . html

	There is also ShiftScaleImageFilter
HTH
mathieu

gwenael . guillard at enst-bretagne . fr wrote:
> Hi ITK users,
> 
> I'm trying to write a png file from an image. It's writing a file with the 
> right number of rows and columns but empty, ie black. Here is the code I'm 
> using. DId I forget smthg? The imageViewer part is to be sure the image isn't 
> black (and it is not)
> 
> 
> 	PNGType::Pointer imageIO = PNGType::New();
> 	
> 	ImageWriterType::Pointer writer = ImageWriterType::New();
> 	writer->SetImageIO( imageIO );
> 	writer->SetFileName( baseFilename );
>  
> 
> 	writer->SetInput( m_Output ); // m_Output is the image to write
> 	writer->Write();
> 
> 	ImageViewerType::Pointer imageViewer = ImageViewerType::New();
> 	imageViewer->SetLabel("Output Image");
> 	imageViewer->SetImage( m_Output );
> 	imageViewer->Show();
> 
> 
> Thank you for your help,
> 
> Gwen
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
> 


-- 
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www . creatis . insa-lyon . fr/~malaterre/