@Override public DatasetView getActiveDatasetView(final ImageDisplay display) { if (display == null) return null; final DataView activeView = display.getActiveView(); if (activeView instanceof DatasetView) { return (DatasetView) activeView; } return null; }
@Override public DataView getValue() { if (imageDisplayService == null) return null; final ImageDisplay display = imageDisplayService.getActiveImageDisplay(); return display == null ? null : display.getActiveView(); }
/** * Removes the {@link #IMP_KEY} entry from the {@link Dataset} attached to * the given {@link ImageDisplay} - if any. */ private void clearImagePlusKey(final ImageDisplay display) { Data data = display.getActiveView().getData(); if (Dataset.class.isAssignableFrom(data.getClass())) { ((Dataset)data).getProperties().remove(IMP_KEY); } }
final DataView dispView = disp.getActiveView(); if (dispView == null) return; final DatasetView dsView = (DatasetView) dispView;
/** Recalculate the label text and update it on the panel. */ protected void updateLabel() { final ImageDisplay d = getDisplay(); if (d == null || d.getActiveView() == null) return; final DisplayPanel p = getPanel(); if (p != null) p.setLabel(makeLabel()); }
final DataView view = getDisplay().getActiveView(); final Dataset dataset = getDataset(view);
@Override public boolean canView(final Display<?> d) { if (!(d instanceof ImageDisplay) || // legacyService == null || // !legacyService.isActive() || // legacyService.getIJ1Helper() == null || // legacyService.getImageMap() == null) { return false; } // NB: ImagePlus only supports images with at most five dimensions. return getDataset(((ImageDisplay) d).getActiveView()).numDimensions() <= 5; }
@Override public void run() { log.info("Running " + PLUGIN_NAME + " version " + VERSION); Dataset data = (Dataset) image.getActiveView().getData(); OMEXMLMetadata md = OMEUtils.getOMEXMLMetadata(data, ij); if (md == null) { return; } // Launch JavaFX interface MainAppFrame app = new MainAppFrame(ij, image, md); app.setTitle(PLUGIN_NAME + " version " + VERSION); app.init(); } }
@Override public void view(final DisplayWindow w, final Display<?> d) { super.view(w, d); final ImageDisplay imageDisplay = (ImageDisplay) d; // NB: Tell the IJ2 framework what the "active" display is. // This allows other consumers to look up the corresponding // ImagePlus using the active display. displayService.setActiveDisplay(imageDisplay); final Data data = imageDisplay.getActiveView().getData(); if (Dataset.class.isAssignableFrom(data.getClass())) { // NB: Check if there is already an ImagePlus that we will // associate with this display - even if it hasn't been // mapped yet (because the display is still being created!). final Dataset dataset = (Dataset) data; if (dataset.getProperties().containsKey(LegacyImageMap.IMP_KEY)) return; } final LegacyImageMap limp = legacyService.getImageMap(); // if there is already a mapping for this display, just get its ImagePlus final ImagePlus existing = limp.lookupImagePlus(imageDisplay); // if none: register the display, which triggers wrapping in an ImagePlus final ImagePlus imagePlus = existing != null ? existing : limp.registerDisplay(imageDisplay); // display the ImagePlus via the IJ1 framework imagePlus.show(); // fire an ImageDisplay update event d.update(); }
return false; final Data data = display.getActiveView().getData(); final int axisIndex = data.dimensionIndex(axis); if (axisIndex < 0) {
final Data data = display.getActiveView().getData(); for (int i = 0; i < data.numDimensions(); i++) { AxisType axisType = data.axis(i).type();
final ImagePlus imp) final DataView dataView = disp.getActiveView(); if (!(dataView instanceof DatasetView)) return; final DatasetView view = (DatasetView) dataView;
final DatasetView activeView = (DatasetView) disp.getActiveView(); if (imp instanceof CompositeImage) { final CompositeImage ci = (CompositeImage) imp;
/** * A convenience method for defining a SamplingDefinition that returns a * single UV plane of an ImageDisplay. U and V are defined by the user. * * @param display The ImageDisplay to sample * @param uAxis The U axis of the sample space * @param vAxis The V axis of the sample space * @return The specified SamplingDefinition */ public static SamplingDefinition sampleUVPlane(final ImageDisplay display, final AxisType uAxis, final AxisType vAxis) { final SamplingDefinition definition = new SamplingDefinition(display); final Data data = display.getActiveView().getData(); for (int i = 0; i < data.numDimensions(); i++) { AxisType axisType = data.axis(i).type(); if ((axisType == uAxis) || (axisType == vAxis)) { final int axisIndex = display.dimensionIndex(axisType); final long size = display.dimension(axisIndex); final AxisSubrange subrange = new AxisSubrange(0, size - 1); definition.constrain(axisType, subrange); } else { // other axis final long pos = display.getLongPosition(axisType); final AxisSubrange subrange = new AxisSubrange(pos); definition.constrain(axisType, subrange); } } return definition; }
assignChannelMinMax(final ImageDisplay disp, final ImagePlus imp) final DataView dataView = disp.getActiveView(); if (!(dataView instanceof DatasetView)) return; final DatasetView view = (DatasetView) dataView;
final ImageDisplay origDisp = def.getDisplay(); final Dataset origDs = (Dataset) origDisp.getActiveView().getData(); final long[] dims = def.getOutputDims(); final String name = origDisp.getName();
final PositionIterator iter2 = new DensePositionIterator(def); final Dataset input = (Dataset) def.getDisplay().getActiveView().getData(); final Dataset output = (Dataset) outputImage.getActiveView().getData(); final long[] inputDims = Intervals.dimensionsAsLongArray(input); final long[] outputDims = Intervals.dimensionsAsLongArray(output);