[vtkusers] VTK Model and ITKImageBase itkImage_UC3

Sam sistephan at gmail.com
Sat Nov 20 19:22:30 EST 2010


David,

Please review my code and let me know if you see something wrong.  

Two Issues
1. The Update() methods throws AccessViolation Exceptions (don't I need to
call the update method for these filters to perform work? If not, then at
what point does a filter peform its work?).

2. The VoxelCount is 0 which can't be correct.


C# Code:

            vtkDataObject dicomDataObject = new vtkDataObject();
            vtkDICOMImageReader dicomImage = new vtkDICOMImageReader();
            dicomImage.SetDirectoryName("C:\\DICOMVolume");
            dicomImage.SetOutput(dicomDataObject);
            dicomImage.Update();
            string patientName = patientName = dicomImage.GetPatientName();
            Console.WriteLine("Patient Name: {0} ", patientName); //Prints
name correctly

            vtkPolyDataToImageStencil modelStencilPolyData = new
vtkPolyDataToImageStencil();
            modelStencilPolyData.SetInput(model); //model is a PolyData
Object.
           
modelStencilPolyData.SetOutputSpacing(dicomImage.GetPixelSpacing());
           
modelStencilPolyData.SetOutputOrigin(dicomImage.GetDataOrigin());
            //modelStencilPolyData.Update();  causes access violation error

            vtkImageStencilData modelImageStencil =
modelStencilPolyData.GetOutput();
            
            vtkImageAccumulate modelAccumulate = new vtkImageAccumulate();
            modelAccumulate.SetInput(dicomDataObject);
            modelAccumulate.SetStencil(modelImageStencil);
            //modelAccumulate.Update(); causes access violation error
             
            int voxelCount = modelAccumulate.GetVoxelCount();
            Console.WriteLine("Voxel Count: {0} ", voxelCount); //Prints
Zero (Problem!!)
-- 
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Model-and-ITKImageBase-itkImage-UC3-tp3273888p3274004.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list