<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<BR>&nbsp;<BR>

&gt; From: david.gobbi@gmail.com<BR>&gt; Date: Wed, 27 Oct 2010 10:41:16 -0600<BR>&gt; Subject: Re: [vtkusers] some questions about example Imagereslicing.cxx<BR>&gt; To: juanxiaoyan@hotmail.com<BR>&gt; CC: vtkusers@vtk.org<BR>&gt; <BR>&gt; 2010/10/26 ÏþÑå öÁÏþÑå &lt;juanxiaoyan@hotmail.com&gt;:<BR>&gt; &gt; i find the value of SetDataSpacing is not used when read the 2D CT images<BR>&gt; &gt; using vtkImageReader2, but i want to read 2D CT images as 3D according to<BR>&gt; &gt; value of SetDataSpacing in order to extract a interpolated slice in desired<BR>&gt; &gt; orientation. i wonder it can be implemented? i will appreciate any answer<BR>&gt; &gt; from you. thank you.<BR>&gt; &gt;<BR>&gt; &gt; some program of the example is as follows:<BR>&gt; &gt; vtkImageReader2 *reader = vtkImageReader2::New();<BR>&gt; &gt; reader-&gt;SetFilePrefix(argv[1]);<BR>&gt; &gt; reader-&gt;SetDataExtent(0, 63, 0, 63, 1, 93);<BR>&gt; &gt; reader-&gt;SetDataSpacing(3.2, 3.2, 1.5);<BR>&gt; &gt; reader-&gt;SetDataOrigin(0.0, 0.0, 0.0);<BR>&gt; &gt; reader-&gt;SetDataScalarTypeToUnsignedShort();<BR>&gt; &gt; reader-&gt;UpdateWholeExtent();<BR>&gt; <BR>&gt; The image reader cannot do any reslicing. The SetDataSpacing() method<BR>&gt; tells VTK that the pixels in the file are 3.2mm by 3.2mm and that the<BR>&gt; slices are 1.5mm apart, because VTK needs this information in order to<BR>&gt; correctly render the data. To reslice the data, you must add a<BR>&gt; vtkImageReslice filter or a vtkImageResample filter after the reader.<BR>&gt; <BR>&gt; I might have misunderstood your question, but I hope that my answer is helpful.<BR>&gt; <BR>&gt; David<BR>
&nbsp;<BR>
thanks David! <BR>
Because&nbsp;i want to get the resliced data extracted&nbsp;using vtkImageReslice in order to write the display program by myself.&nbsp;so i have another questions.<BR>
&nbsp;<BR>
1) VTK don't needs SetDataSpacing() method before&nbsp;rendering the data, so do the image reader method?&nbsp;<BR>
2) According to the below program, if 1) is true, i can understand why the size of the data of sagittalData is 64¡Á93 instead of 64¡Á3.2¡Á93¡Á1.5. and it is the true that the&nbsp;sagittalData is extracted from CT&nbsp;images directly&nbsp;without considering the DataSpacing , but it is clear that extracted reslice is bad, because the CT images are not interpolated according&nbsp;to the value of&nbsp; SetDataSpacing().<BR>
&nbsp;<BR>
////////////////////////////////////////////////////////// Set the slice oobliquerientation////////////////////////////////////////////////////&nbsp;<BR>&nbsp; vtkMatrix4x4 *resliceAxesSagittal = vtkMatrix4x4::New();<BR>&nbsp; resliceAxesSagittal-&gt;DeepCopy(sagittalElements);<BR>&nbsp; // Extract a slice in the desired orientation<BR>&nbsp; vtkImageReslice *resliceSagittal = vtkImageReslice::New();<BR>&nbsp; resliceSagittal-&gt;SetInputConnection(v16-&gt;GetOutputPort());<BR>&nbsp; resliceSagittal-&gt;SetOutputDimensionality(2);<BR>&nbsp; resliceSagittal-&gt;SetResliceAxes(resliceAxesSagittal);<BR>&nbsp; resliceSagittal-&gt;InterpolateOn();<BR>&nbsp; //resliceSagittal-&gt;SetInterpolationModeToLinear();<BR>&nbsp; resliceSagittal-&gt;Update();<BR>&nbsp; ////////////////////////////////////////extract the data of sagittal////////////////////////////////////////////////////////<BR>&nbsp;if(resliceSagittal-&gt;GetOutput()-&gt;GetScalarPointer()==NULL){<BR>&nbsp;&nbsp;&nbsp;&nbsp; resliceSagittal-&gt;GetOutput()-&gt;AllocateScalars();<BR>&nbsp; }<BR>&nbsp; unsigned short *ptrdb=(unsigned short *)resliceSagittal-&gt;GetOutput()-&gt;GetScalarPointer();<BR>&nbsp; memcpy(sagittalData,ptrdb,64*93*sizeof(unsigned short));<BR><BR>                                               </body>
</html>