[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> I am still =
facing the=20
problem with SetMatrix() in AffineTransformation.My application worked =
well when=20
I set the matrix to Identity and Offset vector to zeros.But,I got =
two=20
problems in getting the output when matrix is set to other =
values.</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>I am enclosing the code =
also.Please,help me=20
regarding this.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>typedef itk::AffineTransform<double, =
3>TransformType ;<BR> typedef =
itk::ResampleImageFilter<ImageType,=20
ImageType, TransformType> ResampleFilter;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> //typedef =
ResampleFilter::TransformType =20
TransformType ;<BR> ResampleFilter::Pointer Resample =3D=20
ResampleFilter::New(); <BR> <BR> TransformType::Pointer =
transform=20
=3D Resample->GetTransform();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> typedef =
TransformType::MatrixType=20
MatrixType;<BR> typedef TransformType::OffsetType =20
VectorType; <BR> VectorType vector2 =3D=20
transform->GetOffset();<BR> MatrixType matrix2 =3D=20
transform->GetMatrix(); <BR> int i; <BR> for (i =3D 0; =
i < 3;=20
i++) { <BR> vector2[i] =3D =
0.5;<BR> }<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> </DIV><FONT face=3DArial size=3D2>
<DIV><BR> transform->SetOffset(vector2);<BR> transform->S=
etMatrix(matrix2);</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> itk::Size<3> size =3D=20
{InputVolume->height,InputVolume->width,InputVolume->depth=
};=20
<BR> Resample->SetInput(InputImage);<BR> Resample->SetSiz=
e(size);<BR> double=20
values[3];<BR> values[0]=3D1.62;<BR> values[1]=3D1.62;<BR> =
;values[2]=3D1.0;<BR> Resample->SetOutputSpacing(values);<BR>&nbs=
p;Resample->Update();</DIV>
<DIV> </DIV>
<DIV><BR>Regards,<BR>CSPL </FONT></DIV></BODY></HTML>
------=_NextPart_000_0009_01C23ECC.82A46EA0--