[Insight-users] Why MultiResolutionPyramidImageFilter does not produce right image?

Lydia Ng lng at insightful . com
Wed, 19 Nov 2003 09:25:54 -0800


Hi Fucang,

I think the filter requires the output pixel type to be floating point. =
Could
you try it out as an experiment?

- Lydia

> -----Original Message-----
> From: Fucang Jia [mailto:jiafucang at hotmail . com]
> Sent: Wednesday, November 19, 2003 1:17 AM
> To: insight-users at itk . org
> Subject: [Insight-users] Why MultiResolutionPyramidImageFilter does =
not
> produce right image?
>=20
> Hi, everyone,
>=20
> I am using ITK 1.4 and want to do some experiments based on
> MultiResolutionPyramid. But the following program does not give =
correct
> images. It does produce 8 images, but the first level image is all =
zeros.
> So
> the error spreads to the next level images. Is there some error in =
this
> program?
>=20
> Thanks a lot!
>=20
> Fucang
>=20
>=20
> =
=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
> int main(int argc, char *argv[] )
> {
>=20
>=20
>   if(argc<2)
>   {
>    std::cerr<<argv[0]<<" Input2DImage"<<std::endl;
>    return -1;
>   }
>=20
>   typedef unsigned short PixelType;
>   const unsigned short Dimension =3D 2;
>=20
>   typedef itk::Image<PixelType,Dimension>       InputImageType;
>   typedef itk::Image<PixelType,Dimension>       OutputImageType;
>   typedef itk::ImageFileReader<InputImageType>  ReaderType;
>   typedef itk::ImageFileWriter<OutputImageType> WriterType;
>   typedef
> itk::MultiResolutionPyramidImageFilter<InputImageType,OutputImageType>
>     PyramidType;
>   ReaderType::Pointer  reader  =3D ReaderType::New();
>   WriterType::Pointer  writer  =3D WriterType::New();
>   PyramidType::Pointer pyramid =3D PyramidType::New();
>=20
>=20
>   reader->SetFileName(argv[1]);
>   reader->Update();
>=20
>   pyramid->SetInput( reader->GetOutput() );
>=20
>   unsigned int numLevels;
>   itk::Vector<unsigned int,Dimension> factors;
>=20
>   numLevels =3D 8;
>   factors[0] =3D 256; factors[1] =3D 256;
>=20
>   pyramid->SetNumberOfLevels( numLevels );
>   pyramid->SetStartingShrinkFactors( 256 );
>   pyramid->Print( std::cout );
>=20
>   pyramid->Update();
>=20
>   for (int i=3D0;i<numLevels;i++)
>   {
>    char str[4096];
>    sprintf(str,"test_%d.png",i);
>    writer->SetFileName(str);
>    writer->SetInput(pyramid->GetOutput(i));
>    writer->Update();
>   }
>=20
>   return 0;
> }
>=20
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join . msn . com/?page=FEatures/junkmail
>=20
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users