[Insight-users] Mean Curvature Calculation in Level Set
Joshua Cates
cates at sci . utah . edu
Fri, 21 Nov 2003 11:51:25 -0700 (MST)
Hi Sah,
Yes you are correct. This is a bug introduced during some refactoring of
the code right before release 1.4. I have a fix that I will check in to
the repository today.
thanks,
Josh.
______________________________
Josh Cates
Scientific Computing and Imaging Institute
University of Utah
Email: cates at sci . utah . edu
Phone: (801) 587-7697
URL: http://www . sci . utah . edu/~cates
On Thu, 20 Nov 2003, Sah Rayman wrote:
> Hi Josh,
>
> In itkLevelSetFunction.txx, Line 158-184 are:
>
> template <class TImageType>
> typename LevelSetFunction<TImageType>::ScalarValueType
> LevelSetFunction<TImageType>::ComputeMeanCurvature(
> const NeighborhoodType &itkNotUsed(neighborhood),
> const FloatOffsetType &itkNotUsed(offset),
> GlobalDataStruct *gd)
> {
> // Calculate the mean curvature
> ScalarValueType curvature_term =
> NumericTraits<ScalarValueType>::Zero;
> unsigned int i, j;
>
>
> for (i = 0; i < ImageDimension; i++)
> {
> for(j = 0; j < ImageDimension; j++)
> {
> curvature_term -= gd->m_dx[i] * gd->m_dx[j] *
> gd->m_dxy[i][j];
>
> if(j != i)
> {
> curvature_term += gd->m_dxy[j][j] *
> gd->m_dx[i] * gd->m_dx[i];
> }
> }
> }
>
> return (curvature_term / gd->m_GradMagSqr );
> }
>
> Let's say ImageDimension==2,
> Then before divided by gd->m_GradMagSqr:
>
> curvature_term =
> -dx[0]*dx[0]*dxy[0][0]
> -dx[0]*dx[1]*dxy[0][1] + dx[0]*dx[0]*dxy[1][1]
> -dx[1]*dx[0]*dxy[1][0] + dx[1]*dx[1]*dxy[0][0]
> -dx[1]*dx[1]*dxy[1][1]
>
> According to Sethian's equation, the result should
> just be:
>
> curvature_term =
> -dx[0]*dx[1]*dxy[0][1] + dx[0]*dx[0]*dxy[1][1]
> -dx[1]*dx[0]*dxy[1][0] + dx[1]*dx[1]*dxy[0][0]
>
>
> Please confirm if that is the case for you.
>
> Thanks.
> Sah
>
> --- Joshua Cates <cates at sci . utah . edu> wrote:
> > Hello Sah,
> >
> > The default curvature calculation in the Level Set
> > function is mean
> > curvature. I cannot find the line of code that you
> > reference. Look in
> > the file itkLevelSetFunction.txx, method
> > ComputeMeanCurvature(). The
> > terms for the calculation come from the precomputed
> > Hessian matrix.
> >
> > Josh.
> >
> > ______________________________
> > Josh Cates
> > Scientific Computing and Imaging Institute
> > University of Utah
> > Email: cates at sci . utah . edu
> > Phone: (801) 587-7697
> > URL: http://www . sci . utah . edu/~cates
> >
> >
> > On Fri, 14 Nov 2003, Sah Rayman wrote:
> >
> > > I am looking at function:
> > >
> > > template <class TImageType>
> > > typename
> > LevelSetFunction<TImageType>::ScalarValueType
> > >
> > LevelSetFunction<TImageType>::ComputeMeanCurvature()
> > >
> > > in itkLevelSetFunction.txx, line 158 (ITK 1.4)
> > >
> > > When I compared that to Sethian's "Level Set
> > Methods
> > > and Fast Marching Methods", 2ndEd, pp. 70, Eq.
> > 6.36, I
> > > found that the C++ implementation contain some
> > extra
> > > terms in nominator:
> > >
> > > -dx[0]*dx[0]*dxy[0][0]-dx[1]*dx[1]*dxy[1][1]-...
> > >
> > > Can someone tell me what are these additional
> > terms
> > > for? Is the result still mean curvature? Any
> > reference
> > > for that?
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Protect your identity with Yahoo! Mail
> > AddressGuard
> > > http://antispam . yahoo . com/whatsnewfree
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk . org
> > > http://www . itk . org/mailman/listinfo/insight-users
> > >
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk . org
> > http://www . itk . org/mailman/listinfo/insight-users
>
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion . yahoo . com/
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>