io.github.mianalysis.mia.process.analysis.CentroidCalculator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mia-algorithms Show documentation
Show all versions of mia-algorithms Show documentation
ModularImageAnalysis (MIA) is an ImageJ plugin which provides a modular framework for assembling image and object analysis workflows. Detected objects can be transformed, filtered, measured and related. Analysis workflows are batch-enabled by default, allowing easy processing of high-content datasets.
package io.github.mianalysis.mia.process.analysis;
import io.github.mianalysis.mia.object.coordinates.Point;
import io.github.mianalysis.mia.object.coordinates.volume.CoordinateSet;
import io.github.mianalysis.mia.process.math.CumStat;
public class CentroidCalculator {
public static Point calculateMeanCentroid(CoordinateSet coordinateSet) {
CumStat csX = new CumStat();
CumStat csY = new CumStat();
CumStat csZ = new CumStat();
for (Point point : coordinateSet) {
csX.addMeasure(point.x);
csY.addMeasure(point.y);
csZ.addMeasure(point.z);
}
return new Point<>(csX.getMean(), csY.getMean(), csZ.getMean());
}
}