[vtkusers] vtkVolume16Reader,How to read raw files f rom 002.dcm.raw to 123.dcm.raw?

iii-lin iii-lin at 163.com
Mon Dec 25 05:20:29 EST 2006


hello everyone,
   I use dicom2 to convert 002.dcm....123.dcm to 002.dcm.raw....123.dcm.raw,and use the vtkVolume16Reader to read the raw files,but the v16.SetFilePattern("%s%3d.dcm.raw") has something wrong, In the output window:can not find d:\rawdata\  2.dcm.raw ,how to set the patterns?Let d:\rawdata\002.dcm.raw could be readed.
 
here are the codes.I use Java language
//////////////////////////////////////////////////////////////
vtkDICOMImageReader dicomReader = new vtkDICOMImageReader();
  dicomReader.SetDirectoryName("d:/dicom");
  dicomReader.Update(); 
  double[] dataSpacing = dicomReader.GetDataSpacing();
  System.out.println(dataSpacing[0] + ":" + dataSpacing[1] + ":" + dataSpacing[2]);
  vtkVolume16Reader v16 = new vtkVolume16Reader();
  v16.SetDataByteOrderToLittleEndian();
  v16.SetFilePrefix("d:/rawdata/");
  v16.SetFilePattern("%s%3d.dcm.raw");
  v16.SetImageRange(2, 123);
  v16.GetOutput().ReleaseDataFlagOn();
  v16.SetDataSpacing(dicomReader.GetDataSpacing());
  v16.SetDataDimensions(dicomReader.GetOutput().GetDimensions());
  v16.Update();
  
  Thread.sleep(10000);
  vtkImageGaussianSmooth GaussianSmooth = new vtkImageGaussianSmooth();
  GaussianSmooth.SetInput(v16.GetOutput());
  GaussianSmooth.SetDimensionality (3);
  GaussianSmooth.SetStandardDeviations(0.0,4.0);
  vtkContourFilter skinExtractor = new vtkContourFilter();
  skinExtractor.SetInput((vtkDataSet)GaussianSmooth.GetOutput());
     skinExtractor.SetValue(0, 500);
  skinExtractor.Update();
  vtkSmoothPolyDataFilter smoother=new vtkSmoothPolyDataFilter();
  smoother.SetInput(skinExtractor.GetOutput());
  smoother.SetNumberOfIterations(70);
     vtkPolyDataNormals skinNormals = new vtkPolyDataNormals();
  skinNormals.SetInput(smoother.GetOutput());
     skinNormals.SetFeatureAngle(60.0);

  vtkPolyDataWriter pdw=new vtkPolyDataWriter();
  pdw.SetInput(skinNormals.GetOutput());
     pdw.SetFileName("d:/out.vtk");
     pdw.Write();
 
 
/////////////////////////////////////////
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061225/5f705787/attachment.htm>


More information about the vtkusers mailing list