[vtkusers] Using vtkLassooStencilSource

Alexis Cheng acheng_1221 at hotmail.com
Mon Nov 8 14:31:52 EST 2010


Hi David,

I tested each of the 3 classes that you fixed: vtkImplicitFunctionToImageStencil, vtkLassooStencilSource, vtkROIStencilSource

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

        vtkSmartPointer<vtkImplicitFunctionToImageStencil> dataToStencil = vtkSmartPointer<vtkImplicitFunctionToImageStencil>::New();
        dataToStencil->SetInput(ImplicitLoop);
        
        
        vtkSmartPointer<vtkLassooStencilSource> LassooStencil = vtkSmartPointer<vtkLassooStencilSource>::New();
        LassooStencil->SetPoints(points);
        LassooStencil->SetInformationInput(MTImage);

        vtkSmartPointer<vtkROIStencilSource> ROIStencil = vtkSmartPointer<vtkROIStencilSource>::New();
        ROIStencil->SetInformationInput(MTImage);
        ROIStencil->SetBounds(100,200,100,200,0,1);

None of them show the memory leak behaviour that I saw earlier. They display the stencil at the specified position. vtkLassooStencilSource and vtkROIStencilSource also run many times faster than vtkImplicitFunctionToImageStencil as expected. Is there anything else with these classes that you'd like specifically tested?

Thanks,
Alexis Cheng
Electrical Engineering
University of British Columbia

> From: david.gobbi at gmail.com
> Date: Mon, 8 Nov 2010 08:33:20 -0700
> Subject: Re: [vtkusers] Using vtkLassooStencilSource
> To: acheng_1221 at hotmail.com
> CC: vtkusers at vtk.org
> 
> You can ignore my last email.  I found the memory leak in
> vtkLassooStencilSource and fixed it:
> http://vtk.org/gitweb?p=VTK.git;a=commit;h=df58dd14
> 
>   David
> 
> 
> On Sat, Nov 6, 2010 at 11:38 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> > About the memory, the vtkLassooStencilSource::SetInformationInput()
> > method might leak, I'm not 100% sure but I'm investigating it.  If the
> > size and voxel spacing of your images never change, you can get rid of
> > SetInformationInput() and use these on the LassooStencil instead:
> >
> > SetOutputSpacing();
> > SetOutputOrigin();
> > SetOutputWholeExtent();
> >
> > Hopefully I'll have a definite answer soon about whether the new class
> > is leaking.
> >
> >  David
> >
> > On Sat, Nov 6, 2010 at 4:40 PM, Alexis Cheng <acheng_1221 at hotmail.com> wrote:
> >> Hi David,
> >>
> >> Thanks for making these classes, I'll try out vtkROIStencilSource after I
> >> fix this error. I must have accidentally left out the end of the error
> >> message:
> >>
> >> ERROR: In ..\..\VTK\Common\vtkMultiThreader.cxx, line 285
> >>  vtkMultiThreader [605C96A0]: Error in thread creation !!!
> >>
> >> Looking at the windows task manager, it seems like my physical memory is
> >> decreasing at a constant rate until the error occurs. I suspect that there
> >> is likely a memory leak in my code somewhere. I assume that should also
> >> account for the thread creation error.
> >>
> >> Many Thanks,
> >> Alexis Cheng
> >> Electrical Engineering
> >> University of British Columbia
> >>
> >>
> >>
> >>
> >>
> >>> From: david.gobbi at gmail.com
> >>> Date: Sat, 6 Nov 2010 16:09:06 -0600
> >>> Subject: Re: [vtkusers] Using vtkLassooStencilSource
> >>> To: acheng_1221 at hotmail.com
> >>> CC: vtkusers at vtk.org
> >>>
> >>> Hi Alexis,
> >>>
> >>> Thanks for trying this out. Your code for using the class is correct.
> >>>
> >>> For the first message, the one vtkMultiThreader.cxx, does it give any
> >>> sort of error info?
> >>>
> >>> The second error about memory allocation is a strange one, it is
> >>> complaining about allocating 1231041 bytes which is only about the
> >>> size of one video frame. Try using the Windows Task Manager to see
> >>> how your computer's memory use increases when you run your
> >>> application.
> >>>
> >>> About Slicer, yes you generally should rebuild after updating VTK. To
> >>> be more specific, it is only certain changes to the VTK header files
> >>> that will make a rebuild necessary, but better safe than sorry.
> >>>
> >>> David
> >>>
> >>>
> >>> On Sat, Nov 6, 2010 at 3:11 PM, Alexis Cheng <acheng_1221 at hotmail.com>
> >>> wrote:
> >>> > Hi David,
> >>> >
> >>> > I can certainly provide an informal review of vtkLassooStencilSource and
> >>> > vtkROIStencilSource, but first, I'm receiving an odd error during
> >>> > runtime.
> >>> >
> >>> > I'm using vtkLassooStencilSource and generating the stencil like this:
> >>> >
> >>> >         vtkSmartPointer<vtkLassooStencilSource> LassooStencil =
> >>> > vtkSmartPointer<vtkLassooStencilSource>::New();
> >>> >         LassooStencil->SetPoints(points);
> >>> >         LassooStencil->SetInformationInput(MTImage);
> >>> >
> >>> >         vtkSmartPointer<vtkImageBlend> blend1 =
> >>> > vtkSmartPointer<vtkImageBlend>::New();
> >>> >         blend1->SetStencil(LassooStencil->GetOutput());
> >>> >         blend1->AddInput(MTImage);
> >>> >         blend1->AddInput(BlackImage);
> >>> >
> >>> > I'm interfacing with 3D Slicer and can see the stencil within my image.
> >>> > It's
> >>> > also running many times faster than when I generated the stencil using
> >>> > vtkImplicitFunctionToStencilData. However, after several minutes, a
> >>> > vtkOutputWindow pops up indicating:
> >>> >
> >>> > ERROR: In ..\..\VTK\Common\vtkMultiThreader.cxx, line 285
> >>> > vtkMultiThreader [605C96A0]
> >>> >
> >>> > The above message is repeated a number of times before ending with:
> >>> >
> >>> > ERROR: In c:\sliver3-lib\vtk\common\vtkDataArrayTemplate.txx, line 142
> >>> > vtkUnsignedCharArray [605D3490]: Unable to allocate 1231041 elements of
> >>> > (The
> >>> > rest of the message is out of view of the window)
> >>> >
> >>> > This did not occur with vtkImplicitFunctionToStencilData. Do you have
> >>> > any
> >>> > idea if this error is related to these new classes? Also, do I have to
> >>> > rebuild Slicer every time I modify the VTK package?
> >>> >
> >>> > Thanks,
> >>> > 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/20101108/f45bf54e/attachment.htm>


More information about the vtkusers mailing list