use of net.imglib2.ops.function.real.RealImageFunction in project imagej-plugins-commands by imagej.
the class MeasurementDemo method min.
protected void min() {
RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(dataset, new DoubleType());
function = new RealMinFunction<DoubleType>(imgFunc);
funcName = "Min";
calc();
}
use of net.imglib2.ops.function.real.RealImageFunction in project imagej-plugins-commands by imagej.
the class MeasurementDemo method median.
protected void median() {
RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(dataset, new DoubleType());
function = new RealMedianFunction<DoubleType>(imgFunc);
funcName = "Median";
calc();
}
use of net.imglib2.ops.function.real.RealImageFunction 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());
}
use of net.imglib2.ops.function.real.RealImageFunction in project imagej-plugins-commands by imagej.
the class MeasurementDemo method example3.
// a measurement that has a metric with nondefault constructor and oob
private void example3() {
Dataset ds = getTestData();
DoubleType output = new DoubleType();
OutOfBoundsFactory<UnsignedByteType, RandomAccessibleInterval<UnsignedByteType>> oobFactory = getOobFactory();
@SuppressWarnings("unchecked") RealImageFunction<?, DoubleType> imgFuncWithOOB = new RealImageFunction<UnsignedByteType, DoubleType>((Img<UnsignedByteType>) ds.getImgPlus(), oobFactory, output);
// force to (0,0) - tests that oob code is working
// ds.dimension(0) / 2;
long ctrX = 0;
// ds.dimension(1) / 2;
long ctrY = 0;
long[] posDeltas = new long[] { 3, 3 };
long[] negDeltas = new long[] { 3, 3 };
List<PointSet> pointSets = getNestedNeighborhoods(3);
RealAdaptiveMedianFunction<DoubleType> adapMedFunc = new RealAdaptiveMedianFunction<DoubleType>(imgFuncWithOOB, pointSets);
PointSet region = new HyperVolumePointSet(new long[] { ctrX, ctrY }, negDeltas, posDeltas);
mSrv.measure(adapMedFunc, region, output);
System.out.println("adaptive median is " + output.getRealDouble());
}
use of net.imglib2.ops.function.real.RealImageFunction in project imagej-plugins-commands by imagej.
the class MeasurementDemo method example2.
// a basic measurement with out of bounds data handling
private void example2() {
Dataset ds = getTestData();
DoubleType output = new DoubleType();
OutOfBoundsFactory<UnsignedByteType, RandomAccessibleInterval<UnsignedByteType>> oobFactory = getOobFactory();
@SuppressWarnings("unchecked") RealImageFunction<?, DoubleType> imgFuncWithOOB = new RealImageFunction<UnsignedByteType, DoubleType>((Img<UnsignedByteType>) ds.getImgPlus(), oobFactory, output);
RealMaxFunction<DoubleType> maxFunc = new RealMaxFunction<DoubleType>(imgFuncWithOOB);
PointSet region = new HyperVolumePointSet(Intervals.dimensionsAsLongArray(ds));
mSrv.measure(maxFunc, region, output);
System.out.println("max is " + output.getRealDouble());
}
Aggregations