[Insight-developers] Image-based cost function
Dan Mueller
d.mueller at qut.edu.au
Sun Jul 8 18:27:39 EDT 2007
Hi,
I am developing a simple cost function which computes the value and
derivative by interpolating a single underlying image (I have been
unable to find an existing class which achieves this). For the
GetValue() method, I have followed the ImageToImageMetric and defined an
InterpolatorType and Get/SetInterpolator methods (allowing the user to
define the interpolation method at run-time).
I wish to do something similar for the GetDerivative() method, but the
gradient image functions (eg. CentralDifferenceImageFunction and
GaussianDerivativeImageFunction) do not share a common base class
(except for ImageFunction which lacks the overriden output type). The
output types for these two functions are different (Vector for
GaussianDerivativeImageFunction and CovariantVector for
CentralDifferenceImageFunction).
*My first question:* Why are the output types different for these two
functions? I would have thought they compute similar information and
would therefore have the same output type.
I assume (I have not tried this yet so I could be wrong) that if these
two functions had the /same/ output type (ie. both Vector or both
CovariantVector) then I could define a GradientImageFunctionType in my
cost function similar to below:
typedef Vector< CoordRepType, ImageDimension > GradientOutputType;
typedef ImageFunction< GradientOutputType, CoordRepType >
GradientImageFunctionType;
itkSetObjectMacro( GradientImageFunction, GradientImageFunctionType );
itkGetConstObjectMacro( GradientImageFunction, GradientImageFunctionType );
The user would then be able to specify the gradient image function at
run-time (which offers more control than using an explicitly typed
function). At present, the only way of achieving this is to template the
cost function over the GradientImageFunctionType, which is not very nice
for wrapping.
*My second question:* If there is no good reason for these functions to
have different output types, is it possible to change the output types
to be the same? Do I submit a bug to request this? Furthermore, is there
some merit in creating a base GradientImageFunction class from which
these (and any other) image functions derive?
Thanks for your help.
Cheers, Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20070709/2e1c3296/attachment.html
More information about the Insight-developers
mailing list