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());
}
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");
}
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());
}
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());
}
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());
}
Aggregations