<div dir="ltr">Thank you bu I just did that and I still get GetWholeZMax() returning 0...<br><br><div class="gmail_quote">2008/9/24 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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Talita,<br>
<br>
When reslice-&gt;SetOutputDimensionality(2) is used, the output of<br>
vtkImageReslice contains only one slice. &nbsp;That is why GetWholeZMax()<br>
is returning zero.<br>
<br>
To just change the axes without doing anything else to the image, use<br>
SetOutputDimensionality(3) and do not set the &quot;center&quot; in the<br>
resliceAxes.<br>
<br>
 &nbsp; &nbsp;David<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
On Tue, Sep 23, 2008 at 10:16 PM, Talita Perciano<br>
&lt;<a href="mailto:talitaperciano@gmail.com">talitaperciano@gmail.com</a>&gt; wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I&#39;m trying to read DICOM image slices and to view them with a<br>
&gt; vtkImageViewer. The thing is that I want to change the axis before I view<br>
&gt; the slices, that is, if the slices are in axial direction I want to change<br>
&gt; it to coronal direction. I&#39;m doing that using the a vtkImageReslice. The<br>
&gt; thing is that when I pass the DICOM reader directly to the vtkImageViewer<br>
&gt; things work fine. However, when I use first the vtkImageReslice and than<br>
&gt; pass it to the vtkImageViewer I can&#39;t view the slices anymore. It&#39;s strange<br>
&gt; because when I call GetWholeZMax it returns 0. Does anybody could help me?<br>
&gt; The code is attached.<br>
&gt;<br>
&gt; Thank you,<br>
&gt;<br>
&gt; Talita<br>
&gt;<br>
&gt; -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; std::string strFolderPath = &quot;/home/talita/Desktop/COMUNIX/Neck<br>
&gt; 1HEAD_NECK_PETCT/CT HEAD-NK 5.0 B30s&quot;;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; reader-&gt;SetDirectoryName (strFolderPath.c_str());<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; reader-&gt;Update();<br>
&gt;<br>
&gt; &nbsp; &nbsp; reader-&gt;SetDataScalarTypeToUnsignedShort();<br>
&gt; &nbsp; &nbsp; &nbsp; reader-&gt;UpdateWholeExtent();<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Calculate the center of the volume<br>
&gt; &nbsp; &nbsp; &nbsp; reader-&gt;GetOutput()-&gt;UpdateInformation();<br>
&gt; &nbsp; &nbsp; &nbsp; int extent[6];<br>
&gt; &nbsp; &nbsp; &nbsp; double spacing[3];<br>
&gt; &nbsp; &nbsp; &nbsp; double origin[3];<br>
&gt; &nbsp; &nbsp; &nbsp; reader-&gt;GetOutput()-&gt;GetWholeExtent(extent);<br>
&gt; &nbsp; &nbsp; &nbsp; reader-&gt;GetOutput()-&gt;GetSpacing(spacing);<br>
&gt; &nbsp; &nbsp; &nbsp; reader-&gt;GetOutput()-&gt;GetOrigin(origin);<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; double center[3];<br>
&gt; &nbsp; &nbsp; &nbsp; center[0] = origin[0] + spacing[0] * 0.5 * (extent[0] + extent[1]);<br>
&gt; &nbsp; &nbsp; &nbsp; center[1] = origin[1] + spacing[1] * 0.5 * (extent[2] + extent[3]);<br>
&gt; &nbsp; &nbsp; &nbsp; center[2] = origin[2] + spacing[2] * 0.5 * (extent[4] + extent[5]);<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Matrices for axial, coronal, sagittal, oblique view orientations<br>
&gt; &nbsp; &nbsp; &nbsp; static double axialElements[16] = {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1, 0, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 1, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0, 1, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0, 0, 1 };<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; static double coronalElements[16] = {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1, 0, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0, 1, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0,-1, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0, 0, 1 };<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; static double sagittalElements[16] = {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0,-1, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1, 0, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0,-1, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0, 0, 0, 1 };<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; //static double obliqueElements[16] = {<br>
&gt; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp; &nbsp; &nbsp; 1, 0, 0, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp; &nbsp; &nbsp; 0, 0.866025, -0.5, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp; &nbsp; &nbsp; 0, 0.5, 0.866025, 0,<br>
&gt; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp; &nbsp; &nbsp; 0, 0, 0, 1 };<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Set the slice orientation<br>
&gt; &nbsp; &nbsp; &nbsp; vtkMatrix4x4 *resliceAxes = vtkMatrix4x4::New();<br>
&gt; &nbsp; &nbsp; &nbsp; resliceAxes-&gt;DeepCopy(coronalElements);<br>
&gt; &nbsp; &nbsp; &nbsp; // Set the point through which to slice<br>
&gt; &nbsp; &nbsp; &nbsp; resliceAxes-&gt;SetElement(0, 3, center[0]);<br>
&gt; &nbsp; &nbsp; &nbsp; resliceAxes-&gt;SetElement(1, 3, center[1]);<br>
&gt; &nbsp; &nbsp; &nbsp; resliceAxes-&gt;SetElement(2, 3, center[2]);<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Extract a slice in the desired orientation<br>
&gt; &nbsp; &nbsp; &nbsp; vtkImageReslice *reslice = vtkImageReslice::New();<br>
&gt; &nbsp; &nbsp; &nbsp; reslice-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>
&gt; &nbsp; &nbsp; &nbsp; reslice-&gt;SetOutputDimensionality(2);<br>
&gt; &nbsp; &nbsp; &nbsp; reslice-&gt;SetResliceAxes(resliceAxes);<br>
&gt; &nbsp; &nbsp; &nbsp; //reslice-&gt;SetInterpolationModeToNearestNeighbor();<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Create a greyscale lookup table<br>
&gt; &nbsp; &nbsp; &nbsp; vtkLookupTable *table = vtkLookupTable::New();<br>
&gt; &nbsp; &nbsp; &nbsp; table-&gt;SetRange(0, 2000); // image intensity range<br>
&gt; &nbsp; &nbsp; &nbsp; table-&gt;SetValueRange(0.0, 1.0); // from black to white<br>
&gt; &nbsp; &nbsp; &nbsp; table-&gt;SetSaturationRange(0.0, 0.0); // no color saturation<br>
&gt; &nbsp; &nbsp; &nbsp; table-&gt;SetRampToLinear();<br>
&gt; &nbsp; &nbsp; &nbsp; table-&gt;Build();<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; // Map the image through the lookup table<br>
&gt; &nbsp; &nbsp; &nbsp; vtkImageMapToColors *color = vtkImageMapToColors::New();<br>
&gt; &nbsp; &nbsp; &nbsp; color-&gt;SetLookupTable(table);<br>
&gt; &nbsp; &nbsp; &nbsp; color-&gt;SetInputConnection(reslice-&gt;GetOutputPort());<br>
&gt;<br>
&gt; &nbsp; &nbsp; vtkImageViewer *viewer = vtkImageViewer::New();<br>
&gt;<br>
&gt; &nbsp; &nbsp; viewer-&gt;SetInput(color-&gt;GetOutput());<br>
&gt; &nbsp; &nbsp; printf(&quot;\n%d\n&quot;,viewer-&gt;GetWholeZMax());<br>
&gt; &nbsp; &nbsp; viewer-&gt;SetZSlice(35);<br>
&gt; &nbsp; &nbsp; viewer-&gt;SetColorWindow(2000);<br>
&gt; &nbsp; &nbsp; viewer-&gt;SetColorLevel(1000);<br>
&gt; &nbsp; &nbsp; viewer-&gt;Render();<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; This is the private VTK discussion list.<br>
&gt; Please keep messages on-topic. Check the FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br><br clear="all"><br>-- <br>Talita Perciano<br>Instituto de Matemática e Estatísitca<br>Universidade de São Paulo - USP<br>Doutoranda em Ciência da Computação<br>São Paulo, SP, Brasil<br>Tel: +55 11 8826 7092<br>
<br>&quot;Success is not final, failure is not fatal: it is the courage to continue that counts.&quot; <br>(Winston Churchill)<br>
</div>