[Insight-users] Query on Resampling

Lydia Ng lng@insightful.com
Mon, 11 Nov 2002 09:47:35 -0800


This is a multi-part message in MIME format.

------_=_NextPart_001_01C289AA.6AFFFE44
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

CSPL,
=20
Your code snippet looks ok - you might need to post more
of your code to see if everything is setup correctly.
I wonder if it is a templating issue?
Are you using the ITK registration components?=20
Have you set the transform and interpolation template parameter
of the ResampleImageFilter to the appropriate classes?
=20
-Lydia

-----Original Message-----
From: cspl [mailto:affable@hd2.dot.net.in]
Sent: Sunday, November 10, 2002 8:39 PM
To: insight-users@public.kitware.com
Subject: [Insight-users] Query on Resampling


Dear Friends,

 I have some doubts regarding Resample image filter.After=20
=20
registring fixed and moving volumes, I applied registration output =
matrix on=20
=20
Moving volume.Output volume is not as expected.In some other tool,I=20
=20
have applied the same matrix on same moving volume.Output volume is=20
=20
totally different from resample output.Can u please tell what component=20
=20
is missing in resampling.I am enclosing the resample code. =20
=20
Please click on this url to see the pictures=20
=20
http://www.cspl.org/registration.jpg
=20
//code
ResampleFilter::Pointer resampleFilter =3D ResampleFilter::New(); =20
=20
 transform =3D TransformType::New();
 interpolator=3DInterpolatorType::New();
 TransformType::ParametersType=20
=20
params(transform->GetNumberOfParameters()) ;
=20
 for (int pi=3D0;pi<12;pi++)
 {
    params[pi] =3D result[pi];
   =20
 }
=20
=20


 UCharImage::Pointer outImage  =3D NULL; =20
 =20
 transform->SetParameters( params);
=20

    resampleFilter->SetInput(movingImage );   =20
 resampleFilter ->SetTransform(transform.GetPointer());
 resampleFilter ->SetInterpolator(interpolator.GetPointer());=20
    resampleFilter->SetSize(=20
=20
fixedImage->GetLargestPossibleRegion().GetSize());
    resampleFilter->SetOutputOrigin( fixedImage->GetOrigin() );
    resampleFilter->SetOutputSpacing( fixedImage->GetSpacing() );
=20

 try
 {
  resampleFilter->Update();
=20
 }catch(itk::ExceptionObject &Eo){
=20
  AfxMessageBox(Eo.GetDescription());
 }
=20
 outImage   =3D resampleFilter->GetOutput();
=20

Regards,
CSPL=20



------_=_NextPart_001_01C289AA.6AFFFE44
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=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 5.50.4919.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D494524517-11112002>CSPL,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D494524517-11112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>Your=20
code snippet looks ok - you might need to post more</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>of=20
your code to see if everything is setup correctly.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>I=20
wonder if it is a templating issue?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>Are=20
you using the ITK registration components? </SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>Have=20
you set the transform and interpolation template =
parameter</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D494524517-11112002>of the=20
ResampleImageFilter to the appropriate classes?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D494524517-11112002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D494524517-11112002>-Lydia</SPAN></FONT></DIV></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> cspl=20
  [mailto:affable@hd2.dot.net.in]<BR><B>Sent:</B> Sunday, November 10, =
2002 8:39=20
  PM<BR><B>To:</B> insight-users@public.kitware.com<BR><B>Subject:</B>=20
  [Insight-users] Query on Resampling<BR><BR></FONT></DIV>
  <DIV>
  <DIV><FONT face=3DArial size=3D2>Dear Friends,</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><BR>&nbsp;I have some doubts =
regarding Resample=20
  image filter.After </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>registring fixed and moving volumes, =
I applied=20
  registration output matrix on </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Moving volume.Output volume is not as =
expected.In=20
  some other tool,I </FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>have applied the same matrix on same =
moving=20
  volume.Output volume is </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>totally different from resample =
output.Can u=20
  please tell what component </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>is missing in resampling.I am =
enclosing the=20
  resample code.&nbsp; </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Please click on this url to see the =
pictures=20
  </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><A=20
  =
href=3D"http://www.cspl.org/registration.jpg">http://www.cspl.org/registr=
ation.jpg</A></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>//code<BR>ResampleFilter::Pointer =
resampleFilter=20
  =3D ResampleFilter::New();&nbsp;&nbsp;</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;transform =3D=20
  =
TransformType::New();<BR>&nbsp;interpolator=3DInterpolatorType::New();<BR=
>&nbsp;TransformType::ParametersType=20
  </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial =
size=3D2>params(transform-&gt;GetNumberOfParameters())=20
  ;<BR>&nbsp;<BR>&nbsp;for (int=20
  pi=3D0;pi&lt;12;pi++)<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp; params[pi] =3D=20
  result[pi];<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;}<BR>&nbsp;</FONT></DIV>
  <DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
  <DIV><BR>&nbsp;UCharImage::Pointer outImage&nbsp; =3D=20
  =
NULL;&nbsp;&nbsp;<BR>&nbsp;&nbsp;<BR>&nbsp;transform-&gt;SetParameters(=20
  params);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>&nbsp;&nbsp;&nbsp; resampleFilter-&gt;SetInput(movingImage=20
  );&nbsp;&nbsp;&nbsp; <BR>&nbsp;resampleFilter=20
  -&gt;SetTransform(transform.GetPointer());<BR>&nbsp;resampleFilter=20
  -&gt;SetInterpolator(interpolator.GetPointer()); =
<BR>&nbsp;&nbsp;&nbsp;=20
  resampleFilter-&gt;SetSize( </DIV>
  <DIV>&nbsp;</DIV>
  =
<DIV>fixedImage-&gt;GetLargestPossibleRegion().GetSize());<BR>&nbsp;&nbsp=
;&nbsp;=20
  resampleFilter-&gt;SetOutputOrigin( fixedImage-&gt;GetOrigin()=20
  );<BR>&nbsp;&nbsp;&nbsp; resampleFilter-&gt;SetOutputSpacing(=20
  fixedImage-&gt;GetSpacing() );</DIV>
  <DIV>&nbsp;</DIV>
  =
<DIV><BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp;resampleFilter-&gt;Update();=
</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;}catch(itk::ExceptionObject &amp;Eo){</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;AfxMessageBox(Eo.GetDescription());<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;outImage&nbsp;&nbsp; =3D =
resampleFilter-&gt;GetOutput();</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>Regards,<BR>CSPL =
<BR></FONT></DIV></DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C289AA.6AFFFE44--