[vtkusers] Filling vtkCutter output

Scott Johnson Scott.Johnson at neuwave.com
Thu Apr 8 13:56:58 EDT 2010


Thanks for the pointer Bill, but I can't get it to work.  

When I connect the complete pipeline, as described in capCow.tcl, I don't see any of the sphere displayed on my cut plane.

The method which creates the pipeline looks like:
(I've embedded a few comments to explain what I'm seeing.)

void ROICutter::CreatePipeline()
{
    vtkProperty* props;
    double       red;
    double       green;
    double       blue;

    _cutter = vtkCutter::New();
    // _ROI is a vtkSphereSource
    _cutter->SetInputConnection(_ROI->GetOutputPort());
    // _plane is a vtkPlane
    _cutter->SetCutFunction(_plane);
    _cutter->GenerateCutScalarsOn();
    _cutter->SetValue(0, 0.5);

    _stripper = vtkStripper::New();
    _stripper->SetInputConnection(_cutter->GetOutputPort());
    _stripper->Update();

    _polyData = vtkPolyData::New();
    _polyData->SetPoints(_stripper->GetOutput()->GetPoints());
    _polyData->SetPolys(_stripper->GetOutput()->GetLines());

    _triangles = vtkTriangleFilter::New();
    _triangles->SetInput(_polyData);

    _ROIMapper = vtkPolyDataMapper::New();
    // If I uncomment the next line and comment out the SetInput and 
    // SetInputConnection calls, I can see the outline of the cut sphere.
    //_ROIMapper->SetInputConnection(_cutter->GetOutputPort());
    _ROIMapper->SetInput(_polyData);
    _ROIMapper->SetInputConnection(_triangles->GetOutputPort());

    _ROIActor = vtkActor::New();
    _ROIActor->SetMapper(_ROIMapper);

    _ROI->GetColor(red, green, blue);

    props=_ROIActor->GetProperty();
    props->SetLineWidth(2);
    props->SetOpacity(1.0);
    props->EdgeVisibilityOn();
    props->SetDiffuse(0.8);
    props->SetSpecular(0.3);
    props->SetSpecularPower(20);
    props->SetRepresentationToSurface();
    props->SetDiffuseColor(red, green, blue);
    props->SetEdgeColor(red, green, blue);
    props->SetColor(red, green, blue);
}

Thanks

		-- Scott

-----Original Message-----
From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Thursday, April 08, 2010 11:37 AM
To: Scott Johnson
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Filling vtkCutter output

Look at the test:
Graphics/Testing/Tcl/capCow.tcl


On Thu, Apr 8, 2010 at 12:27 PM, Scott Johnson
<Scott.Johnson at neuwave.com> wrote:
> Howdy,
>
>
>
> I've got a vtkSphereSource cut by a vtkPlane using vtkCutter.  This gives me
> the outline of a circle which I'm overlaying on my images.  Is there a way
> for me to fill the circle with color?
>
>
>
> Thanks
>
>
>
>                                 -- Scott
>
>
>
> _______________________________________________
> 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
>
>



More information about the vtkusers mailing list