[Insight-users] Write data in PNG Format
Samuel Rodríguez Bescos
srodrigu at gbt . tfo . upm . es
Thu, 4 Jul 2002 12:04:05 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_001B_01C22352.E4B14B30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
(...)
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();
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Can anyboby tell me how can I do it or what is the problem.
Thanks,
Samuel
------=_NextPart_000_001B_01C22352.E4B14B30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2715.400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello every body,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm developing and watershed =
segmentation example=20
that can read PNG Images and write the results in PNG format. I have a =
problems=20
with writing the smoothed image, the gradinet magnitude Image and the =
final=20
Segmented image. I want to write them to disk in PNG =
format.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm using the next code for =
witing:</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20
size=3D2> =20
(...)</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20
size=3D2> type=
def =20
float &n=
bsp; &nb=
sp; =20
PixelType;</FONT></FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> =
(...)</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV>
<DIV><FONT face=3DArial size=3D2>typedef itk::Image< =
PixelType, 2=20
> ImageType;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>typedef =20
=
itk::PNGImageIO IoTy=
pe;</FONT></DIV>
<DIV> </DIV>
<DIV>(...)</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>typedef itk::ImageFileWriter<ImageType> &n=
bsp; ImageWriterType;</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>IoType::Pointer &=
nbsp; m_Io;</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>CurvatureAnisotropicDiffusionImageFilterType::Pointer  =
; m_Smoothed;</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>ImageWriterType::Pointer &nbs=
p; m_SmoothedWriter;</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>(........Executing the=20
algorithm....)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
=
m_SmoothedWriter->SetInput(m_Smoothed->GetOutput());<BR>  =
;=20
m_SmoothedWriter->SetFileName( filename );<BR> =20
m_SmoothedWriter->SetImageIO(m_Io);<BR> =20
m_SmoothedWriter->Write();</FONT></DIV></BLOCKQUOTE>
<DIV><FONT face=3DArial=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Can anyboby tell me how can I do it or =
what is the=20
problem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Samuel</FONT></DIV></BODY></HTML>
------=_NextPart_000_001B_01C22352.E4B14B30--