[vtkusers] vtkBlend Output

Bill Lorensen bill.lorensen at gmail.com
Fri Nov 5 11:02:05 EDT 2010


David,

Going forward, I think a gerrit review of new classes is a good idea.
http://review.source.kitware.com/#q,status:open,n,z

It is good to have another set of eyes critique the API. Also, it will
ensure that a corresponding test is added (I see that you added
tests).

A new user should not depend on an API that has not passed some sort
of review process.

Bill


On Thu, Nov 4, 2010 at 3:01 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> They're available now.  I sidestepped the review process because these
> classes don't touch any critical bits of VTK code.  Opinions, however,
> are always welcome.
>
>  David
>
> On Thu, Nov 4, 2010 at 12:48 PM, Alexis Cheng <acheng_1221 at hotmail.com> wrote:
>> Hi David,
>>
>> Just to clarify, are these 2 classes available right now or is there a
>> review process?
>>
>> Thanks,
>> Alexis Cheng
>> Electrical Engineering
>> University of British Columbia
>>
>>> From: david.gobbi at gmail.com
>>> Date: Thu, 4 Nov 2010 07:57:11 -0600
>>> Subject: Re: [vtkusers] vtkBlend Output
>>> To: acheng_1221 at hotmail.com
>>> CC: vtkusers at vtk.org
>>>
>>> I've just committed two new classes for generating stencils:
>>> 1) Imaging/vtkROIStencilSource - rectangles and ellipses
>>> 2) Imaging/vtkLassooStencilSource - polygons and splines
>>>
>>> David
>>>
>>> On Wed, Nov 3, 2010 at 8:52 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>>> > Hi Alexis,
>>> >
>>> > The PolyDataToImageStencil filter requires a closed 3D polydata
>>> > surface, like a box or a sphere.  It does not work with 2D contours.
>>> >
>>> > I have a "lassoo" class based on some of my old python code for doing
>>> > ROI stencils, but it is incomplete.  It would work like
>>> > ImplicitSelectionLoop for vtkImageStencilData, but a few hundred times
>>> > faster.  I'll take a look at it today to see how much work it would be
>>> > to finish it and contribute it to VTK.
>>> >
>>> >  David
>>> >
>>> > On Tue, Nov 2, 2010 at 6:07 PM, Alexis Cheng <acheng_1221 at hotmail.com>
>>> > wrote:
>>> >> 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
>>> >>> >
>>> >>> >
>>> >>
>>> >
>>
>> _______________________________________________
>> 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
>>
>>
> _______________________________________________
> 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