Search in sources :

Example 1 with BasicStats

use of net.imagej.measure.BasicStats in project imagej-plugins-commands by imagej.

the class MeasurementDemo method example5.

// measuring a custom set of data using an aggregating class
private void example5() {
    Dataset ds = getTestData();
    DoubleType output = new DoubleType();
    RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(ds, output);
    BasicStatsFunction<DoubleType> statFunc = new BasicStatsFunction<DoubleType>(imgFunc, new DoubleType());
    PointSet region = new HyperVolumePointSet(Intervals.dimensionsAsLongArray(ds));
    BasicStats stats = new BasicStats();
    mSrv.measure(statFunc, region, stats);
    System.out.println("mean = " + stats.getXBar());
    System.out.println("var = " + stats.getS2n1());
}
Also used : PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) BasicStats(net.imagej.measure.BasicStats) BasicStatsFunction(net.imagej.measure.BasicStatsFunction)

Aggregations

Dataset (net.imagej.Dataset)1 BasicStats (net.imagej.measure.BasicStats)1 BasicStatsFunction (net.imagej.measure.BasicStatsFunction)1 HyperVolumePointSet (net.imglib2.ops.pointset.HyperVolumePointSet)1 PointSet (net.imglib2.ops.pointset.PointSet)1 RoiPointSet (net.imglib2.ops.pointset.RoiPointSet)1 DoubleType (net.imglib2.type.numeric.real.DoubleType)1