Hello,<div><br></div><div>I wasn&#39;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).</div>
<div><br></div><div>The lay out of the land is this:</div><div><br></div><div>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.</div>
<div><br></div><div>2) once I have all my segmented dicom files in that folder, I intend to (more like &#39;need to&#39;) use the marching cubes algorithm given by vtk so that I can render a 3D image of the skull (I&#39;m segmenting ct scans to get the bones alone). This is where my problem is.</div>
<div><br></div><div>For this particular 3d Rendering, my code looks a little something like this:</div><div><br></div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Load the data</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkDICOMImageReader&gt; reader = vtkSmartPointer&lt;vtkDICOMImageReader&gt;::New(); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>reader-&gt;SetDirectoryName(outputDirectory.c_str()); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>reader-&gt;Update(); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Smoothing the edges with gaussian</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkImageGaussianSmooth&gt; gaussianSmoothFilter = vtkSmartPointer&lt;vtkImageGaussianSmooth&gt;::New(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>gaussianSmoothFilter-&gt;SetInputConnection(reader-&gt;GetOutputPort()); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gaussianSmoothFilter-&gt;SetRadiusFactor(2); </div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Marching Cubes</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkMarchingCubes&gt; surface = vtkSmartPointer&lt;vtkMarchingCubes&gt;::New(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>surface-&gt;SetInputConnection(gaussianSmoothFilter-&gt;GetOutputPort());</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>surface-&gt;ComputeNormalsOn();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>surface-&gt;ComputeGradientsOn();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//surface-&gt;SetInputConnection(reader-&gt;GetOutputPort());</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Create a mapper</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper = vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>mapper-&gt;SetInputConnection(surface-&gt;GetOutputPort());</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// Visualize</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkActor&gt; actor = vtkSmartPointer&lt;vtkActor&gt;::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>actor-&gt;SetMapper(mapper);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkSmartPointer&lt;vtkRenderer&gt;::New(); </div><div>  </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow = vtkSmartPointer&lt;vtkRenderWindow&gt;::New(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>renderWindow-&gt;AddRenderer(renderer); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; interactor = vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>interactor-&gt;SetRenderWindow(renderWindow); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>renderer-&gt;AddActor(actor); </div>
<div>  </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>renderWindow-&gt;SetSize(800,600); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>renderWindow-&gt;Render(); </div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>interactor-&gt;Start(); </div></div><div><br></div><div><br></div><div>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&#39;ve used itk segmentation on multiple files in turn.</div>
<div><br></div><div>Thanks for any help,</div><div>Khaled</div>