<DIV >hello Peter Spring and everyone,</DIV>
<DIV>&nbsp;&nbsp; Thanks you advice!I still have some problems,can you help me?thanks.</DIV>
<DIV>&nbsp;&nbsp; How to read dicom files and use vtkPolyDataWriter to write to a .vtk file?can you give me a sample code?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp; I use vtkDICOMImageReader to read the data formats such as dataSpacing,and use vtkImageReader to use this formats to read the data,</DIV>
<DIV>//////////////////////////////</DIV>
<DIV>&nbsp;&nbsp; vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<BR>&nbsp;&nbsp; reader-&gt;SetDirectoryName("D:\\lmhjava\\vtksource\\dicom");<BR>&nbsp;&nbsp; reader-&gt;Update();</DIV>
<DIV>&nbsp;&nbsp; //follow codes read the formats of dicom files.</DIV>
<DIV>&nbsp;</DIV>
<DIV>////May be use vtkImageReader to read the dcm file is wrong.but I can not find other ways.</DIV>
<DIV>vtkImageReader *imageReader = vtkImageReader::New();<BR><A name=l00059></A>imageReader-&gt;SetFilePrefix( outputImagePrefix );<BR><A name=l00060></A>imageReader-&gt;SetFilePattern( <SPAN class=stringliteral>"%s.%03d.dcm"</SPAN> );///May be wrong<BR><A name=l00061></A>imageReader-&gt;SetDataExtent( imageExtent );//Format read from vtkDICOMImageReader<BR><A name=l00062></A>imageReader-&gt;SetDataByteOrderToBigEndian();<BR><A name=l00063></A>imageReader-&gt;Update();<BR></DIV>
<DIV>vtkImageWriter *imageWriter = vtkImageWriter::New();<BR><A name=l00119></A>imageWriter-&gt;SetInput( imageReader-&gt;GetOutput() );<BR><A name=l00120></A>dicomImageReader-&gt;Delete();<BR><A name=l00121></A>imageWriter-&gt;SetFilePrefix( outputImagePrefix );<BR><A name=l00122></A>imageWriter-&gt;SetFilePattern( <SPAN class=stringliteral><FONT color=#002080>"%s.%03d"</FONT></SPAN> );//I just want to write dcm files into files like VTKData/headsq/quarter<BR><A name=l00123></A>imageWriter-&gt;Write();<BR><A name=l00124></A>imageWriter-&gt;Delete();</DIV>
<DIV>////////////////////////////////////////////////////////////</DIV>
<DIV>And use the the follow code to read the sample headsq/quarter data,and write to a vtk file.I just want to convert the dicom file to datas like headsq/quarter,and write to a vtk file.</DIV>
<DIV>//////////////////////////////</DIV>
<DIV>//the follow codes I have tested.</DIV>
<DIV>package require vtk<BR>package require vtkinteraction</DIV>
<DIV>vtkVolume16Reader v16<BR>&nbsp; v16 SetDataDimensions 256 256<BR>&nbsp; v16 SetDataByteOrderToLittleEndian <BR>&nbsp; v16 SetFilePrefix&nbsp; "VTKData/fullHead/headsq"<BR>&nbsp; v16 SetImageRange 1 93<BR>&nbsp; v16 SetDataSpacing&nbsp; 1.0 1.0 2</DIV>
<DIV>vtkImageGaussianSmooth GaussianSmooth<BR>&nbsp; GaussianSmooth SetInput [v16 GetOutput]<BR>&nbsp; GaussianSmooth SetDimensionality 3<BR>&nbsp; GaussianSmooth SetStandardDeviations 0.0 4.0</DIV>
<DIV>vtkContourFilter skinExtractor<BR>&nbsp; skinExtractor SetInput [GaussianSmooth GetOutput]<BR>&nbsp; skinExtractor SetValue 0 500<BR>&nbsp; skinExtractor Update</DIV>
<DIV>vtkSmoothPolyDataFilter smoother<BR>&nbsp; smoother SetInput [skinExtractor GetOutput]<BR>&nbsp; smoother SetNumberOfIterations 70</DIV>
<DIV>vtkPolyDataNormals skinNormals<BR>&nbsp; skinNormals SetInput [smoother GetOutput]<BR>&nbsp; skinNormals SetFeatureAngle 60.0</DIV>
<DIV>vtkPolyDataWriter pdw<BR>&nbsp; pdw SetInput [skinNormals GetOutput]<BR>&nbsp; pdw SetFileName "C:/zhangh/VTK/out.vtk"<BR>&nbsp; pdw Write<BR>////////////////////////////////////////////////////////</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>In your advice,use dicom2 to convert dcm files to raw data,and use vtkUolume16Reader to read and use vtkPolyDataWriter to write to a vtk file?</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks you advice,thanks everybody's advice.</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;</DIV><!-- CoreMail Version 3.1_dev Copyright (c) 2002-2006 www.mailtech.cn --><br><!-- footer --><br>
<hr>
<a style="font-size:12px;line-height:15px; color:#000; text-decoration:none" href="http://www.126.com/index.htm?mailsite=gmail&mailpos=20061204&num=2">想免费获得高速稳定的3G邮箱吗? <span style="font-family:Tahoma; text-decoration:underline; color:blue">www.126.com</span> </a>