InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.38k stars 661 forks source link

BUG: Fix computation of weighted centroid in LabelGeometryImageFilter #4530

Closed dzenanz closed 3 months ago

dzenanz commented 3 months ago

Intensity values were cast to integers, thus making the computation imprecise.

Images below show centroids in red and weighted centroids in green.

Before this PR: centroidsOld

After this PR: centroidsNew

PR Checklist

blowekamp commented 3 months ago

The changes look OK.

Just an FYI, not all attributes of LabelGeometryImageFilter take into consideration image spacing and geometry. The similar LabelMap based statistics I have found to be reliable.

dzenanz commented 3 months ago

The above used image has unit spacing, so that is not the issue.