[Insight-users] how to fill an image?

Julien Jomier jjomier@cs.unc.edu
Thu, 5 Dec 2002 13:12:20 -0500


Gwena=EBl,

You need to define the RequestedRegion too because viewers are using
this
region and not the LargestPossible one.

You can do:

m_ZeroCrossing->SetRegions( region );

wich defines the three regions at the same time.

Hope this helps.

Julien

--
Julien Jomier (919) 966-5857   Computer-Aided Diagnosis and Display Lab
julien@jomier.com              Department of Radiology, CB 7515, UNC
http://julien.jomier.com       Chapel Hill, NC 27599-7515


> -----Original Message-----
> From: insight-users-admin@public.kitware.com=20
> [mailto:insight-users-admin@public.kitware.com] On Behalf Of=20
> Gwena=EBl Guillard
> Sent: Thursday, December 05, 2002 12:41 PM
> To: insight-users@public.kitware.com
> Subject: [Insight-users] how to fill an image?
>=20
>=20
> Hi,
>=20
> I try to fill an image pixel by pixel using the SetPixel=20
> method of image class. To initialize this image I'm trying=20
> two way. The second works, but it needs to have already an=20
> image. The first doesn't work. It's taken from the=20
> itkExtractImageTest.cxx file. If I ask to print
> Image->GetLargestPossibleRegion().GetSize()[1], it gives me the right
> answer, but when I display the image: nothing except black in=20
> the image viewer, with wrong size. For the second method, I=20
> have the image I'm waiting for.
>=20
> Here is the code for the two methods:
>=20
> first method:
>   int width =3D=20
> m_Laplacian->GetOutput()->GetLargestPossibleRegion().GetSize()[0] ;
>   int height =3D=20
> m_Laplacian->GetOutput()->GetLargestPossibleRegion().GetSize()[1] ;
>   ImageType::IndexType  index =3D {{0, 0}};
>   ImageType::SizeType   size =3D {{width, height}};
>   ImageType::RegionType region;
>   region.SetSize( size );
>   region.SetIndex( index );
>   m_ZeroCrossing->SetLargestPossibleRegion( region );
>   m_ZeroCrossing->SetBufferedRegion( region );
>   m_ZeroCrossing->Allocate();
>   computation with SetPixel()
>=20
> second method:
>  m_ZeroCrossing->SetLargestPossibleRegion(
> m_Laplacian->GetOutput()->GetLargestPossibleRegion() ) ; =20
> m_ZeroCrossing->SetBufferedRegion(
> m_Laplacian->GetOutput()->GetLargestPossibleRegion() ) ; =20
> m_ZeroCrossing->SetRequestedRegion(
> m_Laplacian->GetOutput()->GetLargestPossibleRegion() ) ;
>  m_ZeroCrossing->Allocate() ;
> computation with SetPixel()
>=20
>=20
> Thanks,
>=20
> Gwenael
>=20
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com=20
> http://public.kitware.com/mailman/listinfo/ins> ight-users
>=20