[Insight-users] Question concerning level set term.

Arnaud Gelas arnaudgelas at gmail.com
Mon Apr 2 03:23:59 EDT 2012


Hi,


On 04/01/2012 12:59 PM, tomtom wrote:
> Hello everyone,
>
> I am trying to implement an own level set term.
> The evolution equation that I have looks like: phi_t = A(x,y) * N,
> where A(x,y) is real and N is the inwards directed unit normal vector.

cool :)

>
> So, as far as I understood things, I can use the backwardGradient, which
> should be N, if I normalize it with its length.

You can, indeed, use backward gradient, forward...
>
> Is it right that the Value()-method should look like:
>
> ....Value(const LevelSetInputIndexType&  iP)
> {
> LevelSetOutputRealType outputValue = itk::NumericTraits<
> LevelSetOutputRealType>::Zero;
>
> LevelSetOutputRealType AValue = ComputeA(x,y);
>
> LevelSetGradientType backwardGradient =
> this->m_CurrentLevelSetPointer->EvaluateBackwardGradient( iP );
> double lengthBackwardGradient = ...;
>
> for(unsigned int dim = 0; dim<  ImageDimension; dim++)
> outputValue+=backwardGradient[dim] * AValue / lengthBackwardGradient;
>
> return outputValue;
> }
The code seems alright, but just make sure lengthBackwardGradient is non 
null...
>
> Or am I doing something wrong.

Here let me explain quickly how new term has to be implemented. I'll 
take your term as an example.

  * The first thing is to gather all characteristics you need from
    level-set functions, i.e. in your case you would only need the
    BackwardGradient.

  * In the constructor
      o you should first name your term as follows:

                     this->m_TermName = "My awesome term"; // it is 
useful if you want to access a term by its name in the term container

      o the list all the required characteristics you need from the
        level set

                     this->m_RequiredData.insert( "BackwardGradient" ); 
// This is mandatory!! In the term container (before computing any 
update) we first compute all required characteristics to avoid computing 
twice the same characteristic

  * Implement InitializeParameters (in case you want to cast your image A)
  * Your must implement Value( const LevelSetInputIndexType& iP, const
    LevelSetDataType& iData ). This method makes use of the required
    characteristics (and is used when evolving)
  * You can implement Value( const LevelSetInputIndexType& iP ); it is
    mainly for debugging / testing purpose to make sure the term value
    is as expected.

I invite you to have a look at itkLevelSetEquationPropagationTerm.hxx 
which implements a very close term to the one you are tying to implement.

Finally, I invite you to share with the rest of the community your new 
term by the means of an Insight Journal ;)

Best,
Arnaud

>
> Thanks for any remarks or hints.
>
>
>
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Question-concerning-level-set-term-tp7426557p7426557.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120402/3ebeb9d4/attachment.htm>


More information about the Insight-users mailing list