[Insight-users] itk::Array

kumar MaKumartr@netscape.net
Wed, 29 Jan 2003 11:36:57 -0100


Hello Everyone
I am using itk::Array and there were strange results that I was getting, 
if the Array was not initialized

I had declared a Array variable using the following statement
 Array<double> epsiloni_square(ns);


And I was filling it up in a for loop
But the ns-1 index was giving me problems

 epsiloni_square(indx_i)  = epsiloni_square(indx_i) +  (Oxi(l)-Rxi(l))* 
(Oxi(l)-Rxi(l));
  if(indx_i == (ns-1))
          cout  << "\n " << epsiloni_square(indx_i) << " " <<  Oxi(l) 
<<" " <<  Rxi(l);

Everything was in order , but the result was as follows
-NaN        5                     1.47095
 -NaN       7                 3.72159
 -NaN       9                 2.84563
 -NaN       4                     6.18214
 -NaN        6                 4.01261
 -NaN        2                 4.88857
 -NaN        9                 6.37723
 -NaN        3             7.30397
 -NaN        2             4.08111

 
 See epsiloni_square [65.9847, 46.6313, 76.5233, -NaN]
The first column is epsiloni_square , then Oxi and then Rxi


After some debugging I could set it up using the following initialization
epsiloni_square.fill(0);


This I think may  not be the expected way to get it working

Is it that all arrays should be initialized to zero , and otherwise one 
should expect strange results :-)

Any comments on this is welcome

Thanks and Regards
Kumar









-- 
Your favorite stores, helpful shopping tools and great gift ideas. 
Experience the convenience of buying online with Shop@Netscape! 
http://shopnow.netscape.com/