[Insight-users] Write data in PNG Format
Samuel Rodríguez Bescos
srodrigu at gbt . tfo . upm . es
Mon, 8 Jul 2002 13:38:20 +0200
Hello again,
Sorry but there isn't the ItkRescaleIntensityImageFilter module in my ITK
workspace. I Think that it isn't in the Beta release. Is it?. If It isn't.
How Can I get it?.
Thanks a lot,
Samuel
----- Original Message -----
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: "Samuel Rodríguez Bescos" <srodrigu@gbt.tfo.upm.es>
Cc: <insight-users@public.kitware.com>
Sent: Monday, July 08, 2002 7:47 AM
Subject: Re: [Insight-users] Write data in PNG Format
> Hi Samuel,
>
> I'm assuming that you succeded to write the images but they don't
> look right: is this what you observe ?
>
> If that's the case, one possible cause is that the PNG writers require
> images to be of PixelType "unsigned short". Your images are probably
> of PixelType "float", so you may want to rescale the scale of gray levels,
> in particular for the gradient image since it should have positive and
> negative values that cannot be represented by "unsigned short".
>
> You can use the filter :
>
>
http://public.kitware.com/Insight/Doxygen/html/classitk_1_1RescaleIntensityI
mageFilter.html
>
> in order to map:
>
> {min,max } of the float image to { 0, 65535 } (unsigned short) prior to
> saving the image.
>
> and use the Calculator:
>
>
http://public.kitware.com/Insight/Doxygen/html/classitk_1_1MinimumMaximumIma
geCalculator.html
>
> to get the min and max of the gray levels in the float image
>
>
>
> Luis
>
>
> =================================
>
> Samuel Rodríguez Bescos wrote:
>
> > Hello every body,
> >
> >
> >
> > I'm developing and watershed segmentation example that can read PNG
> > Images and write the results in PNG format. I have a problems with
> > writing the smoothed image, the gradinet magnitude Image and the final
> > Segmented image. I want to write them to disk in PNG format.
> >
> >
> >
> > I'm using the next code for witing:
> >
> > ==========================================================
> >
> > (...)
> >
> > typedef float PixelType;
> >
> > (...)
> >
> > typedef itk::Image< PixelType, 2 > ImageType;
> >
> > typedef itk::PNGImageIO IoType;
> >
> >
> >
> > (...)
> >
> >
> >
> > typedef itk::ImageFileWriter<ImageType> ImageWriterType;
> >
> > IoType::Pointer m_Io;
> >
> > CurvatureAnisotropicDiffusionImageFilterType::Pointer m_Smoothed;
> >
> > ImageWriterType::Pointer m_SmoothedWriter;
> >
> >
> >
> > (........Executing the algorithm....)
> >
> >
> >
> > m_SmoothedWriter->SetInput(m_Smoothed->GetOutput());
> > m_SmoothedWriter->SetFileName( filename );
> > m_SmoothedWriter->SetImageIO(m_Io);
> > m_SmoothedWriter->Write();
> >
> > ===============================================================
> >
> >
> >
> > Can anyboby tell me how can I do it or what is the problem.
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Samuel
> >
>
>