Re: [ITK-users] 3D rigid transform

Dženan Zukić <[email protected]> Mon, 10 Sep 2018 09:41:58 -0400
Newsgroups gmane.comp.lib.itk.user
Message-ID <CAPf2UMT3Umnz0zFgOSA=WuHtCjFeGna2hfn12+11mO4tLXZ+Xg@mail.gmail.com>
--===============1421432004==
Content-Type: multipart/alternative; boundary="00000000000017f5fc05758486c7"

--00000000000017f5fc05758486c7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Vijaya,

can you re-post this question on the forum <https://discourse.itk.org/>? We
have migrated away from the mailing list.

Regards,
D=C5=BEenan

On Sun, Sep 9, 2018 at 3:53 PM Vijaya Ghorpade <[email protected]>
wrote:

> Hello Dzenan
> I have another question. When I do the resamplin, I don't see the output
> image, it is blank. It works for very small euler angles (assuming
> euler3dtransform takes input in radians). But for larger angles, I dont s=
ee
> any output. I have set the center to a particular pixel and index and als=
o
> the fixedparameters to it. I am pasting the script. Please let me know, I
> am sorry to ask you so many questions.
> *EulerTransformType::Pointer transform_pixel2 =3D EulerTransformType::New=
();*
> *   EulerTransformType::ParametersType transform_pixel(6);*
> *   EulerTransformType::ParametersType fixedParameters(3);*
> *   double
> centro[3]=3D{out.GetIndex()[0]*spaceorgan[0],out.GetIndex()[1]*spaceorgan=
[1],out.GetIndex()[2]*spaceorgan[2]};*
> *   transform_pixel2->SetCenter(centro);*
> *   std::cout<<"vResultUnit[0]"<<vResultUnit[0]* (180.0 / PI)<<std::endl;=
*
> *   std::cout<<"vResultUnit[1]"<<vResultUnit[1]* (180.0 / PI)<<std::endl;=
*
> *   std::cout<<"vResultUnit[2]"<<vResultUnit[2]* (180.0 / PI)<<std::endl;=
*
>
> *    transform_pixel[0]=3D(vResultUnit[0]);//* (180.0 / PI);*
> *    transform_pixel[1]=3D(vResultUnit[1]);//* (180.0 / PI);*
> *    transform_pixel[2]=3D(vResultUnit[2]);//* (180.0 / PI);*
> *    transform_pixel[3]=3D2*spaceorgan[0];*
> *    transform_pixel[4]=3D2*spaceorgan[1];*
> *    transform_pixel[5]=3D2*spaceorgan[2];*
> *    fixedParameters[0] =3D out.GetIndex()[0]*spaceorgan[0];*
> *    fixedParameters[1] =3D out.GetIndex()[1]*spaceorgan[1];*
> *    fixedParameters[2] =3D out.GetIndex()[2]*spaceorgan[2];*
> *   // std::cout<<"out.GetIndex()  "<<out.GetIndex()<<std::endl;*
>
> *    transform_pixel2->SetParameters(transform_pixel);*
> *    transform_pixel2->SetFixedParameters(fixedParameters);*
>
>  *using InterpolatorType_Image =3D
> itk::NearestNeighborInterpolateImageFunction<FixedImageType, double>;*
> *    InterpolatorType_Image::Pointer Imageinterpolator =3D
> InterpolatorType_Image::New();*
> *    ResampleImageFilterType::Pointer resample_pixelTrans =3D
> ResampleImageFilterType::New();*
> *    resample_pixelTrans->SetTransform(transform_pixel2.GetPointer());*
> *    resample_pixelTrans->SetInterpolator(Imageinterpolator);*
> *    resample_pixelTrans->SetInput(FixedImage_duplicate);*
> *
> resample_pixelTrans->SetSize(FixedImage_organ->GetLargestPossibleRegion()=
.GetSize());*
> *    resample_pixelTrans->SetOutputOrigin(FixedImage_organ->GetOrigin());=
*
> *
> resample_pixelTrans->SetOutputSpacing(FixedImage_organ->GetSpacing());*
> *
> resample_pixelTrans->SetOutputDirection(FixedImage_organ->GetDirection())=
;*
> *    resample_pixelTrans->Update();*
>
>
> -----Original Message-----
> From: D=C5=BEenan Zuki=C4=87 <[email protected]>
> To: rickfisher777 <[email protected]>
> Cc: Insight-users <[email protected]>
> Sent: Fri, Sep 7, 2018 10:10 pm
> Subject: Re: [ITK-users] 3D rigid transform
>
> Hi Vijaya,
>
> Fixed parameters are not optimized when a transform is used in image
> registration. Center of rotation is usually the fixedparameter. That is t=
he
> case with Euler
> <https://itk.org/Doxygen/html/classitk_1_1Euler3DTransform.html>, Quat
> <https://itk.org/Doxygen/html/classitk_1_1QuaternionRigidTransform.html> =
and
> Versor
> <https://itk.org/Doxygen/html/classitk_1_1VersorRigid3DTransform.html> ri=
gid
> 3D transforms. More transform types are listed here
> <https://itk.org/Doxygen/html/group__ITKTransform.html>. This example
> <https://itk.org/ITKExamples/src/Filtering/ImageGrid/ResampleAnImage/Docu=
mentation.html>,
> and this example
> <https://itk.org/Wiki/ITK/Examples/SimpleOperations/TranslationTransform>=
 might
