[vtkusers] Res: Connected component labelling for 3D

walmor godoi wfisico at yahoo.com.br
Thu Aug 7 15:44:11 EDT 2008


Hi Amy,

It worked! 

Thanks for your help! 

Below I will leave that wrote the code in Java example (using netbeans / swing)  to help others vtkusers:

Java Code:
(...)
   vtkImageCast cast = new vtkImageCast();
   cast.SetInput(bmpreader.GetOutput());
   
   vtkImageGaussianSmooth smooth = new vtkImageGaussianSmooth();
   smooth.SetInput(cast.GetOutput());
   smooth.SetStandardDeviations(4.0, 4.0, 4.0);
   smooth.SetRadiusFactors(2.0, 2.0, 2.0);
   smooth.SetDimensionality(3);
 
    vtkContourFilter skinExtractor = new vtkContourFilter();
    skinExtractor.SetInput(smooth.GetOutput());
    skinExtractor.SetValue(0, 100);
    
    vtkPolyDataNormals skinNormals = new vtkPolyDataNormals();
    skinNormals.SetInput(skinExtractor.GetOutput());
    skinNormals.SetFeatureAngle(60.0);
    
    vtkPolyDataConnectivityFilter conn =new vtkPolyDataConnectivityFilter();
    conn.SetInput(skinNormals.GetOutput());
    conn.ColorRegionsOn();
    conn.SetExtractionModeToAllRegions();
    conn.GetNumberOfExtractedRegions();
    conn.Update();
    //Or ----
    //conn.SetExtractionModeToSpecifiedRegions();
    // conn.InitializeSpecifiedRegionList();
    // conn.AddSpecifiedRegion(1);
   // conn.Update();

   vtkPolyDataMapper mapper = new vtkPolyDataMapper();
   mapper.SetInput(conn.GetOutput());
   mapper.SetScalarRange(conn.GetOutput().GetScalarRange());

   vtkActor actor = new vtkActor();
   actor.SetMapper(mapper);

(...)

---------------------------------------------------------------------------------
Walmor Cardoso Godoi, M. Sc.
Curitiba - Brazil
--------------------------------------------------------------------------------



----- Mensagem original ----
> De: Amy Squillacote <ahs at cfdrc.com>
> Para: walmor godoi <wfisico at yahoo.com.br>
> Cc: vtkusers at vtk.org
> Enviadas: Terça-feira, 5 de Agosto de 2008 15:00:19
> Assunto: Re: [vtkusers] Connected component labelling for 3D
> 
> Take a look at vtkConnectivityFilter 
> (http://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html) 
> and vtkPolyDataConnectivityFilter 
> (http://www.vtk.org/doc/nightly/html/classvtkPolyDataConnectivityFilter.html).
> 
> - Amy
> 
> walmor godoi wrote:
> > Hi vtkusers,
> >
> >
> > I found this question in the (2001) and wonders if there is solution in vtk to 
> the issue today?
> >
> >
> >
> >  
> >>> Hi everyone,
> >>>
> >>>      
> >> I have asked a question regarding connected component labelling for 3D
> >> points, for which I have not got any responses.
> >> I am rephrasing  my question as follows:
> >>
> >> Are there any existing algorithms in vtk to label the 3D data points into
> >> different regions ( based on their neighbourhood connectivity) ? 
> >>
> >> For example the 3D data points shown below, into 3 different labels.
> >>
> >>    
> >>>                    X X X X                  X X X
> >>>                    X X X X                    X X
> >>>                      X X         X        X X X X
> >>>                        X      X X X        X X
> >>>
> >>>
> >>>      
> > Thanks 
> > 
> ---------------------------------------------------------------------------------
> > Walmor Cardoso Godoi, M. Sc.
> > Curitiba - Brazil
> > 
> --------------------------------------------------------------------------------
> >
> >
> >
> >       Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua 
> cara @ymail.com ou @rocketmail.com.
> > http://br.new.mail.yahoo.com/addresses
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
> >  
> 
> -- 
> Amy Squillacote                    Phone: (256) 726-4839
> Computer Scientist                 Fax: (256) 726-4806
> CFD Research Corporation           Web: http://www.cfdrc.com
> 215 Wynn Drive, Suite 501
> Huntsville, AL  35805



      Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses



More information about the vtkusers mailing list