[vtkusers] connect itk::ConnectedThresholdImageFilter to vtkContourFilter or similar

David Henry lightdee at gmail.com
Tue Oct 30 23:23:37 EDT 2012


I am working with an application that was developed with VTK 5.0.2.
It has a notion of a "Segment" and I want to display it in a window.

The relevant sections of code are:
        typedef itk::VTKImageToImageFilter<InImageType> InputFilterType;
        typedef itk::CurvatureFlowImageFilter<InImageType, InImageType>
SmoothingFilterType;
        typedef itk::ConnectedThresholdImageFilter<InImageType, OutImageType>
SegmentFilterType;
        typedef itk::ImageToVTKImageFilter<OutImageType> OutputFilterType;

        InputFilterType::Pointer inputFilter;
        SmoothingFilterType::Pointer smooth;
        SegmentFilterType::Pointer seg;

        inputFilter = InputFilterType::New();
        inputFilter->SetInput(source->getVolume()->GetOutput());

        seg = SegmentFilterType::New();
        seg->SetInput(inputFilter->GetOutput());
        seg->SetReplaceValue(255);

        outputFilter = OutputFilterType::New();
        outputFilter->SetInput(seg->GetOutput());

I want to do something like this:
  vtkContourFilter *segExtractor = vtkContourFilter::New();
//    segExtractor->SetInputConnection(seg->getOutput()); //seg->getOutput());
    segExtractor->SetInput(outputFilter->GetImporter()->GetOutput());
    segExtractor->SetValue(0, ?);

I'm not sure how to get the "output" of the segment to connect to the
vtkContourFilter - I used outputFilter->getImporter()->GetOuput(), but
is that what is needed for the vtkContourFilter?  Probably not,
because it's not displaying anything. I want to view the exterior of
the segment
in a vtkRenderWindow.  Maybe a vtkContourFilter is not the best way to
display this segment? Any ideas would be appreciated.



More information about the vtkusers mailing list