<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi all,<br><br>I'm extracting slices from a DICOM dataset and writing on disk. The aproach are following:<br>- Load using vtkDICOMImageReader;<br>- Extract slices using vtkImageReslice.<br>- Write using vtkPNGImageWriter<br><br>-- CODE:<br> m_Reslicer-&gt;SetInput(m_ImageData);<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;SetInterpolationModeToLinear();<br>
&nbsp;&nbsp;&nbsp; double minSpacing = fabs(spacing[0]);<br>
&nbsp;&nbsp;&nbsp; if (fabs(spacing[1]) &lt; minSpacing)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; minSpacing = fabs(spacing[1]);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; if (fabs(spacing[2]) &lt; minSpacing)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; minSpacing = fabs(spacing[2]);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;SetOutputSpacing(minSpacing, minSpacing, minSpacing);<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;GetOutput()-&gt;UpdateInformation();<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;SetOutputDimensionality(2);<br>
&nbsp; &nbsp;&nbsp;&nbsp; m_Reslicer-&gt;SetResliceAxes(m_Matrix);<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;GetOutput()-&gt;UpdateInformation();<br>
&nbsp;&nbsp;&nbsp; double point[4];<br>
&nbsp;&nbsp;&nbsp; double temp[4];<br>
&nbsp;&nbsp;&nbsp; point[0] = 0.0;<br>
&nbsp;&nbsp;&nbsp; point[1] = 0.0;<br>
&nbsp;&nbsp;&nbsp; switch(m_Axy)<br>

&nbsp;&nbsp;&nbsp; {<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case VolumeRepresentation::Coronal:<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; point[2] = m_Reslicer-&gt;GetOutput()-&gt;GetSpacing()[0] * 0.5 // what's are the factor?;<br>

&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case VolumeRepresentation::Saggital:<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; point[2] = m_Reslicer-&gt;GetOutput()-&gt;GetSpacing()[1] * 0.5 // what's are the factor?;<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case VolumeRepresentation::Transversal:<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; point[2] = m_Reslicer-&gt;GetOutput()-&gt;GetSpacing()[2];<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>

&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; vtkMatrix4x4 *matrix = m_Reslicer-&gt;GetResliceAxes();<br>
&nbsp;&nbsp;&nbsp; point[3] = 1.0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrix-&gt;MultiplyPoint(point, temp);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrix-&gt;SetElement(0, 3, temp[0]);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrix-&gt;SetElement(1, 3, temp[1]);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrix-&gt;SetElement(2, 3, temp[2]);<br>
&nbsp;&nbsp;&nbsp; m_Reslicer-&gt;Update();<br>
&nbsp;&nbsp;&nbsp; m_Slice-&gt;DeepCopy(m_Reslicer-&gt;GetOutput());<br>
&nbsp;&nbsp;&nbsp; return m_Slice;<br><br><br>When I extract slices from the transversal axis, all are extracted ok, but when I extract from coronal and sagittal axis, a lot of slices are empty. After some playing, I was discovered that's my error are these lines:<br><br>&nbsp;&nbsp;&nbsp; point[2] = m_Reslicer-&gt;GetOutput()-&gt;GetSpacing()[];<br><br>Then I was multiplied, when extracting coronal or sagittal slices, like showed in the code.<br>Works fine! No empty slices anymore! But, the factor are fixed, and I don't know how to calculate the factor 0.5. <br>I'm completely wrong? Someone can help?<br><br>Thks in advance,<br><br>Wagner Sales<br><br><br><br>&nbsp;&nbsp; <br></div></div><br>__________________________________________________<br>Fale com seus amigos  de graça com o novo Yahoo! Messenger <br>http://br.messenger.yahoo.com/ </body></html>