[Insight-developers] Change of behavior
Tom Vercauteren
tom.vercauteren at gmail.com
Wed Aug 12 04:12:20 EDT 2009
Hi Hans,
Plese find some comments below.
> A new boolean variable was introduced to the code on 2009-07-28 in the class
> called: m_UseFixedImageMask
>
> This variable is used to determine if fixed image mask processing should be
> done. In the past (and in the non-optimized version), fixed image mask
> processing was contingent only upon the existence of a mask object.
There is at least some use cases where having a fixed image mask does
not mean it has to be necessarily used within the metric computation.
Here is one:
* The caller sets a fixed image mask
* The caller asks to use only a subset of the fixed image indexes
(e.g. take 20% at random)
* The metric object generates the fixed image indexes to be used. Of
course, only non-masked indexes are generated
* The metric object computes the metric value based on the fixed image
indexes. There is no need to check whether the indexes are within the
mask since they have been designed this way.
In this case it makes sense to me to have a non null fixed image mask
and a boolean flag m_UseFixedImageMask set to false.
> This new version of the code now requires that you first set the mask, and
> then indicate that you want to use the mask.
I don't understand why the caller could have access to setting this
boolean flag. I believe it should strictly be computed by the object
based on the scenario at hand.
> It is also possible to set the
>
> m_FixedImageMask to some real mask object, then set m_UseFixedImageMask to
> true,
> and subsequently set m_FixedImageMask back to NULL. This scenerio would
> cause the following bit of code to fail.
>
> if( m_UseFixedImageMask )
> {
> double val;
> if( m_FixedImageMask->ValueAt( inputPoint, val ) )
> {
This should indeed be fixed.
> I’ve removed all references to m_UseFixedImageMask and replaced it with the
> previous logical equivalent:
>
> < if( m_UseFixedImageMask )
> ---
>> if( m_FixedImageMask.IsNotNull() )
>
> This fixed all the failing cases in my code, and all the ITK test cases
> still pass.
I am not sure this is the best fix since it imposes some unnecessary
computations in the use case I mentioned. It thus goes against the
purpose of the optimized image metric.
My two cents,
Tom
More information about the Insight-developers
mailing list