<DIV >hello Peter Spring and everyone,</DIV>
<DIV> Thanks you advice!I still have some problems,can you help me?thanks.</DIV>
<DIV> How to read dicom files and use vtkPolyDataWriter to write to a .vtk file?can you give me a sample code?</DIV>
<DIV> </DIV>
<DIV> 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> vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<BR> reader->SetDirectoryName("D:\\lmhjava\\vtksource\\dicom");<BR> reader->Update();</DIV>
<DIV> //follow codes read the formats of dicom files.</DIV>
<DIV> </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->SetFilePrefix( outputImagePrefix );<BR><A name=l00060></A>imageReader->SetFilePattern( <SPAN class=stringliteral>"%s.%03d.dcm"</SPAN> );///May be wrong<BR><A name=l00061></A>imageReader->SetDataExtent( imageExtent );//Format read from vtkDICOMImageReader<BR><A name=l00062></A>imageReader->SetDataByteOrderToBigEndian();<BR><A name=l00063></A>imageReader->Update();<BR></DIV>
<DIV>vtkImageWriter *imageWriter = vtkImageWriter::New();<BR><A name=l00119></A>imageWriter->SetInput( imageReader->GetOutput() );<BR><A name=l00120></A>dicomImageReader->Delete();<BR><A name=l00121></A>imageWriter->SetFilePrefix( outputImagePrefix );<BR><A name=l00122></A>imageWriter->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->Write();<BR><A name=l00124></A>imageWriter->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> v16 SetDataDimensions 256 256<BR> v16 SetDataByteOrderToLittleEndian <BR> v16 SetFilePrefix "VTKData/fullHead/headsq"<BR> v16 SetImageRange 1 93<BR> v16 SetDataSpacing 1.0 1.0 2</DIV>
<DIV>vtkImageGaussianSmooth GaussianSmooth<BR> GaussianSmooth SetInput [v16 GetOutput]<BR> GaussianSmooth SetDimensionality 3<BR> GaussianSmooth SetStandardDeviations 0.0 4.0</DIV>
<DIV>vtkContourFilter skinExtractor<BR> skinExtractor SetInput [GaussianSmooth GetOutput]<BR> skinExtractor SetValue 0 500<BR> skinExtractor Update</DIV>
<DIV>vtkSmoothPolyDataFilter smoother<BR> smoother SetInput [skinExtractor GetOutput]<BR> smoother SetNumberOfIterations 70</DIV>
<DIV>vtkPolyDataNormals skinNormals<BR> skinNormals SetInput [smoother GetOutput]<BR> skinNormals SetFeatureAngle 60.0</DIV>
<DIV>vtkPolyDataWriter pdw<BR> pdw SetInput [skinNormals GetOutput]<BR> pdw SetFileName "C:/zhangh/VTK/out.vtk"<BR> pdw Write<BR>////////////////////////////////////////////////////////</DIV>
<DIV> </DIV>
<DIV> </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> </DIV>
<DIV>thanks you advice,thanks everybody's advice.</DIV>
<DIV> </DIV>
<DIV> </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>