> help you about how to set parameters and use a transform.
>
> Regards,
> D=C5=BEenan
>
> On Fri, Sep 7, 2018 at 7:30 AM Vijaya Ghorpade via Insight-users <
> [email protected]> wrote:
>
> Hi
> Before asking this question I searched the whole archive. I am new here.
> I would like to resample an MRI image after applying 3D rigid transform
> (Rotation followed by translation). I found euler3dtransform and
> quaternion3d. The documentation is not suffice to see how to use it
> completely. What are parameters and fixed parameters. How to give suppose
> three angles a, b, c and 3 transtalations x ,y, z to these functions.
> Please help me.
> Thank you so much in advance,
> The ITK community is transitioning from this mailing list to
> discourse.itk.org. Please join us there!
> ________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> https://itk.org/mailman/listinfo/insight-users
>
>

--00000000000017f5fc05758486c7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:verdana,=
sans-serif;font-size:small">Hi Vijaya,</div><div class=3D"gmail_default" st=
yle=3D"font-family:verdana,sans-serif;font-size:small"><br></div><div class=
=3D"gmail_default" style=3D"font-family:verdana,sans-serif;font-size:small"=
>can you re-post this question on the <a href=3D"https://discourse.itk.org/=
" target=3D"_blank">forum</a>? We have migrated away from the mailing list.=
</div><div class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;=
font-size:small"><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:verdana,sans-serif;font-size:small">Regards,</div><div class=3D"gmail_def=
ault" style=3D"font-family:verdana,sans-serif;font-size:small">D=C5=BEenan<=
/div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Sun, Sep 9, 2=
018 at 3:53 PM Vijaya Ghorpade &lt;<a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex"><font color=3D"" size=3D"2" face=3D"Helvetica Neue">He=
llo<font face=3D"Arial, Helvetica, sans-serif">=C2=A0Dzenan</font>
<div><font face=3D"Arial, Helvetica, sans-serif">I have another question. W=
hen I do the resamplin, I don&#39;t see the output image, it is blank. It w=
orks for very small euler angles (assuming euler3dtransform takes input in =
radians). But for larger angles, I dont see any output. I have set the cent=
er to a particular pixel and index and also the fixedparameters to it. I am=
 pasting the script. Please let me know, I am sorry to ask you so many ques=
tions.</font></div>

<div><font face=3D"Arial, Helvetica, sans-serif">
<div><b style=3D"background-color:yellow">EulerTransformType::Pointer trans=
form_pixel2 =3D EulerTransformType::New();</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0EulerTransformType::=
ParametersType transform_pixel(6);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0EulerTransformType::=
ParametersType fixedParameters(3);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0double centro[3]=3D{=
out.GetIndex()[0]*spaceorgan[0],out.GetIndex()[1]*spaceorgan[1],out.GetInde=
x()[2]*spaceorgan[2]};</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0transform_pixel2-&gt=
;SetCenter(centro);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0std::cout&lt;&lt;&qu=
ot;vResultUnit[0]&quot;&lt;&lt;vResultUnit[0]* (180.0 / PI)&lt;&lt;std::end=
l;</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0std::cout&lt;&lt;&qu=
ot;vResultUnit[1]&quot;&lt;&lt;vResultUnit[1]* (180.0 / PI)&lt;&lt;std::end=
l;</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0std::cout&lt;&lt;&qu=
ot;vResultUnit[2]&quot;&lt;&lt;vResultUnit[2]* (180.0 / PI)&lt;&lt;std::end=
l;</b></div>

