[vtkusers] SkinExtractor | ActiViz C# | get rid of inner points

Matias Montroull matimontg at gmail.com
Thu Jan 16 15:07:59 EST 2014


I made it work!

Here's the code:

 vtkDICOMImageReader readerdicom = new vtkDICOMImageReader();
            readerdicom.SetDirectoryName(@"C:\imgDicom");
            readerdicom.Update();

            vtkRenderer renderer =
vtkRenderer.New();//renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();
;
            vtkRenderWindow renwin =
vtkRenderWindow.New();//renderWindowControl1.RenderWindow;
            renwin.AddRenderer(renderer);

            vtkRenderWindowInteractor iren =
vtkRenderWindowInteractor.New();
            iren.SetRenderWindow(renwin);

vtkContourFilter skinextractor = vtkContourFilter.New();
skinextractor.SetInputConnection(readerdicom.GetOutputPort());
            skinextractor.SetValue(0, -800);

//Remove Inner Points that are not part of the Skin
            vtkPolyDataConnectivityFilter contornos = new
vtkPolyDataConnectivityFilter();
            contornos.SetInputConnection(skinextractor.GetOutputPort());
            contornos.SetExtractionModeToLargestRegion();
            contornos.SetColorRegions(1);
            vtkPolyDataNormals skinnormals = vtkPolyDataNormals.New();
            skinnormals.SetInputConnection(contornos.GetOutputPort());
            skinnormals.SetFeatureAngle(90.0);
            skinnormals.ComputePointNormalsOn();

//
            vtkPolyDataMapper skinmapper = vtkPolyDataMapper.New();

            skinmapper.SetInputConnection(skinnormals.GetOutputPort());
            skinmapper.ScalarVisibilityOff();



            vtkOutlineFilter outlineData = new vtkOutlineFilter();

            vtkActor skin = vtkActor.New();
            skin.SetMapper(skinmapper);


            vtkCamera camara = renderer.GetActiveCamera();
            camara.SetViewUp(0, 0, -1);
            camara.SetPosition(1, 1, 1);
            camara.SetFocalPoint(0, 0, 0);
            camara.ComputeViewPlaneNormal();
            renderer.AddActor(skin);
            renderer.SetActiveCamera(camara);
            renderer.ResetCamera();
            camara.Dolly(1.5);



            renderer.ResetCameraClippingRange();
            iren.Initialize();
            iren.Start();
            skinextractor.Dispose();
            skinnormals.Dispose();
            skinmapper.Dispose();
            skin.Dispose();
            camara.Dispose();
            iren.Dispose();
            renwin.Dispose();
            renderer.Dispose();


            readerdicom.Dispose();


On Thu, Jan 16, 2014 at 1:16 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> http://vtk.org/Wiki/VTK/Examples/Cxx/Modelling/ExtractLargestIsosurface
>
>
> On Thu, Jan 16, 2014 at 11:11 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
> > No, but Google should be able to find one for you.
> >
> > On Thu, Jan 16, 2014 at 7:27 AM, Matias Montroull <matimontg at gmail.com>
> wrote:
> >> Thanks, any example you could post?
> >>
> >>
> >> On Thu, Jan 16, 2014 at 1:21 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
> >>>
> >>> Fairly often you can get rid of the extra bits by running your data
> >>> through vtkPolyDataConnectivityFilter after generating the contours.
> >>>
> >>> On Wed, Jan 15, 2014 at 12:37 PM, Matias Montroull <
> matimontg at gmail.com>
> >>> wrote:
> >>> > Hi,
> >>> >
> >>> > I'm extracting surface from a stack of DICOM Images and noticed that
> >>> > some
> >>> > inner points are shown.. how can I get rid of those points?
> >>> >
> >>> > This is what I use: I can only specify the ISO Value but what about
> >>> > inner
> >>> > points where the ISO value matches but is useless or is not sking as
> an
> >>> > example?
> >>> >
> >>> > Is there another filter I could apply? or an algorithm I could use to
> >>> > remove
> >>> > those points?
> >>> >
> >>> >  vtkContourFilter skinextractor = vtkContourFilter.New();
> >>> >
> >>> >
> >>> >
> >>> > skinextractor.SetInputConnection(readerdicom.GetOutputPort());
> >>> >             skinextractor.GetValues();
> >>> >
> >>> >             skinextractor.SetValue(0, -800);
> >>> >
> >>> > Thanks!
> >>
> >>
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140116/3e184511/attachment.html>


More information about the vtkusers mailing list