Search in sources :

Example 1 with RoiPointSet

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

the class MeasurementDemo method calc.

// -- private helpers --
private void calc() {
    PointSet points;
    Overlay overlay = oSrv.getActiveOverlay(display);
    if (overlay != null) {
        points = new RoiPointSet(overlay.getRegionOfInterest());
    } else {
        long[] dims = Intervals.dimensionsAsLongArray(display);
        // 1st plane only
        for (int i = 2; i < dims.length; i++) {
            dims[i] = 1;
        }
        points = new HyperVolumePointSet(dims);
    }
    DoubleType output = new DoubleType();
    mSrv.measure(function, points, output);
    sSrv.showStatus(funcName + " of selected region is " + output.getRealDouble());
}
Also used : PointSet(net.imglib2.ops.pointset.PointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) DoubleType(net.imglib2.type.numeric.real.DoubleType) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) Overlay(net.imagej.overlay.Overlay)

Example 2 with RoiPointSet

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

the class StatisticsDemo method getRegion.

private PointSet getRegion() {
    Overlay overlay = oSrv.getActiveOverlay(display);
    if (overlay != null) {
        return new RoiPointSet(overlay.getRegionOfInterest());
    }
    long[] pt1 = new long[display.numDimensions()];
    long[] pt2 = new long[display.numDimensions()];
    // current plane only
    pt1[0] = 0;
    pt1[1] = 0;
    pt2[0] = display.dimension(0) - 1;
    pt2[1] = display.dimension(1) - 1;
    for (int i = 2; i < display.numDimensions(); i++) {
        pt1[i] = pt2[i] = display.getLongPosition(i);
    }
    return new HyperVolumePointSet(pt1, pt2);
}
Also used : RoiPointSet(net.imglib2.ops.pointset.RoiPointSet) HyperVolumePointSet(net.imglib2.ops.pointset.HyperVolumePointSet) Overlay(net.imagej.overlay.Overlay)

Aggregations

Overlay (net.imagej.overlay.Overlay)2 HyperVolumePointSet (net.imglib2.ops.pointset.HyperVolumePointSet)2 RoiPointSet (net.imglib2.ops.pointset.RoiPointSet)2 PointSet (net.imglib2.ops.pointset.PointSet)1 DoubleType (net.imglib2.type.numeric.real.DoubleType)1