<div><b style=3D"background-color:yellow"><br>
</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[0]=3D(vResultUnit[0]);//* (180.0 /=
 PI);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[1]=3D(vResultUnit[1]);//* (180.0 /=
 PI);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[2]=3D(vResultUnit[2]);//* (180.0 /=
 PI);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[3]=3D2*spaceorgan[0];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[4]=3D2*spaceorgan[1];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>transform_pixel[5]=3D2*spaceorgan[2];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0<span style=3D"white=
-space:pre-wrap">	</span>fixedParameters[0] =3D out.GetIndex()[0]*spaceorga=
n[0];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0 fixedParameters[1] =
=3D out.GetIndex()[1]*spaceorgan[1];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0 fixedParameters[2] =
=3D out.GetIndex()[2]*spaceorgan[2];</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0// std::cout&lt;&lt;=
&quot;out.GetIndex()=C2=A0 &quot;&lt;&lt;out.GetIndex()&lt;&lt;std::endl;</=
b></div>

<div><b style=3D"background-color:yellow"><br>
</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0 transform_pixel2-&g=
t;SetParameters(transform_pixel);</b></div>

<div><b style=3D"background-color:yellow">=C2=A0 =C2=A0 transform_pixel2-&g=
t;SetFixedParameters(fixedParameters);</b></div>

<div><br>
</div>

<div>
<div><span style=3D"background-color:lightcoral">=C2=A0<b>using Interpolato=
rType_Image =3D itk::NearestNeighborInterpolateImageFunction&lt;FixedImageT=
ype, double&gt;;</b></span></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 InterpolatorTyp=
e_Image::Pointer Imageinterpolator =3D InterpolatorType_Image::New();</b></=
div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 ResampleImageFi=
lterType::Pointer resample_pixelTrans =3D ResampleImageFilterType::New();</=
b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetTransform(transform_pixel2.GetPointer());</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetInterpolator(Imageinterpolator);</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetInput(FixedImage_duplicate);</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetSize(FixedImage_organ-&gt;GetLargestPossibleRegion().GetSize())=
;</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetOutputOrigin(FixedImage_organ-&gt;GetOrigin());</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetOutputSpacing(FixedImage_organ-&gt;GetSpacing());</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;SetOutputDirection(FixedImage_organ-&gt;GetDirection());</b></div>

<div><b style=3D"background-color:lightcoral">=C2=A0 =C2=A0 resample_pixelT=
rans-&gt;Update();</b></div>
</div>
</font><br>
<br>

<div style=3D"font-family:arial,helvetica;font-size:10pt;color:black">
<div class=3D"m_6282998391414434631m_2249451320699395155aolmail_wmstd_quote=
">
<div>-----Original Message-----<br>
From: D=C5=BEenan Zuki=C4=87 &lt;<a href=3D"mailto:[email protected]" targe=
t=3D"_blank">[email protected]</a>&gt;<br>
To: rickfisher777 &lt;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&gt;<br>
Cc: Insight-users &lt;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&gt;<br>
Sent: Fri, Sep 7, 2018 10:10 pm<br>
Subject: Re: [ITK-users] 3D rigid transform<br>
<br>

<div id=3D"m_6282998391414434631m_2249451320699395155yiv3907615148">
<div>
<div dir=3D"ltr">
<div dir=3D"ltr">
<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small">Hi Vijaya=
,</div>

<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small"><br clear=
=3D"none"></div>

