[Insight-users] How to re-use a filter output?
Luis Ibanez
luis.ibanez at kitware.com
Tue Jul 13 16:19:39 EDT 2004
Hi Lemeur,
When you create a filter with a mini-pipeline inside
You should use GraftOutput() in order to take the output
image of your mini-pipeline and graft it as the output of
your own filter.
For an example, you may want to look a the files
Insight/Code/BasicFilter/
itkSmoothingRecursiveGaussianImageFilter.txx
In your code it will be something like
this->GraftOutput( M->GetOutput() );
instead of
this->SetNthOutput( output ).
Regards,
Luis,
------------------
Lemeur Yann wrote:
> 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.
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list