[vtkusers] itk snap . Question

Ali Habib ali.mahmoud.habib at gmail.com
Fri Mar 12 14:36:20 EST 2010


Dear All,

I use ITK snap program to segment , then save the segmentation output to raw
image data (using the menu segmentation --> Save As )

I read it using vtk, and try t extract the bone ad reconstruct it using the
following code :

 vtkMetaImageReader metaImageReader = new vtkMetaImageReader();
            metaImageReader.SetFileName(@"C:\Users\Eng. Ali
Mahmoud\Desktop\yyymhdmhd");
            metaImageReader.Update();

            vtkImageShrink3D VIS = new vtkImageShrink3D();
            VIS.SetShrinkFactors(2, 2, 2);
            VIS.SetInputConnection(metaImageReader.GetOutputPort());
            VIS.Update();

            vtkImageThreshold VIT = new vtkImageThreshold();
            VIT.ThresholdBetween(200, 2000);
            VIT.SetInputConnection(VIS.GetOutputPort());
            VIT.Update();

            vtkImageMarchingCubes imageMarchingCubes = new
vtkImageMarchingCubes();
            imageMarchingCubes.SetInput(VIT.GetOutput());
            imageMarchingCubes.SetValue(0, 500);
            imageMarchingCubes.ComputeScalarsOff();
            imageMarchingCubes.ComputeNormalsOff();
            imageMarchingCubes.ComputeGradientsOff();
            imageMarchingCubes.Update();

             vtkPolyDataMapper map =new vtkPolyDataMapper();
  map.SetInput(imageMarchingCubes.GetOutput());

  // actor coordinates geometry, properties, transformation
  vtkActor aSphere =new vtkActor();
  aSphere.SetMapper(map);
  aSphere.GetProperty().SetColor(0,0,1); // sphere color blue

  // a renderer and render window
  vtkRenderer ren1 =new vtkRenderer();
  vtkRenderWindow renWin =new vtkRenderWindow();
  renWin.AddRenderer(ren1);

  // an interactor
  vtkRenderWindowInteractor iren =new vtkRenderWindowInteractor();
  iren.SetRenderWindow(renWin);

  // add the actor to the scene
  ren1.AddActor(aSphere);
  ren1.SetBackground(1,1,1); // Background color white

  // render an image (lights and cameras are created automatically)
  renWin.Render();

  // begin mouse interaction
   iren.Start();


how to fix that

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100312/0502cb7d/attachment.htm>


More information about the vtkusers mailing list