<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small">Fixed par=
ameters are not optimized when a transform is used in image registration. C=
enter of rotation is usually the fixedparameter. That is the case with <a r=
el=3D"noopener noreferrer" shape=3D"rect" href=3D"https://itk.org/Doxygen/h=
tml/classitk_1_1Euler3DTransform.html" target=3D"_blank">Euler</a>, <a rel=
=3D"noopener noreferrer" shape=3D"rect" href=3D"https://itk.org/Doxygen/htm=
l/classitk_1_1QuaternionRigidTransform.html" target=3D"_blank">Quat</a>=C2=
=A0and <a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"https://itk.or=
g/Doxygen/html/classitk_1_1VersorRigid3DTransform.html" target=3D"_blank">V=
ersor</a>=C2=A0rigid 3D transforms. More transform types are listed <a rel=
=3D"noopener noreferrer" shape=3D"rect" href=3D"https://itk.org/Doxygen/htm=
l/group__ITKTransform.html" target=3D"_blank">here</a>. This=C2=A0<a rel=3D=
"noopener noreferrer" shape=3D"rect" href=3D"https://itk.org/ITKExamples/sr=
c/Filtering/ImageGrid/ResampleAnImage/Documentation.html" target=3D"_blank"=
>example</a>, and this <a rel=3D"noopener noreferrer" shape=3D"rect" href=
=3D"https://itk.org/Wiki/ITK/Examples/SimpleOperations/TranslationTransform=
" target=3D"_blank">example</a>=C2=A0might help you about how to set parame=
ters and use a transform.</div>

<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small"><br clear=
=3D"none"></div>

<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small">Regards,<=
/div>

<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
default" style=3D"font-family:verdana,sans-serif;font-size:small">D=C5=BEen=
an</div>
</div>
</div>
<br clear=3D"none">
<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148gmail_=
quote">
<div class=3D"m_6282998391414434631m_2249451320699395155yiv3907615148yqt627=
0554914" id=3D"m_6282998391414434631m_2249451320699395155yiv3907615148yqtfd=
64632">
<div dir=3D"ltr">On Fri, Sep 7, 2018 at 7:30 AM Vijaya Ghorpade via Insight=
-users &lt;<a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"mailto:ins=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:<=
br clear=3D"none"></div>
<blockquote class=3D"m_6282998391414434631m_2249451320699395155yiv390761514=
8gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding=
-left:1ex"><font color=3D"" size=3D"2" face=3D"Helvetica Neue"><font face=
=3D"Arial, Helvetica, sans-serif">Hi</font>
</font>
<div><font face=3D"Arial, Helvetica, sans-serif">Before asking this questio=
n I searched the whole archive. I am new here.=C2=A0 I would like to resamp=
le an MRI image after applying 3D rigid transform (Rotation followed by tra=
nslation). I found euler3dtransform and quaternion3d. The documentation is =
not suffice to see how to use it completely. What are parameters and fixed =
parameters. How to give suppose three angles a, b, c and 3 transtalations x=
 ,y, z to these functions. Please help me.=C2=A0</font></div>



<div><font face=3D"Arial, Helvetica, sans-serif">Thank you so much in advan=
ce,</font></div>

The ITK community is transitioning from this mailing list to <a rel=3D"noop=
ener noreferrer" shape=3D"rect" href=3D"http://discourse.itk.org" target=3D=
"_blank">discourse.itk.org</a>. Please join us there!<br clear=3D"none">
________________________________<br clear=3D"none">
Powered by <a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"http://www=
.kitware.com" target=3D"_blank">www.kitware.com</a><br clear=3D"none">
<br clear=3D"none">
Visit other Kitware open-source projects at<br clear=3D"none">
<a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"http://www.kitware.co=
m/opensource/opensource.html" target=3D"_blank">http://www.kitware.com/open=
source/opensource.html</a><br clear=3D"none">
<br clear=3D"none">
Kitware offers ITK Training Courses, for more information visit:<br clear=
=3D"none">
<a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"http://www.kitware.co=
m/products/protraining.php" target=3D"_blank">http://www.kitware.com/produc=
ts/protraining.php</a><br clear=3D"none">
<br clear=3D"none">
Please keep messages on-topic and check the ITK FAQ at:<br clear=3D"none">
<a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"http://www.itk.org/Wi=
ki/ITK_FAQ" target=3D"_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br clear=
=3D"none">
<br clear=3D"none">
Follow this link to subscribe/unsubscribe:<br clear=3D"none">
<a rel=3D"noopener noreferrer" shape=3D"rect" href=3D"https://itk.org/mailm=
an/listinfo/insight-users" target=3D"_blank">https://itk.org/mailman/listin=
fo/insight-users</a><br clear=3D"none">
</blockquote></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</font></blockquote></div>

--00000000000017f5fc05758486c7--

--===============1421432004==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users

--===============1421432004==--