[Insight-users] Smart pointer to filter output

Luis Ibanez luis.ibanez at kitware.com
Sun Nov 22 16:11:09 EST 2009


Hi Gerald,

by "doesn't work", what do you mean ?

   1) It does not compile ?
   2) It compiles but seg. faults at run time ?
   3) It throws an exception at run time ?
   4) It returns a null pointer at run time ?


The design of your method is strange.


You probably should have done:

 m_TargetConnector= SourceConnectorType::New();

inside the constructor of your class,

and the setSourceImage() should only
have the  lines:

> void setSourceImage(vtkImageData* image)
> {
>        m_TargetConnector->SetInput(image);
> }


Why is that there is no call to the Update() method ?

You don't seem to have a line like:

            m_TargetConnector->Update();


   Please let us know,


        Thanks


             Luis



-----------------------------------------------------------------------------------
On Tue, Nov 17, 2009 at 10:26 AM, Lodron, Gerald
<Gerald.Lodron at joanneum.at> wrote:
> Hello
>
> How can I make a smart pointer to my filter output, here my code:
>
> Class parameters (TargetImageType is a template parameter):
>
> typedef typename itk::VTKImageToImageFilter<TargetImageType> TargetConnectorType;
>
> typename TargetImageType::Pointer m_TargetImage;
> typename TargetConnectorType::Pointer m_TargetConnector;
>
> Function:
>
> void setSourceImage(vtkImageData* image)
> {
>        m_TargetConnector= SourceConnectorType::New();
>        m_TargetConnector->SetInput(image);
>        m_TargetImage= m_TargetConnector->GetOutput(); //does not work
> }
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list