[Insight-users] How to re-use a filter output?

Lemeur Yann Yann.Lemeur at stage.cnes.fr
Tue Jul 13 07:58:19 EDT 2004


Hi all!

I'm confronted to a problem with filters derived from itkProcessObject.
I've made my own filters (3 filters: A, B and C) which use some DataObjects I've also created.
In order to simplify the use of these filters, I've packed them in one filter called M.
In the GenerateData() of M, the three filters are executed to produce the output of M (this output is a Tree, a class I've made):

M::GenerateData()
{
		.....
		.....
		.....
		
typename TreeType::Pointer output= this->GetOutput();

A->SetInput(M->GetInput());
B->SetInput(A->GetOutput());
C->SetInput(B->GetOutput());

output=M->GetOutput();
C->Update();

this->SetNthOutput(0,output);

} // end of M::GenerateData()

In a main file, I've written:

TreeType::Pointer tree=M->GetOutput();
M->Update();

I've seen that the output var is ok after the C->Update() in the M::GenerateData() method. But in my main program, the pointer tree seems to be assigned to an empty Tree.

I think the problem is that the GetOutput() method return a raw pointer so the output var is not available outside the scope of GenerateData() (it might be deleted somewhere...).
So I can't produce the output of M!

Daes anybody know how to link the output of M whith the output of C, without copying the Tree objects (ie without making *output=*(C->GetOutput()) ) ?

Thanks.    



More information about the Insight-users mailing list