[vtk-developers] (no subject)

Charles Law charles.law at kitware.com
Mon Mar 25 14:46:23 EST 2002


Try copying (ShallowCopy) the input before you use it as input to the 
transform filter.

vtkPolyData *tmp = vtkPolyData::New();
tmp->ShallowCopy(this->GetInput());

...

trans->SetInput(tmp);

...


At 05:16 PM 3/25/2002 +0000, Tim Hutton wrote:
>Maybe this is more an issue for developers, apologies for the cross-posting.
>
>I'm confused about the ReleaseDataFlag. A couple of my own filters were 
>using a lot of memory, so I called 
>vtkDataObject::SetGlobalReleaseDataFlag(1) to try to release memory from 
>earlier in the pipeline that was no longer needed. This works 
>spectacularly for one of them, everything was fine. For the other, 
>however, I got problems because towards the end of the Execute() function 
>the data in this->GetInput() had been released and had gone! I think the 
>problem is captured in this sketch:
>
>void MyFilter::Execute()
>{
>
>...
>
>this->GetInput()->GetCell(id); // fine, since data not released
>
>...
>
>vtkTransformPolyDataFilter trans
>trans->SetInput(this->GetInput());
>
>...
>
>trans->Update();
>
>... // use output of trans
>
>this->GetInput()->GetCell(id); // ERROR! data has been released!
>
>}
>
>When trans has finished, it checks to see if it can release its data. The 
>global flag says yes, so it releases this->GetInput() which is disastrous.
>
>How do I stop the data being released mid-Execute? Using 
>ReleaseDataFlagOff() calls doesn't work because the global flag overrides 
>them! (see vtkDataObject::ShouldIReleaseData)
>
>I'm using the latest CVS of VTK4 on win2k with visualc++6.
>
>Thanks,
>
>Tim.
>---------------------------------------------------------------------------
>Tim Hutton,                        http://www.eastman.ucl.ac.uk/~dmi/MINORI
>Research Fellow & PhD student,                   T.Hutton at eastman.ucl.ac.uk
>MINORI Project, Biomedical Informatics Unit,     Tel: [+44] (0)20 7915 2344
>Eastman Dental Institute, UCL,                   Fax: [+44] (0)20 7915 2303
>256 Gray's Inn Road, London WC1X 8LD, UK      Mobile: [+44] (0)7748 678 832
>---------------------------------------------------------------------------
>This email represents the views of the sender alone and must not be 
>construed as representing the views of the Eastman Dental Institute. It 
>may contain confidential information and may be protected by law as a 
>legally privileged document and copyright work. Its content should not be 
>disclosed and it should not be given or copied to anyone other than the 
>person(s) named or referenced above. If you have received this email in 
>error, please contact the sender.
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list