Search in sources :

Example 11 with PointSet

use of net.imglib2.ops.pointset.PointSet in project imagej-plugins-commands by imagej.

the class AbstractNoiseReducerPlugin method run.

@Override
public void run() {
    Neighborhood neighborhood = determineNeighborhood(input.numDimensions());
    if (neighborhood == null)
        return;
    @SuppressWarnings("unchecked") ImgPlus<U> inputImg = (ImgPlus<U>) input.getImgPlus();
    OutOfBoundsMirrorFactory<U, RandomAccessibleInterval<U>> oobFactory = new OutOfBoundsMirrorFactory<U, RandomAccessibleInterval<U>>(Boundary.DOUBLE);
    Function<long[], DoubleType> otherFunc = new RealImageFunction<U, DoubleType>(inputImg, oobFactory, new DoubleType());
    PointSet ps = neighborhood.getPoints();
    Reducer<U, DoubleType> reducer = new Reducer<U, DoubleType>(getContext(), inputImg, getFunction(otherFunc), ps);
    output = reducer.reduceNoise(neighborhood.getDescription());
}
Also used : ImgPlus(net.imagej.ImgPlus) PointSet(net.imglib2.ops.pointset.PointSet) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) DoubleType(net.imglib2.type.numeric.real.DoubleType) OutOfBoundsMirrorFactory(net.imglib2.outofbounds.OutOfBoundsMirrorFactory) RealImageFunction(net.imglib2.ops.function.real.RealImageFunction)

Example 12 with PointSet

use of net.imglib2.ops.pointset.PointSet in project imagej-plugins-commands by imagej.

the class NoiseReductionAdaptiveMedian method run.

// -- NoiseReductionAdaptiveMedian methods --
@Override
public void run() {
    @SuppressWarnings("unchecked") final ImgPlus<U> inputImg = (ImgPlus<U>) input.getImgPlus();
    final OutOfBoundsMirrorFactory<U, RandomAccessibleInterval<U>> oobFactory = new OutOfBoundsMirrorFactory<U, RandomAccessibleInterval<U>>(Boundary.DOUBLE);
    final Function<long[], DoubleType> otherFunc = new RealImageFunction<U, DoubleType>(inputImg, oobFactory, new DoubleType());
    final List<PointSet> pointSets = getNeighborhoods(input.numDimensions());
    final Reducer<U, DoubleType> reducer = new Reducer<U, DoubleType>(context, inputImg, getFunction(otherFunc, pointSets), pointSets.get(0));
    output = reducer.reduceNoise("Adaptive window neighborhood");
}
Also used : ImgPlus(net.imagej.ImgPlus) PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) DoubleType(net.imglib2.type.numeric.real.DoubleType) OutOfBoundsMirrorFactory(net.imglib2.outofbounds.OutOfBoundsMirrorFactory) RealImageFunction(net.imglib2.ops.function.real.RealImageFunction)

Example 13 with PointSet

use of net.imglib2.ops.pointset.PointSet in project imagej-plugins-commands by imagej.

the class MeasurementDemo method example1.

// -- Other examples --
// standard ways of measuring various values.
// a basic measurement
private void example1() {
    Dataset ds = getTestData();
    DoubleType output = new DoubleType();
    RealImageFunction<?, DoubleType> imgFunc = mSrv.imgFunction(ds, output);
    RealArithmeticMeanFunction<DoubleType> meanFunc = new RealArithmeticMeanFunction<DoubleType>(imgFunc);
    PointSet region = new HyperVolumePointSet(Intervals.dimensionsAsLongArray(ds));
    mSrv.measure(meanFunc, region, output);
    System.out.println("arithmetic mean is " + output.getRealDouble());
}
Also used : PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) RealArithmeticMeanFunction(net.imglib2.ops.function.real.RealArithmeticMeanFunction) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet)

Example 14 with PointSet

use of net.imglib2.ops.pointset.PointSet 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)

Example 15 with PointSet

use of net.imglib2.ops.pointset.PointSet in project imagej-plugins-commands by imagej.

the class MeasurementDemo method example6.

// measuring a user defined function with the service
private void example6() {
    Dataset ds = getTestData();
    IntType output = new IntType();
    RealImageFunction<?, IntType> imgFunc = mSrv.imgFunction(ds, output);
    CustomFunction func = new CustomFunction(imgFunc);
    PointSet region = new HyperVolumePointSet(Intervals.dimensionsAsLongArray(ds));
    mSrv.measure(func, region, output);
    System.out.println("total 7's = " + output.get());
}
Also used : PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) Dataset(net.imagej.Dataset) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) IntType(net.imglib2.type.numeric.integer.IntType)

Aggregations

HyperVolumePointSet (net.imglib2.ops.pointset.HyperVolumePointSet)18 PointSet (net.imglib2.ops.pointset.PointSet)17 DoubleType (net.imglib2.type.numeric.real.DoubleType)10 Dataset (net.imagej.Dataset)9 RoiPointSet (net.imglib2.ops.pointset.RoiPointSet)9 RealImageFunction (net.imglib2.ops.function.real.RealImageFunction)5 AxisType (net.imagej.axis.AxisType)4 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)4 PointSetIterator (net.imglib2.ops.pointset.PointSetIterator)4 ArrayList (java.util.ArrayList)3 ImgPlus (net.imagej.ImgPlus)2 BasicStatsFunction (net.imagej.measure.BasicStatsFunction)2 Overlay (net.imagej.overlay.Overlay)2 RandomAccess (net.imglib2.RandomAccess)2 RealAdaptiveMedianFunction (net.imglib2.ops.function.real.RealAdaptiveMedianFunction)2 RealArithmeticMeanFunction (net.imglib2.ops.function.real.RealArithmeticMeanFunction)2 RealMaxFunction (net.imglib2.ops.function.real.RealMaxFunction)2 OutOfBoundsMirrorFactory (net.imglib2.outofbounds.OutOfBoundsMirrorFactory)2 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)2 DefaultDataset (net.imagej.DefaultDataset)1