[Insight-developers] possible bug in BSplineInterpolateImageFunction->SetInputImage

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 12 18:12:59 EDT 2009


Hi Marius,

Thanks for pointing this out.

Your analysis makes sense.

Just setting the m_Coefficients pointer to NULL, will
not result in the deallocation of the m_CoefficientsFilter
output.

Your suggested fix looks right,

Please go ahead and (at your convenience) submit
an Experimental build, and if Green, then commit the
change to the repository.


     Thanks


           Luis


-----------------------------------------------------------------------
On Mon, Oct 12, 2009 at 7:30 AM,  <M.Staring at lumc.nl> wrote:
> Hi all,
>
> The SetInputImage() fucntion of the class BSplineInterpolateImageFunction is
> as follows:
>
> if ( inputData )
> {
>   ....
> }
> else
> {
>   m_Coefficients = NULL;
> }
>
> Suppose SetInputImage was previously called with some large moving image (in
> the registration framework).
>
> When SetInputImage is called as SetInputImage(0), the m_Coefficients is set
> to NULL in the else. However, this does not result in a deletion of the
> data, since the reference count is 2: 1 for the
> BSplineInterpolateImageFunction, but also an additional 1 for the
> m_CoefficientFilter of type BSplineDecompositionImageFilter which stores a
> reference to m_Coefficients.
>
> As I would interprete calling SetInputImage(0) as a request for deleting the
> data m_Coefficients (which can be really large, since it is a double image
> the size of the moving image), I would suggest to change the implementation
> to:
>
> if ( inputData )
> {
>   ....
> }
> else
> {
>   m_CoefficientFilter->GetOutput()->DisconnectPipeline();
>   m_Coefficients = NULL;
> }
>
> Is my interpretation correct?
>
> If you think so I can submit an experimental build and commit this cange to
> the repository.
>
> With kind regards,
>
> Marius
>
>
>
> Marius Staring, PhD
> Division of Image Processing (LKEB)
> Department of Radiology
> Leiden University Medical Center
> PO Box 9600, 2300 RC Leiden, The Netherlands
> phone: +31 (0)71 526 1106, fax: +31 (0)71 526 6801
> m.staring at lumc.nl
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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-developers
>
>


More information about the Insight-developers mailing list