<font size="2"><font face="verdana,sans-serif">Hi David,<br></font></font><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">with this I try to do what you suggested, i.e. consider VTK&#39;s world coordinate system as </font><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">DICOM patient coordinate system:</span></div>

<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><div>//red is the transformation-related code</div><div>void MainWindow::updateVisualization()</div>

<div>{</div><div>    typedef itk::ImageToVTKImageFilter&lt;VisualizingImageType&gt; itkVtkConverter;</div><div>    itkVtkConverter::Pointer conv=itkVtkConverter::New();</div><div>    conv-&gt;SetInput(logic-&gt;visualizing);</div>

<div><br></div><div>    vtkGPUVolumeRayCastMapper *mapper = vtkGPUVolumeRayCastMapper::New();</div><div>    mapper-&gt;SetInput(conv-&gt;GetOutput());</div><div><br></div><div>    if (volume)</div><div>        volume-&gt;Delete();</div>

<div>    volume=vtkVolume::New();</div><div>    volume-&gt;SetProperty( myTransferFunction );</div><div>    volume-&gt;SetMapper( mapper );</div><div>    mapper-&gt;SetBlendModeToComposite();</div><div><br></div><div><font class="Apple-style-span" color="#ff0000">    VisualizingImageType::DirectionType d=logic-&gt;visualizing-&gt;GetDirection();</font></div>

<div><font class="Apple-style-span" color="#ff0000">    vtkMatrix4x4 *mat=vtkMatrix4x4::New();</font></div><div><font class="Apple-style-span" color="#ff0000">    for (int i=0; i&lt;3; i++)</font></div><div><font class="Apple-style-span" color="#ff0000">        for (int k=0; k&lt;3; k++)</font></div>

<div><font class="Apple-style-span" color="#ff0000">            mat-&gt;SetElement(i,k, d(i,k));</font></div><div><font class="Apple-style-span" color="#ff0000">    mat-&gt;SetElement(3,3, 1);</font></div><div><font class="Apple-style-span" color="#ff0000">    VisualizingImageType::SpacingType sp = logic-&gt;visualizing-&gt;GetSpacing();</font></div>

<div><font class="Apple-style-span" color="#ff0000">    VisualizingImageType::PointType origin=logic-&gt;visualizing-&gt;GetOrigin();</font></div><div><font class="Apple-style-span" color="#ff0000">    for (int i=0; i&lt;3; i++)</font></div>

<div><font class="Apple-style-span" color="#ff0000">        mat-&gt;SetElement(i,3, origin[i]/sp[i]);</font></div><div><font class="Apple-style-span" color="#ff0000">    volume-&gt;SetUserMatrix(mat); //orientation and size OK, position wrong</font></div>

<div><br></div><div>    vtkRenderer *renderer = vis-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer();</div><div>    renderer-&gt;RemoveAllViewProps();</div><div>    renderer-&gt;AddVolume( volume );    </div>

<div>    defaultCameraPos(); //centers view on the volume, looking at it from left    </div><div>    vis-&gt;GetRenderWindow()-&gt;Render();</div><div>    vis-&gt;GetRenderWindow()-&gt;GetRenderers()-&gt;GetFirstRenderer()-&gt;ResetCamera();</div>

<div>}</div></font></div></div><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">The polygonal data is in </font><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">DICOM&#39;s patient coordinate system (vertex positions from itk::Image-&gt;TransformIndexToPhysicalPoint() etc). The orientation is correct, but</span><span class="Apple-style-span" style="font-family: verdana, sans-serif; "> I can&#39;t get the position correctly. I have tried -origin[i]/sp[i], </span><span class="Apple-style-span" style="font-family: verdana, sans-serif; ">origin[i]*sp[i], origin[i], -origin[i], -2*origin[i] and similar combinations but none of them worked. Any suggestion to what am I doing wrong?</span></div>

<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">Regards,</font></div><div><font class="Apple-style-span" face="verdana, sans-serif">Dženan</font></div>

<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font><div class="gmail_quote">2011/6/29 David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Jun 28, 2011 at 9:40 AM, Dženan Zukić &lt;<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>&gt; wrote:<br>
&gt; Hi David,<br>
&gt;<br>
&gt; I am interested in this too:<br>
</div><div class="im">&gt; Does the above approach affect the polygonal actors in the scene (segmented<br>
&gt; parts of the image)?<br>
&gt; Regards,<br>
&gt; Dženan<br>
<br>
</div>When the DICOM patient coordinate system is used as the VTK world<br>
coordinate system, the assumption is that everything (images AND<br>
polydata) would have a either already be in the patient coordinate<br>
system, or if not, you would to have a 4x4 transform to set as the<br>
actor&#39;s UserMatrix (or UserTransform).  I.e. a transform to bring the<br>
data from its original coordinate system into the patient coordinate<br>
system.<br>
<font color="#888888"><br>
 - David<br>
</font></blockquote></div><br></div>