[Insight-users] Mean Curvature Calculation in Level Set

Sah Rayman sahrayman at yahoo . com
Thu, 20 Nov 2003 17:44:10 -0800 (PST)


Hi Lius,

Sorry I am still confused. 

First, I also don't use "neighborhood" or "offset" in
my implementation. 

If we take a look at itkLevelSetFunction.txx, Line
158-162:
template <class TImageType>
typename LevelSetFunction<TImageType>::ScalarValueType
LevelSetFunction<TImageType>::ComputeMeanCurvature(
  const NeighborhoodType &itkNotUsed(neighborhood),
  const FloatOffsetType &itkNotUsed(offset),
GlobalDataStruct *gd)
{ ...
}

Does it euqavalent to the following? (just replace
itkNotUsed(AnyThing) to EMPTY)
template <class TImageType>
typename LevelSetFunction<TImageType>::ScalarValueType
LevelSetFunction<TImageType>::ComputeMeanCurvature(
  const NeighborhoodType &,
  const FloatOffsetType &, GlobalDataStruct *gd)
{ ...
}

Is the above a leagal C++ function implementation?

Also, in the same file, function
ComputeCurvatureTerm() calls
ComputeMeanCurvature(neighborhood, offset, gd), then
where is it implemented?

I never used those "advanced" C++ feature before.
Sorry if it's a naive qustions.

Thanks.
Sah


--- Luis Ibanez <luis . ibanez at kitware . com> wrote:
> 
> Hi Sah,
> 
> The itkNotUse() macro was used to make some
> compilers
> happy and avoid the warnings for "non used variable"
> in the cases where the arguments were not used in a
> method.  This typically happens in virtual functions
> when in order to respect the API, a number of
> arguments
> are present, but not used inside the method.
> 
> If your implementation of the method is actually
> using
> the argument of the function, you must then remove
> the
> itkNotUse() macro, otherwise the argument is not
> declared
> at all.
> 
> The reason why there are not errors in
> itkLevelSetFunction
> is because the argument "neighbor" is not used in
> the
> ComputeMeanCurvature, so the signature could be as
> well:
> 
>     ComputeMeanCurvature( const NeighborhoodType & )
> 
> 
> 
> Regards,
> 
> 
> 
>    Luis
> 
> 
>
--------------------------------------------------------
> 
> Sah Rayman wrote:
> > A related question: when I implement
> > ComputeMeanCurvature() in class
> MyLevelSetFunction.txx
> > 
> > If I write as
> > ComputeMeanCurvature(const NeighborhoodType
> > &itkNotUse(neighborhood), ...)
> > as it is in itkLevelSetFunction.txx, I will get a
> lot
> > syntax error (VC 6.0), and I have to write as
> > ComputeMeanCurvature(const NeighborhoodType
> > &neighborhood, ...)
> > 
> > I checked the definition of itkNotUse(x), it is a
> > macro to nothing, (#define itkNotUse(x) )
> > 
> > Then how come in itkLevelSetFunction.txx there is
> no
> > syntax error?
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > --- Sah Rayman <sahrayman at yahoo . com> wrote:
> > 
> >>I am now 90% sure that this is a bug of
> >>itkLevelSetFunction.txx as of ITK 1.4.
> >>
> >>I rewrote my ComputeMeanCurvature() in my derived
> >>LevelSetFunction class, and the segmentation
> result
> >>makes more sense. 
> >>
> >>My fix:
> >>move line "curvature_term -= gd->m_dx[i] *
> >>gd->m_dx[j]
> >>* gd->m_dxy[i][j];"
> >>to the inner of "if( j!=i) ".
> >>
> >>Author of the file, if you're interested in more
> >>details, please write to me.
> >>
> >>
> >>
> >>--- Sah Rayman <sahrayman at yahoo . com> 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
> >>
> >>
> >>__________________________________
> >>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
> > 
> > 
> > 
> > __________________________________
> > 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/