[Insight-users] On ReSampleImageFilter ...

cspl affable at hd2 . dot . net . in
Tue, 6 Aug 2002 11:15:45 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0084_01C23D3A.9C081C90
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Friends,
 I am having 4X4 matrix(output of some other function),I want to apply =
this on Image/Volume.I used the class ResampleImagefilter available in =
ITK to do this task.I found that AffineTranformation is the default =
Transformation type it takes.
In the AffineTranformation class I found one method SetMatrix();As I =
want to transform a volume (3D) image I tried to set 4X4 matrix for the =
setMatrix() function.But,It is accepting only 3X3 matrix.Plese give me =
suggestions in doing my task.I am enclosing the code and error also.=20

//code

   typedef itk::Matrix<double,4,4> matrixdef;
   matrixdef  mat; =20
   ImageType::Pointer InputImage=3DNULL;//ImageType::New();
   InputImage=3DBufferToImage(pIctal);
   typedef itk::ResampleImageFilter<ImageType,ImageType>    =
ResampleFilter;
   ResampleFilter::Pointer Resample=3DResampleFilter::New();
   typedef itk::AffineTransform<double,3> AffineDef;
   AffineDef::Pointer Affine=3DAffineDef::New();
   Affine->SetMatrix(mat);  //mat is  the matrix of 4X4
=20
    Resample->SetTransform(Affine);
    itk::Size<3> size =3D {pIctal->height,pIctal->width,pIctal->depth }; =

    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();

 //error

e:\ipservercspl9\ipserverdoc.cpp(996) : error C2664: 'SetMatrix' : =
cannot convert parameter 1 from 'class itk::Matrix<double,4,4>' to =
'const class itk::Matrix<double,3,3> &'
        Reason: cannot convert from 'class itk::Matrix<double,4,4>' to =
'const class itk::Matrix<double,3,3>'
        No constructor could take the source type, or constructor =
overload resolution was ambiguous
Error executing cl.exe.

Regards,
CSPL

------=_NextPart_000_0084_01C23D3A.9C081C90
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 Friends,<BR>&nbsp;I am having 4X4=20
matrix(output of some other function),I want to apply this on =
Image/Volume.I=20
used the class ResampleImagefilter available in ITK to do this task.I =
found that=20
AffineTranformation is the default Transformation type it takes.<BR>In =
the=20
AffineTranformation class I found one method SetMatrix();As I want to =
transform=20
a volume (3D) image I tried to set 4X4 matrix for the setMatrix()=20
function.But,It is accepting only 3X3 matrix.Plese give me suggestions =
in doing=20
my task.I am enclosing the code and error also. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//code</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; typedef =
itk::Matrix&lt;double,4,4&gt;=20
matrixdef;<BR>&nbsp;&nbsp; matrixdef&nbsp; mat;&nbsp; <BR>&nbsp;&nbsp;=20
ImageType::Pointer InputImage=3DNULL;//ImageType::New();<BR>&nbsp;&nbsp; =

InputImage=3DBufferToImage(pIctal);<BR>&nbsp;&nbsp; typedef=20
itk::ResampleImageFilter&lt;ImageType,ImageType&gt;&nbsp;&nbsp;&nbsp;=20
ResampleFilter;<BR>&nbsp;&nbsp; ResampleFilter::Pointer=20
Resample=3DResampleFilter::New();<BR>&nbsp;&nbsp; typedef=20
itk::AffineTransform&lt;double,3&gt; AffineDef;<BR>&nbsp;&nbsp;=20
AffineDef::Pointer Affine=3DAffineDef::New();<BR>&nbsp;&nbsp;=20
Affine-&gt;SetMatrix(mat);&nbsp; //mat is&nbsp; the matrix of=20
4X4<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;=20
Resample-&gt;SetTransform(Affine);<BR>&nbsp;&nbsp;&nbsp; =
itk::Size&lt;3&gt; size=20
=3D {pIctal-&gt;height,pIctal-&gt;width,pIctal-&gt;depth }; =
<BR>&nbsp;&nbsp;&nbsp;=20
Resample-&gt;SetInput(InputImage);<BR>&nbsp;&nbsp;&nbsp;=20
Resample-&gt;SetSize(size);<BR>&nbsp;&nbsp;&nbsp; double=20
values[3];<BR>&nbsp;&nbsp;&nbsp; values[0]=3D1.62;<BR>&nbsp;&nbsp;&nbsp; =

values[1]=3D1.62;<BR>&nbsp;&nbsp;&nbsp; =
values[2]=3D1.0;<BR>&nbsp;&nbsp;&nbsp;=20
Resample-&gt;SetOutputSpacing(values);<BR>&nbsp;&nbsp;&nbsp;=20
Resample-&gt;Update();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;//error</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>e:\ipservercspl9\ipserverdoc.cpp(996) : =
error=20
C2664: 'SetMatrix' : cannot convert parameter 1 from 'class=20
itk::Matrix&lt;double,4,4&gt;' to 'const class =
itk::Matrix&lt;double,3,3&gt;=20
&amp;'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reason: cannot =
convert from=20
'class itk::Matrix&lt;double,4,4&gt;' to 'const class=20
itk::Matrix&lt;double,3,3&gt;'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; No=20
constructor could take the source type, or constructor overload =
resolution was=20
ambiguous<BR>Error executing cl.exe.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>Regards,<BR>CSPL</FONT></DIV></BODY></HTML>

------=_NextPart_000_0084_01C23D3A.9C081C90--