[Insight-users] Sub sampling
cspl
affable@hd2.dot.net.in
Sat, 26 Apr 2003 11:14:51 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C30BE5.0E5ABDB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Luis,
I have worked on subsampling the 2d-image. But i didn't get the =
subsampled output but a part of the image with given dimensions. I am =
using "ResampleImageFilter" to resample the image. If i give the size of =
the image to the half of the original image, it is giving the left top =
half part of the image but it is not actually shrinking the image. I =
even tried with by decreasing the spacing to its half.=20
I have gone through the examples on resampleimagefilter in =
..\Examples\Filtering\ path.
My code is...
finalTransform->SetIdentity();
resample->SetTransform( finalTransform );
resample->SetInput(FixedImage);
unsigned long ss[2] =3D {pInput.width / 2, pInput.height / 2};
ImageType::SizeType Size =3D =
FixedImage->GetLargestPossibleRegion().GetSize();
Size[0] =3D ss[0];
Size[1] =3D ss[1];
resample->SetSize( Size );
resample->SetOutputOrigin( FixedImage->GetOrigin() );
double * spacing =3D new double [ Dimension ];
spacing =3D (double *)FixedImage->GetSpacing();
spacing[0] /=3D 2;=20
spacing[1] /=3D 2;
resample->SetOutputSpacing( spacing );
resample->SetInterpolator( interpolator );
resample->SetDefaultPixelValue( 0 );
resample->Update();
I am using NearestNeighbout interpolator and Centered affine =
transform.
What else i have to add to my code to subsample the image.
Please help me in this regard.
Thanks in advance.
-Regards,
Sateesh.
=20
------=_NextPart_000_000D_01C30BE5.0E5ABDB0
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>Hi Luis,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> I have worked on =
subsampling the=20
2d-image. But i didn't get the subsampled output but a part of the image =
with=20
given dimensions. I am using "ResampleImageFi</FONT><FONT face=3DArial=20
size=3D2>lter" to resample the image. If i give the size of the image to =
the half=20
of the original image, it is giving the left top half part of the image =
but it=20
is not actually shrinking the image. I even tried with by decreasing the =
spacing=20
to its half. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> I have gone through =
the examples=20
on resampleimagefilter in ..\Examples\Filtering\ path.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> My code is...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> finalTransform->SetIdentity();<BR> resample->Se=
tTransform(=20
finalTransform =
);<BR> resample->SetInput(FixedImage);<BR> unsigned=20
long ss[2] =3D {pInput.width / 2, pInput.height / =
2};<BR> ImageType::SizeType=20
Size =3D =
FixedImage->GetLargestPossibleRegion().GetSize();<BR> Size[0] =
=3D=20
ss[0];<BR> Size[1] =3D ss[1];<BR> resample->SetSize( Size=20
);<BR> resample->SetOutputOrigin( =
FixedImage->GetOrigin()=20
);<BR> double * spacing =3D new double [ Dimension =
];<BR> spacing =3D=20
(double *)FixedImage->GetSpacing();<BR> spacing[0] /=3D 2;=20
<BR> spacing[1] /=3D 2;<BR> resample->SetOutputSpacing( =
spacing=20
);<BR> resample->SetInterpolator( interpolator=20
);<BR> resample->SetDefaultPixelValue( 0=20
);<BR> resample->Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> I am using=20
NearestNeighbout interpolator and Centered affine =
transform.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> What else i have to =
add to my=20
code to subsample the image.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Please help me in =
this=20
regard.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Thanks in =
advance.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-Regards,<BR> =20
Sateesh.<BR> <BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_000D_01C30BE5.0E5ABDB0--