Search in sources :

Example 1 with OptionsCompatibility

use of net.imagej.options.OptionsCompatibility in project imagej-plugins-commands by imagej.

the class InvertDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = imgDispService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = imgDispService.getActiveDatasetView(display);
    OptionsCompatibility options = optionsService.getOptions(OptionsCompatibility.class);
    if (options.isInvertModeLegacy() && dataset.isInteger() && !dataset.isSigned() && dataset.getType().getBitsPerPixel() == 8) {
        min = 0;
        max = 255;
    } else
        calcValueRange(dataset);
    final RealInvert<DoubleType, DoubleType> op = new RealInvert<DoubleType, DoubleType>(min, max);
    final InplaceUnaryTransform<T, DoubleType> transform;
    if (allPlanes)
        transform = new InplaceUnaryTransform<T, DoubleType>(op, new DoubleType(), dataset, overlay);
    else
        transform = new InplaceUnaryTransform<T, DoubleType>(op, new DoubleType(), dataset, overlay, view.getPlanePosition());
    transform.run();
}
Also used : DatasetView(net.imagej.display.DatasetView) RealInvert(net.imglib2.ops.operation.real.unary.RealInvert) OptionsCompatibility(net.imagej.options.OptionsCompatibility) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) Overlay(net.imagej.overlay.Overlay)

Aggregations

Dataset (net.imagej.Dataset)1 DatasetView (net.imagej.display.DatasetView)1 OptionsCompatibility (net.imagej.options.OptionsCompatibility)1 Overlay (net.imagej.overlay.Overlay)1 RealInvert (net.imglib2.ops.operation.real.unary.RealInvert)1 DoubleType (net.imglib2.type.numeric.real.DoubleType)1