<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=DE link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Emma,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>You are right; the two
files contain the same deformation field in 2D and 3D, respectively. But if you
want to open the vector field in ParaView you need 3D because ParaView can only
handle 3D vector fields.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Please have a look at ITK
software guide &#8220;8.15.1 Visualizing 2D deformation fields&#8221; on page
470 for further informations.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Best wishes,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Daniel<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>Von:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
insight-users-bounces+d.stein=dkfz-heidelberg.de@itk.org
[mailto:insight-users-bounces+d.stein=dkfz-heidelberg.de@itk.org] <b><span
style='font-weight:bold'>Im Auftrag von </span></b>Emma Ryan<br>
<b><span style='font-weight:bold'>Gesendet:</span></b> Donnerstag, 2. August
2007 22:20<br>
<b><span style='font-weight:bold'>An:</span></b> Luis Ibanez<br>
<b><span style='font-weight:bold'>Cc:</span></b> insight-users@itk.org<br>
<b><span style='font-weight:bold'>Betreff:</span></b> [Insight-users] (no
subject)</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Hi,<br>
<br>
&nbsp;Could anyone tell me the difference between the following two sections of
code ? As far as my understanding goes, the first segment of code writes out
the deformation field to a file such &quot;field.vtk&quot;.&nbsp; The second
segment also writes out the vector (after converting 2D information to 3D)
representative of the deformation field to another file, which could be called
&quot;vectorImage.vtk&quot; <br>
<br>
Are the two files not the same ?<br>
<br>
The code segments are taken from the deformableRegistration2.cxx.&nbsp; (Demons
Registration). The ITK software guide does not describe the reason for the
second segment.<br>
<br>
<br>
Thank you in advance.<br>
Emma<br>
Segment 1<br>
<br>
&nbsp; if( argc &gt; 4 ) // if a fourth line argument has been provided...<br>
&nbsp;&nbsp;&nbsp; {<br>
<br>
&nbsp; &nbsp;&nbsp;&nbsp; typedef itk::ImageFileWriter&lt; DeformationFieldType
&gt; FieldWriterType;<br>
&nbsp;&nbsp;&nbsp; &nbsp; FieldWriterType::Pointer fieldWriter =
FieldWriterType::New();<br>
&nbsp;&nbsp;&nbsp; &nbsp; fieldWriter-&gt;SetFileName( argv[4] );<br>
&nbsp;&nbsp;&nbsp; &nbsp; fieldWriter-&gt;SetInput( filter-&gt;GetOutput() );<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; fieldWriter-&gt;Update();<br>
&nbsp;&nbsp; }<br>
<br>
<br>
<br>
<br>
Segment 2<br>
<br>
&nbsp; if( argc &gt; 5 ) <br>
&nbsp;&nbsp;&nbsp; {<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef DeformationFieldType&nbsp; VectorImage2DType;<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef DeformationFieldType::PixelType Vector2DType;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage2DType::ConstPointer vectorImage2D =
filter-&gt;GetOutput();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage2DType::RegionType&nbsp; region2D =
vectorImage2D-&gt;GetBufferedRegion();<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage2DType::IndexType&nbsp;&nbsp;
index2D&nbsp; = region2D.GetIndex();<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage2DType::SizeType&nbsp;&nbsp;&nbsp;
size2D&nbsp;&nbsp; = region2D.GetSize(); <br>
<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef itk::Vector&lt;
float,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 &gt;&nbsp; Vector3DType;<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef itk::Image&lt; Vector3DType, 3 &gt;&nbsp;
VectorImage3DType;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef itk::ImageFileWriter&lt; VectorImage3DType
&gt; WriterType;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; WriterType::Pointer writer3D = WriterType::New();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage3DType::Pointer vectorImage3D =
VectorImage3DType::New();<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage3DType::RegionType&nbsp; region3D;<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage3DType::IndexType&nbsp;&nbsp; index3D;<br>
&nbsp;&nbsp;&nbsp; &nbsp; VectorImage3DType::SizeType&nbsp;&nbsp;&nbsp; size3D;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; index3D[0] = index2D[0];<br>
&nbsp;&nbsp;&nbsp; &nbsp; index3D[1] = index2D[1];<br>
&nbsp;&nbsp;&nbsp; &nbsp; index3D[2] = 0;<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp; size3D[0]&nbsp; = size2D[0];<br>
&nbsp;&nbsp;&nbsp; &nbsp; size3D[1]&nbsp; = size2D[1];<br>
&nbsp;&nbsp;&nbsp; &nbsp; size3D[2]&nbsp; = 1;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; region3D.SetSize( size3D );<br>
&nbsp;&nbsp;&nbsp; &nbsp; region3D.SetIndex( index3D );<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; vectorImage3D-&gt;SetRegions( region3D );<br>
&nbsp;&nbsp;&nbsp; &nbsp; vectorImage3D-&gt;Allocate();<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef itk::ImageRegionConstIterator&lt;
VectorImage2DType &gt; Iterator2DType;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; typedef itk::ImageRegionIterator&lt;
VectorImage3DType &gt; Iterator3DType;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; Iterator2DType&nbsp; it2( vectorImage2D, region2D );<br>
&nbsp;&nbsp;&nbsp; &nbsp; Iterator3DType&nbsp; it3( vectorImage3D, region3D );<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; it2.GoToBegin();<br>
&nbsp;&nbsp;&nbsp; &nbsp; it3.GoToBegin();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; Vector2DType vector2D;<br>
&nbsp;&nbsp;&nbsp; &nbsp; Vector3DType vector3D;<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; vector3D[2] = 0; // set Z component to zero.<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; while( !it2.IsAtEnd() )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; vector2D = it2.Get();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vector3D[0] =
vector2D[0];&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vector3D[1] =
vector2D[1];&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; it3.Set( vector3D );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; ++it2;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; ++it3;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
<br>
&nbsp; &nbsp;&nbsp;&nbsp; writer3D-&gt;SetInput( vectorImage3D );<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; writer3D-&gt;SetFileName( argv[5] );<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; try<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; writer3D-&gt;Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp; catch( itk::ExceptionObject &amp; excp )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; std::cerr &lt;&lt; excp
&lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
}<br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=1 width="100%" align=center>

</span></font></div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Fussy? Opinionated? Impossible to please? Perfect. <a
href="http://us.rd.yahoo.com/evt=48516/*http:/surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7%20">Join
Yahoo!'s user panel</a> and lay it on us. <o:p></o:p></span></font></p>

</div>

</body>

</html>