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

M.Staring at lumc.nl M.Staring at lumc.nl
Mon Oct 12 07:30:31 EDT 2009


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
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091012/9c60a9de/attachment.htm>


More information about the Insight-developers mailing list