[vtkusers] deallocating objects within functions

Adrian Albert a.albert at jacobs-university.de
Tue Apr 22 18:32:21 EDT 2008


Dear All,

I have a small problem in vtk: I have a class (not derived from any VTK
object) that has methods for dealing with vtkImageData in various ways. For
example, I am extracting one scalar component from a multi-component
vtkImageData object using this function

vtkStructuredPoints* GetField (int index)
{
    vtkImageExtractComponents *extr = vtkImageExtractComponents::New ();
    extr->SetInput (this->GetInputField ());
    extr->SetComponents (index);
    extr->Update ();
    return (vtkStructuredPoints*) (extr->GetOutput ());
}

I am wondering if there is a problem with deallocating the *extr* object in
the above function. I obviously cannot manually call Delete () on it, since
I must use it for returning my output. Is the Delete () method automatically
called when returning from the function to the calling routine? How 'big' is
the extr object? Is it of the same size as the input to the
vtkImageExtractComponents filter?

Thanks for taking the pain in reading this!
Adrian
-- 
---------------------------------------------------
Adrian Albert
School of Engineering and Science
Jacobs University Bremen
Germany
Tel.: 00494212003258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080423/78c029b2/attachment-0001.htm>


More information about the vtkusers mailing list