[Insight-users] ImageGaussianModelEstimator, possible bug
Daniel Mace
dlm19 at duke.edu
Mon May 7 11:24:31 EDT 2007
All,
I've been working with the ImageGaussianModelEstimator in conjunction
with the MRF label model for segementation. However, I kept getting
runtime errors while running the ImageGaussianModelEstimator with my
training image. In my particular case, I was trying to segment 2
objects (basically the background and the object of interest). I set my
Number of classes to two and had my label image with these two classes
demarked (1 for the background, 2 for the object). This is where I ran
into the problem. According to the EstimateGaussianModelParameters() it
comments that it expects the label image to be labeled 1,2, N (where n
is the number of classes), while the memory references be labeled from
0, 1,..., n - 1. However, there doesn't seem to be a correction for the
label index to the correct memory reference. As such, it tries to
reference the n+1 unit of the array and throws an error. At the same
time, however, it doesn't allow you to just rewrite your label image
from 0,1, ... n -1 units as line 219 does not allow labels of 0:
----------------------
if(classIndex > 0)
----------------------
The quick workaround I have done is to decrement the classIndex variable
by one and rewrite the above line as
---------------------
if(classIndex >= 0)
---------------------
as well as line 214:
------------------------
if( classIndex > numberOfModels )
-------------------------
to
------------------------
if( classIndex >= numberOfModels )
-------------------------
However, I'm not sure if this was the intended purpose of the labeling.
Cheers,
Dan
More information about the Insight-users
mailing list