Search in sources :

Example 1 with RealMaxFunction

use of net.imglib2.ops.function.real.RealMaxFunction 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());
}
Also used : PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) RealMaxFunction(net.imglib2.ops.function.real.RealMaxFunction) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) UnsignedByteType(net.imglib2.type.numeric.integer.UnsignedByteType) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RealImageFunction(net.imglib2.ops.function.real.RealImageFunction)

Example 2 with RealMaxFunction

use of net.imglib2.ops.function.real.RealMaxFunction in project imagej-plugins-commands by imagej.

the class MeasurementDemo method max.

protected void max() {
    RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(dataset, new DoubleType());
    function = new RealMaxFunction<DoubleType>(imgFunc);
    funcName = "Max";
    calc();
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType)

Example 3 with RealMaxFunction

use of net.imglib2.ops.function.real.RealMaxFunction in project imagej-plugins-commands by imagej.

the class MeasurementDemo method example4.

// measuring multiple things at a time
private void example4() {
    Dataset ds = getTestData();
    DoubleType output = new DoubleType();
    RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(ds, output);
    RealArithmeticMeanFunction<DoubleType> meanFunc = new RealArithmeticMeanFunction<DoubleType>(imgFunc);
    RealMinFunction<DoubleType> minFunc = new RealMinFunction<DoubleType>(imgFunc);
    RealMaxFunction<DoubleType> maxFunc = new RealMaxFunction<DoubleType>(imgFunc);
    List<Function<PointSet, DoubleType>> funcList = new ArrayList<Function<PointSet, DoubleType>>();
    List<DoubleType> outputList = new ArrayList<DoubleType>();
    funcList.add(meanFunc);
    funcList.add(minFunc);
    funcList.add(maxFunc);
    outputList.add(new DoubleType());
    outputList.add(new DoubleType());
    outputList.add(new DoubleType());
    PointSet region = new HyperVolumePointSet(Intervals.dimensionsAsLongArray(ds));
    mSrv.measure(funcList, region, outputList);
    System.out.println("mean = " + outputList.get(0).getRealDouble());
    System.out.println("min = " + outputList.get(1).getRealDouble());
    System.out.println("max = " + outputList.get(2).getRealDouble());
}
Also used : RealMaxFunction(net.imglib2.ops.function.real.RealMaxFunction) Dataset(net.imagej.Dataset) ArrayList(java.util.ArrayList) PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) BasicStatsFunction(net.imagej.measure.BasicStatsFunction) RealMaxFunction(net.imglib2.ops.function.real.RealMaxFunction) RealAdaptiveMedianFunction(net.imglib2.ops.function.real.RealAdaptiveMedianFunction) RealArithmeticMeanFunction(net.imglib2.ops.function.real.RealArithmeticMeanFunction) RealMinFunction(net.imglib2.ops.function.real.RealMinFunction) RealImageFunction(net.imglib2.ops.function.real.RealImageFunction) Function(net.imglib2.ops.function.Function) RealMedianFunction(net.imglib2.ops.function.real.RealMedianFunction) RealPointCountFunction(net.imglib2.ops.function.real.RealPointCountFunction) RealArithmeticMeanFunction(net.imglib2.ops.function.real.RealArithmeticMeanFunction) DoubleType(net.imglib2.type.numeric.real.DoubleType) RealMinFunction(net.imglib2.ops.function.real.RealMinFunction) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet)

Aggregations

DoubleType (net.imglib2.type.numeric.real.DoubleType)3 Dataset (net.imagej.Dataset)2 RealImageFunction (net.imglib2.ops.function.real.RealImageFunction)2 RealMaxFunction (net.imglib2.ops.function.real.RealMaxFunction)2 HyperVolumePointSet (net.imglib2.ops.pointset.HyperVolumePointSet)2 PointSet (net.imglib2.ops.pointset.PointSet)2 RoiPointSet (net.imglib2.ops.pointset.RoiPointSet)2 ArrayList (java.util.ArrayList)1 BasicStatsFunction (net.imagej.measure.BasicStatsFunction)1 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)1 Function (net.imglib2.ops.function.Function)1 RealAdaptiveMedianFunction (net.imglib2.ops.function.real.RealAdaptiveMedianFunction)1 RealArithmeticMeanFunction (net.imglib2.ops.function.real.RealArithmeticMeanFunction)1 RealMedianFunction (net.imglib2.ops.function.real.RealMedianFunction)1 RealMinFunction (net.imglib2.ops.function.real.RealMinFunction)1 RealPointCountFunction (net.imglib2.ops.function.real.RealPointCountFunction)1 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)1