[vtkusers] Re: ReleaseDataFlagOn in VTK 5.0

Goodwin Lawlor goodwin.lawlor at ucd.ie
Thu Mar 16 12:26:07 EST 2006


Hi Stefanie,

Stefanie Nowak wrote:

> Hi Goodwin,
>
> thanks a lot for help.
> It is working with  filter->GetOutput()->SetGlobalReleaseDataFlag(1)
> I am using the new pipeline with SetInputConnection() and 
> GetOutputPort().

It might make a difference if you call filter1->ReleaseDataFlagOn() 
before you call filter2->SetInputConnection(filter1->GetOutputPort()) - 
maybe that's what you had already.

You may not want to release the data from all filters though... so the 
question still remains of how to free up just one filter.

>
> I thought that the ReleaseDatFlagOn() belongs to the old pipeline 
> because of these lines
> in class vtkAlgorithm.h and because it is not working in our 
> application with the new pipeline mechanism:
>
>
> //======================================================================
> 00285   //The following block of code is to support old style VTK 
> applications. If
> 00286   //you are using these calls there are better ways to do it in 
> the new
> 00287   //pipeline
> 00288   
> //======================================================================
> 00289   00291 00292   virtual void SetReleaseDataFlag(int);
> 00293   virtual int GetReleaseDataFlag();
> 00294   void ReleaseDataFlagOn();
> 00295   void ReleaseDataFlagOff();
> 00297 00298   
> //======================================================================== 
>
>
> Stefanie

I suppose by "better ways" the author meant finer control, ie, you can 
set  RELEASE_DATA() for each input port in the executive's info, rather 
than all input ports using the vtkAlgorithm methods above.

I still seems like this could be a bug- 
vtkAlgorithm::ReleaseDataFlagOn() doesn't seem to be doing what it should.

Perhaps, submit a bug to the tracker with some code to reproduce the 
problem.

Goodwin

>
>
>
>
> Goodwin Lawlor wrote:
>
>> Stefanie Nowak wrote:
>>
>>> Hallo,
>>>
>>> we recently updated our program from VTK 4.4 to VTK 5.0 and have 
>>> some problems with the new pipeline mechanism.
>>> In class vtkAlgorithm it is described that the methods 
>>> ReleaseDataFlagOn() and ReleaseDataFlagOff() belong to the old 
>>> pipeline.
>>> How is it possible to release memory in the new pipeline?
>>>
>>> Thanks a lot for help,
>>> Stefanie
>>
>>
>> Hi Stefanie,
>>
>> I can't find where in the (5.0) documentation is says that 
>> ReleaseDataFlagOn() belongs to the old pipeline. It just says that 
>> vtkAlgorithm::ReleaseDataFlagOn is now a convenience routine. It is 
>> equivalent to:
>>
>> vtkAlgorithm::GetExective()->GetOutputInformation(port)->Set(RELEASE_DATA(), 
>> 1)
>>
>> for each of the filter's output ports.
>>
>> vtkAlgorithm::GetExective()->SetReleaseDataFlag(port, 1)
>>
>> does the same thing.
>>
>> Looking at the source code (vtkDemandDrivenPipeline::ExecuteDataEnd) 
>> it looks like the input port information is checked for the 
>> RELEASE_DATA() flag (not the output port info which the above methods 
>> set) when deciding whether or not to release data (the 
>> GlobalReleaseDataFlag is checked too).
>>
>> So you could try:
>>
>> vtkDemandDrivenPipeline* ddp =
>>      vtkDemandDrivenPipeline::SafeDownCast(filter->GetExecutive());
>> ddp->GetInputInformation(port)->Set(RELEASE_DATA(),1);
>>
>> or
>>
>> filter->GetOutput()->SetGlobalReleaseDataFlag(1);
>>
>>
>> It seems that info gets copied between output and input ports when 
>> they are connected... but only when the 
>> filter2->SetInputConnection(filter1->GetOutputPort()) methods are 
>> used. Are you still using the old 
>> filter2->SetInput(filter1->GetOutput())? This could be the problem...
>>
>>
>> hth
>>
>> Goodwin
>>
>>
>> _______________________________________________
>> This is the private VTK discussion list. Please keep messages 
>> on-topic. Check the 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