[Insight-users] Re: Re:Affine Transformation...

cspl affable at hd2 . dot . net . in
Thu, 8 Aug 2002 11:12:40 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C23ECC.82A46EA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Mr.Luis,
 I am still facing the problem with SetMatrix() in =
AffineTransformation.My application worked well when I set the matrix to =
Identity and  Offset vector to zeros.But,I got two problems in getting =
the output when matrix is set to other values.

1.I coud not get the output when matrix is set to other values.(other =
than identity).
2.I found that matrix is still 3x3.Because,when I tried to set values =
which I have ,I could able to set only 3x3 i.e 9 values.=20

I am enclosing the code also.Please,help me regarding this.

typedef itk::AffineTransform<double, 3>TransformType ;
 typedef itk::ResampleImageFilter<ImageType, ImageType, TransformType> =
ResampleFilter;

 //typedef ResampleFilter::TransformType  TransformType  ;
 ResampleFilter::Pointer Resample =3D ResampleFilter::New();=20
=20
 TransformType::Pointer transform =3D  Resample->GetTransform();

 typedef  TransformType::MatrixType MatrixType;
 typedef  TransformType::OffsetType  VectorType;=20
 VectorType vector2 =3D transform->GetOffset();
 MatrixType matrix2 =3D transform->GetMatrix();=20
 int i;=20
 for (i =3D 0; i < 3; i++) { =20
  vector2[i] =3D 0.5;
 }
matrix2[0][0] =3D 0.0;
matrix2[0][1] =3D 0.0;
matrix2[0][2] =3D 0.0;
matrix2[1][0] =3D 1.0;
matrix2[1][1] =3D 0.0;
matrix2[1][2] =3D 0.0;
matrix2[2][0] =3D 1.0;
matrix2[2][1] =3D 0.0;
matrix2[2][2] =3D 0.0;


 transform->SetOffset(vector2);
 transform->SetMatrix(matrix2);

 =20

 itk::Size<3> size =3D  =
{InputVolume->height,InputVolume->width,InputVolume->depth };=20
 Resample->SetInput(InputImage);
 Resample->SetSize(size);
 double values[3];
 values[0]=3D1.62;
 values[1]=3D1.62;
 values[2]=3D1.0;
 Resample->SetOutputSpacing(values);
 Resample->Update();


Regards,
CSPL=20

------=_NextPart_000_0009_01C23ECC.82A46EA0
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>Dear Mr.Luis,<BR>&nbsp;I am still =
facing the=20
problem with SetMatrix() in AffineTransformation.My application worked =
well when=20
I set the matrix to Identity and&nbsp; Offset vector to zeros.But,I got =
two=20
problems in getting the output when matrix is set to other =
values.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1.I coud not get the output when matrix =
is set to=20
other values.(other than identity).<BR>2.I found that matrix is still=20
3x3.Because,when I tried to set values which I have ,I could able to set =
only=20
3x3 i.e 9 values. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am enclosing the code =
also.Please,help me=20
regarding this.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>typedef itk::AffineTransform&lt;double, =

3&gt;TransformType ;<BR>&nbsp;typedef =
itk::ResampleImageFilter&lt;ImageType,=20
ImageType, TransformType&gt; ResampleFilter;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;//typedef =
ResampleFilter::TransformType&nbsp;=20
TransformType&nbsp; ;<BR>&nbsp;ResampleFilter::Pointer Resample =3D=20
ResampleFilter::New();&nbsp;<BR>&nbsp;<BR>&nbsp;TransformType::Pointer =
transform=20
=3D &nbsp;Resample-&gt;GetTransform();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;typedef&nbsp; =
TransformType::MatrixType=20
MatrixType;<BR>&nbsp;typedef&nbsp; TransformType::OffsetType&nbsp;=20
VectorType;&nbsp;<BR>&nbsp;VectorType vector2 =3D=20
transform-&gt;GetOffset();<BR>&nbsp;MatrixType matrix2 =3D=20
transform-&gt;GetMatrix();&nbsp;<BR>&nbsp;int i; <BR>&nbsp;for (i =3D 0; =
i &lt; 3;=20
i++) {&nbsp;&nbsp;<BR>&nbsp;&nbsp;vector2[i] =3D =
0.5;<BR>&nbsp;}<BR>matrix2[0][0]=20
=3D 0.0;<BR>matrix2[0][1] =3D 0.0;<BR>matrix2[0][2] =3D =
0.0;<BR>matrix2[1][0] =3D=20
1.0;<BR>matrix2[1][1] =3D 0.0;<BR>matrix2[1][2] =3D =
0.0;<BR>matrix2[2][0] =3D=20
1.0;<BR>matrix2[2][1] =3D 0.0;<BR>matrix2[2][2] =3D 0.0;</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
<DIV><BR>&nbsp;transform-&gt;SetOffset(vector2);<BR>&nbsp;transform-&gt;S=
etMatrix(matrix2);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;itk::Size&lt;3&gt; size =3D=20
&nbsp;{InputVolume-&gt;height,InputVolume-&gt;width,InputVolume-&gt;depth=
 };=20
<BR>&nbsp;Resample-&gt;SetInput(InputImage);<BR>&nbsp;Resample-&gt;SetSiz=
e(size);<BR>&nbsp;double=20
values[3];<BR>&nbsp;values[0]=3D1.62;<BR>&nbsp;values[1]=3D1.62;<BR>&nbsp=
;values[2]=3D1.0;<BR>&nbsp;Resample-&gt;SetOutputSpacing(values);<BR>&nbs=
p;Resample-&gt;Update();</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>Regards,<BR>CSPL&nbsp;</FONT></DIV></BODY></HTML>

------=_NextPart_000_0009_01C23ECC.82A46EA0--