Search in sources :

Example 11 with DatasetView

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

the class ExpDataValues method run.

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

Example 12 with DatasetView

use of net.imagej.display.DatasetView 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)

Example 13 with DatasetView

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

the class AbsDataValues method run.

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

Example 14 with DatasetView

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

the class AddNoiseToDataValues method run.

// -- public interface --
@Override
public void run() {
    Dataset dataset = displayService.getActiveDataset(display);
    Overlay overlay = overlayService.getActiveOverlay(display);
    DatasetView view = displayService.getActiveDatasetView(display);
    Position planePos = (allPlanes) ? null : view.getPlanePosition();
    NoiseAdder<T> noiseAdder = new NoiseAdder<T>(dataset, overlay, planePos);
    noiseAdder.setStdDev(25.0);
    noiseAdder.run();
}
Also used : DatasetView(net.imagej.display.DatasetView) Position(net.imagej.Position) Dataset(net.imagej.Dataset) Overlay(net.imagej.overlay.Overlay)

Example 15 with DatasetView

use of net.imagej.display.DatasetView in project imagej-omero by imagej.

the class DefaultOMEROService method toOMERO.

@Override
public Object toOMERO(final omero.client client, final Object value) throws omero.ServerError, IOException, ExecutionException, DSOutOfServiceException, DSAccessException, NumberFormatException, URISyntaxException {
    if (value == null)
        return null;
    if (value instanceof Dataset) {
        // upload image to OMERO, returning the resultant image ID
        final Dataset d = (Dataset) value;
        final long imageID = uploadImage(client, d);
        // TODO: upload or update?
        if (d.getProperties().get("rois") != null)
            uploadROIs(createCredentials(client), (TreeNode<?>) d.getProperties().get("rois"), imageID);
        // TODO: Modify tables to implement Named??
        if (d.getProperties().get("tables") != null) {
            @SuppressWarnings("unchecked") final List<Table<?, ?>> tables = (List<Table<?, ?>>) d.getProperties().get("tables");
            final OMEROLocation cred = createCredentials(client);
            for (final Table<?, ?> table : tables) uploadTable(cred, d.getName() + "-table", table, imageID);
        }
        return toOMERO(client, imageID);
    }
    if (convertService.supports(value, Dataset.class))
        return toOMERO(client, convertService.convert(value, Dataset.class));
    if (value instanceof DatasetView) {
        final DatasetView datasetView = (DatasetView) value;
        // TODO: Verify whether any view-specific metadata can be preserved.
        return toOMERO(client, datasetView.getData());
    }
    if (value instanceof ImageDisplay) {
        final ImageDisplay imageDisplay = (ImageDisplay) value;
        // TODO: Support more aspects of image displays; e.g., multiple datasets.
        return toOMERO(client, imageDisplayService.getActiveDataset(imageDisplay));
    }
    if (value instanceof Table)
        return convertOMEROTable((Table<?, ?>) value);
    if (value instanceof TableDisplay)
        return toOMERO(client, ((TableDisplay) value).get(0));
    if (convertService.supports(value, Table.class))
        return toOMERO(client, convertService.convert(value, Table.class));
    if (value instanceof TreeNode) {
        return convertOMEROROI((TreeNode<?>) value, null);
    }
    if (value instanceof MaskPredicate) {
        final Object o = toOMERO(client, new DefaultTreeNode<>(value, null));
        return ((List<?>) o).get(0);
    }
    if (convertService.supports(value, TreeNode.class))
        return toOMERO(client, convertService.convert(value, TreeNode.class));
    if (convertService.supports(value, MaskPredicate.class))
        return toOMERO(client, convertService.convert(value, MaskPredicate.class));
    return toOMERO(value);
}
Also used : Table(org.scijava.table.Table) GenericTable(org.scijava.table.GenericTable) DatasetView(net.imagej.display.DatasetView) Dataset(net.imagej.Dataset) MaskPredicate(net.imglib2.roi.MaskPredicate) DefaultTreeNode(org.scijava.util.DefaultTreeNode) TreeNode(org.scijava.util.TreeNode) TableDisplay(org.scijava.table.TableDisplay) List(java.util.List) ArrayList(java.util.ArrayList) DataObject(omero.gateway.model.DataObject) ImageDisplay(net.imagej.display.ImageDisplay)

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