[Insight-developers] OrientedImage and gradient calculations
Peter Cech
pcech at vision.ee.ethz.ch
Fri Mar 17 11:29:22 EST 2006
On Fri, Mar 17, 2006 at 09:49:17 -0500, Miller, James V (GE, Research) wrote:
> Dan Blezek stumbled across the following problem:
>
> In the registration framework, the metrics use the image gradient in the calculation of the derivative of the metric wrt to the parameters of the transformation. The image gradients are calculated taking into account the image spacing to provide a gradient in physical space.
>
> When an OrientedImage is used, these gradient calculations are not truly in physical space since gradients are not reoriented into the physical coordinate frame. This affects the registration because the mapping of positions does take into account orientation but the image gradients, and hence the derivative of the metric wrt the parameters, does not. In Dan's test case, when the derivative of the metric should force the transformation to move the image up, it ends up moving the image down.
>
> One solution would be to add methods to image like:
>
> template<class TCoordRep>
> void TransformIndexGradientToPhysicalGradient(
> const IndexType & index,
> CovariantVector<TCoordRep, VImageDimension>& gradient) const
>
> which would convert a gradient computed in index space (without taking into account spacing or orientation) to a gradient computed in physical space.
>
> In Image, this method would merely apply the spacing scale factors. In OrientedImage, this method would apply the spacing scale factors and the orientation matrix. Anywhere gradients are calculated, we would have to make an extra function call to convert the gradients into physical space.
>
> We may also need methods for transforming higher order derivatives (and cross-derivatives).
Definitely. I just realized, that I recently witnessed the behavior when
displaying eigenvectors of hessian. I thought it was off because the
scale did not fit well for the structure...
> Alternatively, wherever gradients are calculated, we could check whether we are operating on an Image or an OrientedImage and reorient the gradients as necessary there.
If we stay consistent with current Index to Point behavior (1) of Image,
a simple pass-through implementation will do.
(1) It assumes origin is in the same orientation as the Image.
Regards,
Peter
More information about the Insight-developers
mailing list