[Insight-users] problems while working with itk::laplacianfilter
cspl
affable at hd2 . dot . net . in
Tue, 4 Jun 2002 17:29:06 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_001C_01C20BED.53F49DD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
June,4,2002
Dear Luis,
I am SrinivaJ, I am trying to load a raw file
and apply laplacian effect on it, and get the result
in a different raw file.
And, I was getting some exceptions during the
runtime( while calling Update() method of ImageFileReader,
and Write() method of ImageFileWriter ).
I am listing my source code here,
/////////////SOURCE CODE/////////////////////
int main(int argc, char* argv[])
{
=20
itk::ImageFileReader<ImageType>::Pointer reader;
reader =3D itk::ImageFileReader<ImageType>::New();
reader->SetFileName("1.raw");
itk::RawImageIO<unsigned short,2>::Pointer io;
io =3D itk::RawImageIO<unsigned short,2>::New();
io->SetFileName ("1.raw");
io->SetFilePrefix ("*.raw");
io->ReadImageInformation();=20
reader->SetImageIO(io);
//reader->Update();
ImageType::Pointer input =3D reader->GetOutput();
=20
cout<<"Laplacian filter test"<<endl;
itk12::DiscreteGaussianImageFilter<ImageType, ImageType>::Pointer
gaussianFilter =3D itk12::DiscreteGaussianImageFilter<ImageType, =
ImageType>::New();
gaussianFilter->SetInput(input);
//gaussianFilter->Update();
itk::LaplacianImageFilter<ImageType, ImageType>::Pointer
lapFilter =3D itk::LaplacianImageFilter<ImageType, =
ImageType>::New();
lapFilter->SetInput(gaussianFilter->GetOutput());
// lapFilter->Update();
cout<<lapFilter->GetOutput();
//writing the output
itk::ImageFileWriter<ImageType>::Pointer writer;
writer =3D itk::ImageFileWriter<ImageType>::New();
writer->SetInput(lapFilter->GetOutput());
writer->SetFileName("junk2.raw");
writer->SetInput(lapFilter->GetOutput());
writer->SetImageIO(io);
writer->Write();
cout<<"Writing is completed"<<endl;
return 0;
}
/////////////END OF THE SOURCE CODE/////////////////
Appreciating your help.
Regards
Srinivas jalataru
(CSPL, Hyderabad, India)
------=_NextPart_000_001C_01C20BED.53F49DD0
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 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>June,4,2002</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Dear Luis,<BR>I am SrinivaJ, I am =
trying to load a=20
raw file<BR>and apply laplacian effect on it, and get the result<BR>in a =
different raw file.<BR>And, I was getting some exceptions during =
the<BR>runtime(=20
while calling Update() method of ImageFileReader,<BR>and Write() method =
of=20
ImageFileWriter ).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I am listing my source code =
here,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>/////////////SOURCE=20
CODE/////////////////////<BR>int main(int argc, char*=20
argv[])<BR>{<BR> <BR> =20
itk::ImageFileReader<ImageType>::Pointer reader;<BR> =
reader=20
=3D itk::ImageFileReader<ImageType>::New();<BR> =20
reader->SetFileName("1.raw");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> itk::RawImageIO<unsigned=20
short,2>::Pointer io;<BR> io =3D itk::RawImageIO<unsigned=20
short,2>::New();<BR> io->SetFileName ("1.raw");<BR> =20
io->SetFilePrefix ("*.raw");<BR> io->ReadImageInformation(); =
<BR> reader->SetImageIO(io);<BR> =20
//reader->Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> ImageType::Pointer input =3D=20
reader->GetOutput();<BR> <BR> cout<<"Laplacian =
filter=20
test"<<endl;<BR> =
itk12::DiscreteGaussianImageFilter<ImageType,=20
ImageType>::Pointer<BR> gaussianFilter =3D=20
itk12::DiscreteGaussianImageFilter<ImageType, =
ImageType>::New();<BR> =20
gaussianFilter->SetInput(input);<BR> =20
//gaussianFilter->Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =
itk::LaplacianImageFilter<ImageType,=20
ImageType>::Pointer<BR> lapFilter =3D=20
itk::LaplacianImageFilter<ImageType, ImageType>::New();<BR> =20
lapFilter->SetInput(gaussianFilter->GetOutput());<BR>// =20
lapFilter->Update();<BR> =20
cout<<lapFilter->GetOutput();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>//writing the=20
output<BR>itk::ImageFileWriter<ImageType>::Pointer =
writer;<BR> =20
writer =3D itk::ImageFileWriter<ImageType>::New();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>writer->SetInput(lapFilter->GetOutput());<BR> =20
writer->SetFileName("junk2.raw");<BR> =20
writer->SetInput(lapFilter->GetOutput());<BR> =20
writer->SetImageIO(io);<BR> =20
writer->Write();<BR> cout<<"Writing is=20
completed"<<endl;<BR> return 0;<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>/////////////END OF THE SOURCE=20
CODE/////////////////</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>Appreciating your help.</DIV>
<DIV> </DIV>
<DIV>Regards<BR>Srinivas jalataru<BR>(CSPL, Hyderabad,=20
India)<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_001C_01C20BED.53F49DD0--