stnava
stnava
not reproducible - lots of undefined stuff etc
ok - your update helps
here is the issue: ``` fi2=ants.image_math( fi, "Normalize" ) mi2=ants.image_math( mi, "Normalize" ) >>> ants.get_center_of_mass( fi ) (29994810.950913575, 54067577.80331416, 93929963.00075227) >>> ants.get_center_of_mass( fi2 ) (34.487496393787595, 49.47746143828112, 39.460844423879415) reg = ants.registration(...
it looks to be a type issue or maybe pointer issue. that's why the `fi -1` `mi - 1` conversion has an impact ---- the internal conversions we do to...
try ``` import ants import numpy as np np.random.seed(21) ants.from_numpy(np.random.randn(100,100,100).astype('float64')).get_center_of_mass() ```
hmm - I see repeated calls go from nonsense ( 1st call ) to something expected 2nd call and so on ... ``` import ants import numpy as np np.random.seed(21)...
those all look correct to me (except the first one). the center of mass is just the intensity multiplied by the coordinate system and then averaged .... also note: ```...
if the input intensity is bound in zero to one and everything is set to identity then 100
see https://itk.org/Doxygen/html/classitk_1_1ImageMomentsCalculator.html for details
I ran the same experiment in `ANTsR` and the behavior is similar .... ``` getCenterOfMass( antsImageRead( '/tmp/temp.nii.gz' ) [1] 12086.293 -107.794 2221.401 > getCenterOfMass(antsImageRead( '/tmp/temp.nii.gz' ) + 0.01) [1] 53.42208...