/** * Returns a multidimensional set of input axis values generated from the * input data of this SamplingDefinition. * <p> * For example, if the sampling definition has two axes defined as "1-4" and * "1-3" calling this routine would return something like this: [[1,2,3,4] , * [1,2,3]] */ public List<List<Long>> getInputRanges() { final List<List<Long>> axesDefs = new ArrayList<>(); for (int i = 0; i < display.numDimensions(); i++) { final AxisType axisType = display.axis(i).type(); final AxisSubrange subrange = axisSubranges.get(axisType); final List<Long> axisValues = subrange.getIndices(); axesDefs.add(axisValues); } return Collections.unmodifiableList(axesDefs); }
/** * Returns the calibration values that will be present in the output data. * This method assumes all calibrations are linear and should be avoided. Use * getOutputCalibratedAxes() for access to calibration information. * * @deprecated */ @Deprecated public double[] getOutputCalibration(final AxisType[] outputAxes) { final double[] cal = new double[outputAxes.length]; int a = 0; for (int i = 0; i < outputAxes.length; i++) { final int axisIndex = display.dimensionIndex(outputAxes[i]); if (axisIndex >= 0) cal[a++] = display.axis(axisIndex).averageScale(0, 1); } return cal; }
final AxisType axis = display.axis(i).type(); if (axis.isXY()) continue; // skip spatial axes final int min = (int) display.min(i);
/** * A convenience method for defining a SamplingDefinition that returns a * complete copy of an ImageDisplay. * * @param display The ImageDisplay to sample * @return The specified SamplingDefinition */ public static SamplingDefinition sampleAllPlanes(final ImageDisplay display) { final SamplingDefinition definition = new SamplingDefinition(display); for (int i = 0; i < display.numDimensions(); i++) { final AxisType axisType = display.axis(i).type(); final long size = display.dimension(i); final AxisSubrange subrange = new AxisSubrange(0, size - 1); definition.constrain(axisType, subrange); } return definition; }
/** Creates an animation for the given {@link ImageDisplay}. */ public Animation(final ImageDisplay display) { this.display = display; display.getContext().inject(this); // assign default animation options if (display.numDimensions() > 2) { if (display.dimensionIndex(Axes.TIME) >= 0) { // animation over time is preferred by default axis = Axes.TIME; } else if (display.dimensionIndex(Axes.Z) >= 0) { // failing that, animation over Z is OK axis = Axes.Z; } else { // no preferred animation axes; use first non-spatial axis axis = display.axis(2).type(); } final int axisIndex = display.dimensionIndex(axis); last = display.dimension(axisIndex) - 1; } }
/** * When a tool creates an overlay, add the overlay/figure combo to an * {@link OverlayFigureView}. */ @EventHandler protected void onEvent(final FigureCreatedEvent event) { final ImageDisplay display = event.getDisplay(); if (display != getDisplay()) return; // not this canvas's display final OverlayView overlay = event.getView(); for (int i = 0; i < display.numDimensions(); i++) { final AxisType axisType = display.axis(i).type(); if (axisType.isXY()) continue; if (overlay.getData().dimensionIndex(axisType) < 0) { overlay.setPosition(display.getLongPosition(axisType), axisType); } } if (drawingView.getSelectedFigures().contains(event.getFigure())) { overlay.setSelected(true); } final OverlayFigureView figureView = new OverlayFigureView(displayViewer, overlay, event.getFigure()); figureViews.add(figureView); display.add(overlay); display.update(); }