<div dir="ltr">Dear All,<div><br></div><div>I use ITK snap program to segment , then save the segmentation output to raw image data (using the menu segmentation --> Save As )</div><div><br></div><div>I read it using vtk, and try t extract the bone ad reconstruct it using the following code :</div>
<div><br></div><div><div><div> vtkMetaImageReader metaImageReader = new vtkMetaImageReader();</div><div> metaImageReader.SetFileName(@"C:\Users\Eng. Ali Mahmoud\Desktop\yyymhdmhd");</div><div> metaImageReader.Update();</div>
<div> </div><div> vtkImageShrink3D VIS = new vtkImageShrink3D();</div><div> VIS.SetShrinkFactors(2, 2, 2);</div><div> VIS.SetInputConnection(metaImageReader.GetOutputPort());</div>
<div> VIS.Update();</div><div><br></div><div> vtkImageThreshold VIT = new vtkImageThreshold();</div><div> VIT.ThresholdBetween(200, 2000);</div><div> VIT.SetInputConnection(VIS.GetOutputPort());</div>
<div> VIT.Update();</div><div><br></div><div> vtkImageMarchingCubes imageMarchingCubes = new vtkImageMarchingCubes();</div><div> imageMarchingCubes.SetInput(VIT.GetOutput());</div><div> imageMarchingCubes.SetValue(0, 500);</div>
<div> imageMarchingCubes.ComputeScalarsOff();</div><div> imageMarchingCubes.ComputeNormalsOff();</div><div> imageMarchingCubes.ComputeGradientsOff();</div><div> imageMarchingCubes.Update();</div>
<div><br></div><div> vtkPolyDataMapper map =new vtkPolyDataMapper(); </div><div> map.SetInput(imageMarchingCubes.GetOutput());</div><div><br></div><div> // actor coordinates geometry, properties, transformation </div>
<div> vtkActor aSphere =new vtkActor(); </div><div> aSphere.SetMapper(map); </div><div> aSphere.GetProperty().SetColor(0,0,1); // sphere color blue</div><div><br></div><div> // a renderer and render window </div><div>
vtkRenderer ren1 =new vtkRenderer(); </div><div> vtkRenderWindow renWin =new vtkRenderWindow(); </div><div> renWin.AddRenderer(ren1);</div><div><br></div><div> // an interactor </div><div> vtkRenderWindowInteractor iren =new vtkRenderWindowInteractor(); </div>
<div> iren.SetRenderWindow(renWin);</div><div><br></div><div> // add the actor to the scene </div><div> ren1.AddActor(aSphere); </div><div> ren1.SetBackground(1,1,1); // Background color white</div><div><br></div><div>
// render an image (lights and cameras are created automatically) </div><div> renWin.Render();</div><div><br></div><div> // begin mouse interaction </div><div> iren.Start(); </div><div><br></div><div><br></div></div>
<div>how to fix that </div><div><br></div><div>Best regards</div><div><br></div><div> </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div><br></div><div><br>
</div><div><br></div><div><br></div></div>