[Insight-developers] Buggyness in VC when using DiscreteGaussian

Paul Yushkevich pauly@cognitica.com
Mon, 12 May 2003 16:34:17 -0400


Hi,

I've been playing around with DiscreteGaussianImageFilter and getting 
some bizarre results.  I work onWindows with VC6.0 and everything works 
great when I compile in Debug mode.  But in Release and 
ReleaseWithDebInfo modes, I get crashes and weird behavior (remeniscent 
of the message on user list my Marisa Aurelio) 

I tracked down the weird behavior to the SetVariance and SetMaximumError 
methods.  Sometimes, and not always, when I call SetVariance(float) or 
SetMaximumError(float), the floats that I pass in don't stick: I get:

filter->SetVariance(0.5f)

But if I examine filter->m_Variance by printing it our or in debugger, 
it's 12.2323e-121 or something like that.  Like I said, it does not 
always happen and it never happens in debug mode.  Using the 
SetVariance(float[]) and SetMaximumError(float[]) methods works fine too.

I looked at the filter code and could not tell why it's bugging out when 
it is.  Perhaps it's a VC6 bug.  Curiously, I could erase a simple loop 
that followed the call to SetVariance() in my code, and everything would 
start working.

Paul