[vtkusers] vtkBlend Output

Alexis Cheng acheng_1221 at hotmail.com
Tue Nov 2 20:07:26 EDT 2010


Hi David,

It certainly seems to be the Stencil filter that is slowing the system down. I am trying to use vtkPolyDataToImageStencil to see if that would be any faster, but I'm having some difficulties.

I replaced this ImplicitFunction code:

        vtkSmartPointer<vtkImplicitSelectionLoop> ImplicitLoop = vtkSmartPointer<vtkImplicitSelectionLoop>::New();
        ImplicitLoop->SetLoop(points);

        vtkSmartPointer<vtkImplicitFunctionToImageStencil> dataToStencil = vtkSmartPointer<vtkImplicitFunctionToImageStencil>::New();
        dataToStencil->SetInput(ImplicitLoop);

with this PolyData code:

        vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
        vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
        polygon->GetPointIds()->SetNumberOfIds(4); //make a quad
        polygon->GetPointIds()->SetId(0, 0);
        polygon->GetPointIds()->SetId(1, 1);
        polygon->GetPointIds()->SetId(2, 2);
        polygon->GetPointIds()->SetId(3, 3);
 
        polygons->InsertNextCell(polygon);
 
        vtkSmartPointer<vtkPolyData> quad = vtkSmartPointer<vtkPolyData>::New();
        quad->SetPoints(points);
        quad->SetPolys(polygons);

        vtkSmartPointer<vtkPolyDataToImageStencil> dataToStencil = vtkSmartPointer<vtkPolyDataToImageStencil>::New();
        dataToStencil->SetInput(quad);

The final image does not show the stencil with the PolyData code. Is there a difference in the implementation of the 2 filters where I would have a different output or need a different input? Also, should I expect to see any increase in performance by using PolyData instead of ImplicitFunction? Thanks for all your answers!

Cheers,
Alexis Cheng
Electrical Engineering
University of British Columbia



> From: david.gobbi at gmail.com
> Date: Mon, 1 Nov 2010 19:27:40 -0600
> Subject: Re: [vtkusers] vtkBlend Output
> To: acheng_1221 at hotmail.com
> CC: vtkusers at vtk.org
> 
> Hi Alexis,
> 
> Have you tried it without the stencil, for comparison?  The
> vtkImplicitFunctionToImageStencil filter is very slow.
> 
>   David
> 
> 
> On Mon, Nov 1, 2010 at 5:57 PM, Alexis Cheng <acheng_1221 at hotmail.com> wrote:
> > Hi all,
> >
> > Is vtkBlend extremely resource intensive? I have a following piece of code
> > running: FinalImage is a vtkImageData object, MTImage is a vtkImageData
> > object, and blend1 is a vtkImageBlend object.
> >
> >         blend1->SetStencil(dataToStencil->GetOutput());
> >         blend1->AddInput(MTImage);
> >         blend1->AddInput(BlackImage);
> >         blend1->SetOpacity(0,0.5);
> >         blend1->SetOpacity(1,0.5);
> >
> >         if(OutOfView)
> >         {
> >             FinalImage = MTImage;
> >         }
> >         else
> >         {
> >             FinalImage = blend1->GetOutput();
> >         }
> >         FinalImage->Update();
> >
> > The fps of my display decreases dramatically whenever the output from blend
> > is requested. Is this behaviour expected? Thanks in advance.
> >
> > Cheers,
> > Alexis Cheng
> > Electrical Engineering
> > University of British Columbia
> >
> > _______________________________________________
> > 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
> >
> >
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101102/ae793ae5/attachment.htm>


More information about the vtkusers mailing list