[vtkusers] How create 3d image from DICOM-files in C#?

Андрей Глухов realandron at gmail.com
Mon Jan 18 06:16:20 EST 2010


Hello. Hi. I looked at an example
http://devsample.org/index.php?option=com_content&task=view&id=18&Itemid=1 ,
but I do not understand what properties should be set for Interactor.

  vtkRenderer ren1 = new vtkRenderer();
            ren1.SetBackground(0, 0, 0);

            vtkRenderWindow Win = reWin.GetRenderWindow(); ;
            Win.AddRenderer(ren1);

            vtkRenderWindowInteractor iren = new
vtkRenderWindowInteractor();
            iren.SetRenderWindow(Win);

            vtkDICOMImageReader DicomReader = new vtkDICOMImageReader();
            DicomReader.SetDirectoryName(@"directory");

            vtkImageData ImageData = new vtkImageData();
            ImageData.DeepCopy(DicomReader.GetOutput());

            vtkPiecewiseFunction m_pOpacityTransferFunction = new
vtkPiecewiseFunction();
            vtkColorTransferFunction m_pColorTransferFunction = new
vtkColorTransferFunction();

            vtkVolumeProperty VolumeProperty = new vtkVolumeProperty();
            VolumeProperty.SetColor(m_pColorTransferFunction);
            VolumeProperty.SetScalarOpacity(m_pOpacityTransferFunction);
            VolumeProperty.SetInterpolationTypeToLinear();
            VolumeProperty.ShadeOff();

            vtkVolume Volume = new vtkVolume();
            Volume.SetProperty(VolumeProperty);

            vtkFixedPointVolumeRayCastMapper VolumeMapperSoftware = new
vtkFixedPointVolumeRayCastMapper();
            VolumeMapperSoftware.SetInput(ImageData);
            VolumeMapperSoftware.SetSampleDistance(1.0f);
            VolumeMapperSoftware.SetBlendModeToMaximumIntensity();
            Volume.SetMapper(VolumeMapperSoftware);

            ren1.AddVolume(Volume);
            ren1.ResetCamera();
            iren.Initialize();
            iren.Start();// There error AccessViolationException.

Help me please. Thanks in advance.
-- 
С Уважением,
Андрей.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100118/d5cee0f3/attachment.htm>


More information about the vtkusers mailing list