[Insight-developers] BSplineInterpolateImageFunction

Lydia Ng lng at insightful . com
Thu, 18 Dec 2003 16:09:28 -0800


Question: if I make these member data and mutable does that mean one =
can't
use the same interpolator in different threads of a filter?

In the past we had several discussions of const-ness and thread safety
regarding the interpolators. To make everyone happy - the function is =
both
const and thread safe - the lowest common denominator even though it is =
at
the expense of dynamic memory allocation.

Perhaps we need to make some of sort of community decision of what =
objects
and what methods need const and/or thread safe.

- Lydia

> -----Original Message-----
> From: Brad King [mailto:brad . king at kitware . com]
> Sent: Thursday, December 18, 2003 1:40 PM
> To: Insight Developers
> Subject: [Insight-developers] BSplineInterpolateImageFunction
>=20
> Hello,
>=20
> While tracking down a recent test failure, I noticed that
> BSplineInterpolateImageFunction has vnl_matrix local variables in its
> EvaluateAtContinuousIndex and EvaluateDerivativeAtContinuousIndex =
methods.
> When used in a registration method, this effectively does a dynamic =
memory
> allocation and free per pixel!
>=20
> I think these variables should be changed to member data for the =
class.
> Since EvaluateAtContinuousIndex and =
EvaluateDerivativeAtContinuousIndex
> are const methods, the matrices will have to be mutable (whether these
> methods should be const is a separate discussion).  I expect a =
substantial
> speed improvement will be achieved by this relatively simple change.
>=20
> Will the author of this class please look at making the change?
>=20
> Thanks,
> -Brad
>=20
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk . org
> http://www . itk . org/mailman/listinfo/insight-developers