[Insight-users] Region Growing Segmentation to Marching Cubes Implementation

khaled danwar khaled.danwar53 at gmail.com
Sat Aug 27 11:07:58 EDT 2011


Hello,

I wasn't not sure if this request for help was better suited for itk users
or vtk users, so I just went with itk since most of my code uses itk,
hopefully nobody objects and I could still get help from any of you
(including vtk users).

The lay out of the land is this:

1) for each dicom image I use the confidence connected image filter from itk
to employ a region based segmentation. Note that I do this for each image in
turn (ie click on seed points on original image, get it segmented, save the
file as a new dicom file in a folder) becasue I simply need to for this
particular project.

2) once I have all my segmented dicom files in that folder, I intend to
(more like 'need to') use the marching cubes algorithm given by vtk so that
I can render a 3D image of the skull (I'm segmenting ct scans to get the
bones alone). This is where my problem is.

For this particular 3d Rendering, my code looks a little something like
this:


//Load the data
vtkSmartPointer<vtkDICOMImageReader> reader =
vtkSmartPointer<vtkDICOMImageReader>::New();
reader->SetDirectoryName(outputDirectory.c_str());
reader->Update();

//Smoothing the edges with gaussian
vtkSmartPointer<vtkImageGaussianSmooth> gaussianSmoothFilter =
vtkSmartPointer<vtkImageGaussianSmooth>::New();
gaussianSmoothFilter->SetInputConnection(reader->GetOutputPort());
gaussianSmoothFilter->SetRadiusFactor(2);

//Marching Cubes
vtkSmartPointer<vtkMarchingCubes> surface =
vtkSmartPointer<vtkMarchingCubes>::New();
surface->SetInputConnection(gaussianSmoothFilter->GetOutputPort());
surface->ComputeNormalsOn();
surface->ComputeGradientsOn();
//surface->SetInputConnection(reader->GetOutputPort());

//Create a mapper
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(surface->GetOutputPort());

// Visualize
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();

vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);

vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);

renderer->AddActor(actor);

renderWindow->SetSize(800,600);
renderWindow->Render();
interactor->Start();


The problem is that the marching cubes algorithm is complaining that the
dicom files holding the segmented images are not of 3D format and so it cant
render an output that I need. So can anyone help me sort out my need to use
vtk marching cubes algorithm after I've used itk segmentation on multiple
files in turn.

Thanks for any help,
Khaled
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110827/f8f7953d/attachment.htm>


More information about the Insight-users mailing list