[Insight-users] ImageMaskSpatialObject

Dan Mueller dan.muel at gmail.com
Wed Dec 10 00:23:49 EST 2008


Hi Brady,

I had a quick look at your code and there are a number of issues.

1. When you call SetImage(..) on the image mask spatial object, the
output from the fast marching filter has not yet been created.
Therefore the mask image being set is of size [0, 0]. Any subsequent
calls to IsInside(..) return false because the point is always outside
the bounding region. To fix this, update the binary threshold filter
*before* calling imso->SetImage( btf->GetOutput() ).

2. With the above issue resolved, we start getting some meaningful
values from calls to IsInside(..).

Is [50, 50] inside? 0
Is [1, 1] inside? 1
Is [10, 10] inside? 1
Is [35, 35] inside? 0
Is [0, 0] inside? 1

The only problem is these results are not what you are expect, but I
believe they are correct. The output of the fast marching is a signed
distance function with value -30 at [50, 50] and expanding positively
outwards. When you perform the lower threshold, you are creating an
image with 0 inside the circle, and 1 outside. All the returned values
are correct in this situation.

However, I think you want to create a circle centered at [50, 50] (not
the inverse of a circle) so instead of
  btf->SetLowerThreshold(0.0);
use
  btf->SetUpperThreshold(0.0);

This now yields:

Is [50, 50] inside? 1
Is [1, 1] inside? 0
Is [10, 10] inside? 0
Is [35, 35] inside? 1
Is [0, 0] inside? 0

which I think is (closer to) what you expect. By my reasoning [1, 1],
[10, 10], and [0, 0] are outside of a circle with radius 30 centered
at [50, 50], while [50, 50] and [35, 35] are inside.

HTH

Regards, Dan

2008/12/9 Brady McCary <brady.mccary+ITK at gmail.com>:
> Insight-users,
>
> I am attempting to use the class itk::ImageMaskSpatialObject and I am
> seeing unexpected results. I have make a small test program which
> demonstrates and discusses the observed behavior and expected
> behavior.
>
> Thanks!
>
> Brady
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list