[Insight-users] Region Growing Segmentation to Marching Cubes Implementation
Richard Beare
richard.beare at gmail.com
Sat Aug 27 20:24:01 EDT 2011
You can use ITK to load the segmented series as a 3D image and either
save it to a 3d format and load in vtk, or use the itk to vtk
connector so to transfer the 3d image object to the vtk part of your
code. There are examples of this in the InsightApplications suite.
It is also likely, although I haven't checked, that vtk has a dicom
series reader, enabling it to read all of the dicoms into a 3d object
On Sun, Aug 28, 2011 at 1:07 AM, khaled danwar
<khaled.danwar53 at gmail.com> wrote:
> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list