Search in sources :

Example 6 with DatasetView

use of net.imagej.display.DatasetView in project imagej-plugins-commands by imagej.

the class ShowLUTAsTable method run.

// -- Command methods --
@Override
public void run() {
    final DatasetView view = imgDispService.getActiveDatasetView(display);
    final List<ColorTable> colorTables = view.getColorTables();
    final Position planePos = view.getPlanePosition();
    long pos = planePos.getIndex();
    if (pos < 0 || pos >= colorTables.size())
        pos = 0;
    final ColorTable colorTable = colorTables.get((int) pos);
    final int rowCount = colorTable.getLength();
    final int componentCount = colorTable.getComponentCount();
    final int colCount = componentCount + 1;
    table = new DefaultResultsTable(colCount, rowCount);
    table.setColumnHeader(0, "Index");
    // use here.
    for (int x = 0; x < componentCount; x++) {
        table.setColumnHeader(x + 1, "CH" + x);
    }
    // fill in values
    for (int y = 0; y < rowCount; y++) {
        table.setValue(0, y, y);
        for (int x = 0; x < componentCount; x++) {
            final double value = colorTable.get(x, y);
            table.setValue(x + 1, y, value);
        }
    }
}
Also used : DatasetView(net.imagej.display.DatasetView) DefaultResultsTable(net.imagej.table.DefaultResultsTable) Position(net.imagej.Position) ColorTable(net.imglib2.display.ColorTable)

Example 7 with DatasetView

use of net.imagej.display.DatasetView in project imagej-plugins-commands by imagej.

the class SquareRootDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = imgDispService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = imgDispService.getActiveDatasetView(display);
    final RealSqrt<DoubleType, DoubleType> op = new RealSqrt<DoubleType, DoubleType>();
    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) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) RealSqrt(net.imglib2.ops.operation.real.unary.RealSqrt) Overlay(net.imagej.overlay.Overlay)

Example 8 with DatasetView

use of net.imagej.display.DatasetView in project imagej-plugins-commands by imagej.

the class LogDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = imgDispService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = imgDispService.getActiveDatasetView(display);
    final RealLog<DoubleType, DoubleType> op = new RealLog<DoubleType, DoubleType>();
    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) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) RealLog(net.imglib2.ops.operation.real.unary.RealLog) Overlay(net.imagej.overlay.Overlay)

Example 9 with DatasetView

use of net.imagej.display.DatasetView in project imagej-plugins-commands by imagej.

the class ReciprocalDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = imgDispService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = imgDispService.getActiveDatasetView(display);
    final OptionsMisc optionsMisc = optionsService.getOptions(OptionsMisc.class);
    final String dbzString = optionsMisc.getDivByZeroVal();
    double dbzVal;
    try {
        dbzVal = Double.parseDouble(dbzString);
    } catch (final NumberFormatException e) {
        dbzVal = Double.POSITIVE_INFINITY;
    }
    final RealReciprocal<DoubleType, DoubleType> op = new RealReciprocal<DoubleType, DoubleType>(dbzVal);
    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) Dataset(net.imagej.Dataset) RealReciprocal(net.imglib2.ops.operation.real.unary.RealReciprocal) DoubleType(net.imglib2.type.numeric.real.DoubleType) Overlay(net.imagej.overlay.Overlay) OptionsMisc(net.imagej.options.OptionsMisc)

Example 10 with DatasetView

use of net.imagej.display.DatasetView in project imagej-plugins-commands by imagej.

the class SquareDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = imgDispService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = imgDispService.getActiveDatasetView(display);
    final RealSqr<DoubleType, DoubleType> op = new RealSqr<DoubleType, DoubleType>();
    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) Dataset(net.imagej.Dataset) DoubleType(net.imglib2.type.numeric.real.DoubleType) RealSqr(net.imglib2.ops.operation.real.unary.RealSqr) Overlay(net.imagej.overlay.Overlay)

Aggregations

DatasetView (net.imagej.display.DatasetView)21 Dataset (net.imagej.Dataset)13 Overlay (net.imagej.overlay.Overlay)11 DoubleType (net.imglib2.type.numeric.real.DoubleType)8 Position (net.imagej.Position)4 ColorTable (net.imglib2.display.ColorTable)4 Point (java.awt.Point)2 ImageDisplay (net.imagej.display.ImageDisplay)2 Graphics2D (java.awt.Graphics2D)1 Image (java.awt.Image)1 BufferedImage (java.awt.image.BufferedImage)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DataView (net.imagej.display.DataView)1 OverlayView (net.imagej.display.OverlayView)1 OptionsCompatibility (net.imagej.options.OptionsCompatibility)1 OptionsMisc (net.imagej.options.OptionsMisc)1 DefaultResultsTable (net.imagej.table.DefaultResultsTable)1 ARGBScreenImage (net.imglib2.display.screenimage.awt.ARGBScreenImage)1 ArrayImgFactory (net.imglib2.img.array.ArrayImgFactory)1