[Insight-developers] Removal of itkWarpJacobianDeterminantFilter.h
Johnson, Hans
hans-johnson at uiowa.edu
Thu Jul 10 21:29:10 EDT 2008
Luis,
I see that you are adding the Diffeomorphic Demons to ITK Review. GREAT!
I¹ve been working with that code for a few months now, and it really is a
nice addition to ITK.
I was reviewing the code in itkWarpJacobianDeterminantFilter.h, and
comparing it against itkDeformationFieldJacobianDeterminantFilter.h It
seems that all the functionality of the WarpJacobianDeterminant can be added
to the DeformationFieldJacobianDeterminant with little effort. I¹ve
attached my local copies that have the necessary changes (it passes
regression test for being backwards compatible, and it address the comment
in itkDeformationFieldJacobianDeterminantFilter.
NOTE 1: itkWarpJacobianDeterminant and
itkDeformationFieldJacobianDeterminant have different template
parameterization, but this seems to be a style choice.
NOTE 2: I¹ve added another private member variable to precompute the
0.5*weightings. This is not a necessary change for getting the new
functionality.
I¹d like to know your thoughts if this seems like a reasonable change. If
you agree, I will work through committing the enhanced version of
itkDeformationFieldJacobianDeterminant, and removing the
itkWarpJacobianDeterminantFilter from itk Review.
Thanks,
Hans
===== Patch ===
Index: itkDeformationFieldJacobianDeterminantFilter.h
===================================================================
RCS file:
/cvsroot/Insight/Insight/Code/BasicFilters/itkDeformationFieldJacobianDeterm
inantFilter.h,v
retrieving revision 1.3
diff -b -r1.3 itkDeformationFieldJacobianDeterminantFilter.h
6c6
< Date: $Date: 2005-08-24 18:00:04 $
---
> Date: $Date: 2005/08/24 18:00:04 $
42,44c42,44
< * should be 1.0. In general, in order to obtain the effective deformation
< * Jacobian determinant, 1.0 must be added to each Jacobian value in the
< * output.
---
> * is 1.0. In order to compute the effective deformation Jacobian determinant
> * 1.0 must be added to the diagonal elements of Jacobian prior to taking the
derivative.
> * i.e. det([ (1.0+dx/dx) dx/dy dx/dz ; dy/dx (1.0+dy/dy) dy/dz; dz/dx dz/dy
(1.0+dz/dz) ])
240d239
< unsigned i, j;
243c242
< for (i = 0; i < ImageDimension; ++i)
---
> for (unsigned int i = 0; i < ImageDimension; ++i)
245c244
< for (j = 0; j < VectorDimension; ++j)
---
> for (unsigned int j = 0; j < VectorDimension; ++j)
247,248c246
< J[i][j] = m_DerivativeWeights[i]
< * 0.5 * (it.GetNext(i)[j] - it.GetPrevious(i)[j]);
---
> J[i][j] = m_HalfDerivativeWeights[i] * (it.GetNext(i)[j] -
it.GetPrevious(i)[j]);
249a248,251
> if(m_GenerateEffectiveJacobianDeterminant)
> {
> // add one on the diagonal to consider the warping and not only the
deformation field
> J[i][i] += 1.0;
251,252c253,255
<
< return vnl_det(J);
---
> }
> const TRealType value=vnl_det(J);
> return value;
256a260,261
> /** Pre-compute 0.5*m_DerivativeWeights since that is the only thing used in
the computations. */
> TRealType
m_HalfDerivativeWeights[itk::GetImageDimension<TInputImage>::ImageDimension];
267a273
> bool m_GenerateEffectiveJacobianDeterminant;
Index: itkDeformationFieldJacobianDeterminantFilter.txx
===================================================================
RCS file:
/cvsroot/Insight/Insight/Code/BasicFilters/itkDeformationFieldJacobianDeterm
inantFilter.txx,v
retrieving revision 1.3
diff -b -r1.3 itkDeformationFieldJacobianDeterminantFilter.txx
6c6
< Date: $Date: 2006-01-11 19:43:31 $
---
> Date: $Date: 2006/01/11 19:43:31 $
37d36
< unsigned int i;
40c39
< for (i = 0; i < ImageDimension; i++)
---
> for (unsigned int i = 0; i < ImageDimension; i++)
43a43
> m_HalfDerivativeWeights[i] = static_cast<TRealType>(0.5);
44a45
> m_GenerateEffectiveJacobianDeterminant=false;//Needs to be false for
backwards compatibility;
58a60
> m_HalfDerivativeWeights[i] = 0.5*data[i];
79a82
> m_HalfDerivativeWeights[i] = static_cast<TRealType>(0.5);
156a160
> m_HalfDerivativeWeights[i]=0.5*m_DerivativeWeights[i];
240a245,248
> os << indent << "m_HalfDerivativeWeights = ";
> for (i = 0; i < ImageDimension; i++)
> { os << m_HalfDerivativeWeights[i] << " "; }
> os << std::endl;
244a253,254
> os << indent << "m_GenerateEffectiveJacobianDeterminant = " <<
m_GenerateEffectiveJacobianDeterminant
> << std::endl;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20080710/1da93422/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkDeformationFieldJacobianDeterminantFilter.h
Type: application/octet-stream
Size: 12059 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20080710/1da93422/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itkDeformationFieldJacobianDeterminantFilter.txx
Type: application/octet-stream
Size: 9171 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20080710/1da93422/attachment-0001.obj>
More information about the Insight-developers
mailing list