final List<ColorTable> existingColorTables = dsView.getColorTables(); for (int i = 0; i < existingColorTables.size(); i++) dsView.setColorTable(newTable, i); dsView.setColorTable(colorTables.get(i), i);
@Override public Dataset getActiveDataset(final ImageDisplay display) { final DatasetView activeDatasetView = getActiveDatasetView(display); return activeDatasetView == null ? null : activeDatasetView.getData(); }
private void setDisplayRanges(SamplingDefinition def, ImageDisplay output) { final ImageDisplay input = def.getDisplay(); final DatasetView inView = imgDispService.getActiveDatasetView(input); final DatasetView outView = imgDispService.getActiveDatasetView(output); final int inputChanAxis = input.dimensionIndex(Axes.CHANNEL); final List<List<Long>> inputRanges = def.getInputRanges(); for (int i = 0; i < inView.getChannelCount(); i++) { int outIndex = outputColorTableNumber(inputRanges, i, inputChanAxis); if (outIndex >= 0) { double min = inView.getChannelMin(i); double max = inView.getChannelMax(i); outView.setChannelRange(outIndex, min, max); } } } }
@Override public void applyLUT(final ColorTable colorTable, final ImageDisplay display) { final DatasetView view = imageDisplayService.getActiveDatasetView(display); if (view == null) return; final int channel = view.getIntPosition(Axes.CHANNEL); view.setColorTable(colorTable, channel); display.update(); }
if (!(dataView instanceof DatasetView)) return; final DatasetView view = (DatasetView) dataView; final int channelCount = view.getChannelCount(); final double[] min = new double[channelCount]; final double[] max = new double[channelCount]; double overallMax = Double.NEGATIVE_INFINITY; for (int c = 0; c < channelCount; c++) { double lo = view.getChannelMin(c); double hi = view.getChannelMax(c);
final CompositeImage ci = (CompositeImage) imp; final List<ColorTable> colorTables = (activeView == null) ? null : activeView.getColorTables(); setCompositeImageLUTs(ci, colorTables); final int composChannCount = (activeView == null) ? 1 : activeView.getData() .getCompositeChannelCount(); setCompositeImageMode(ci, composChannCount, colorTables);
@Override public void run() { RandomAccessibleInterval<?> img = getView().getData().getImgPlus(); if (isPlanar()) { // assume x,y are first for (int i=2; i<img.numDimensions(); i++) { img = Views.hyperSlice(img, i, getView().getLongPosition(i)); } } run(img); }
public DatasetFigureView(final SwingImageDisplayViewer displayViewer, final DatasetView datasetView) { setContext(datasetView.getContext()); this.datasetView = datasetView; final JHotDrawImageCanvas canvas = displayViewer.getCanvas(); final Drawing drawing = canvas.getDrawing(); figure = new ImageFigure(); figure.setSelectable(false); figure.setTransformable(false); final Dataset dataset = datasetView.getData(); final double minX = dataset.getImgPlus().realMin(0); final double minY = dataset.getImgPlus().realMin(1); final double maxX = dataset.getImgPlus().realMax(0); final double maxY = dataset.getImgPlus().realMax(1); figure.setBounds(new Point2D.Double(minX, minY), new Point2D.Double(maxX, maxY)); drawing.add(figure); }
if (!(dataView instanceof DatasetView)) return; final DatasetView view = (DatasetView) dataView; final int channelCount = view.getChannelCount(); final double[] min = new double[channelCount]; final double[] max = new double[channelCount]; throw new IllegalArgumentException("Bad display range setting"); view.setChannelRange(c, mn, mx);
private void updateColorBar(final int c) { final DatasetView view = imageDisplayService.getActiveDatasetView(display); if (view == null) return; // no active dataset List<ColorTable> colorTables = view.getColorTables(); if (c >= colorTables.size()) return; final ColorTable lut = colorTables.get(c); colorBar.setColorTable(lut); colorBar.repaint(); }
@Override public void update() { log.debug("Updating image figure: " + this); final Image image = datasetView.getScreenImage().image(); final BufferedImage bufImage = AWTImageTools.makeBuffered(image); figure.setBounds(new Rectangle2D.Double(0, 0, bufImage.getWidth(), bufImage.getHeight())); figure.setBufferedImage(bufImage); }
/** Sets the single LUT of an ImagePlus to the first ColorTable of a Dataset */ private void setImagePlusLUTToFirstInView(final DatasetView view, final ImagePlus imp) { ColorTable cTable = view.getColorTables().get(0); if (cTable == null) cTable = ColorTables.GRAYS; final LUT lut = make8BitLUT(cTable); imp.getProcessor().setColorModel(lut); // or imp.getStack().setColorModel(lut); }
if (datasetView == null) return null; final ARGBScreenImage screenImage = datasetView.getScreenImage(); final Image pixels = screenImage.image();
final DatasetView inView = imgDispService.getActiveDatasetView(input); final DatasetView outView = imgDispService.getActiveDatasetView(output); final List<ColorTable> inputColorTables = inView.getColorTables(); final int inputChanAxis = input.dimensionIndex(Axes.CHANNEL); final List<List<Long>> inputRanges = def.getInputRanges(); int outIndex = outputColorTableNumber(inputRanges, i, inputChanAxis); if (outIndex >= 0) { outView.setColorTable(inputColorTables.get(i), outIndex);
ARGBScreenImage screenImage = view.getScreenImage(); long[] dims = new long[3]; int xSize = (int) dims[0]; int ySize = (int) dims[1]; int[] argbPixels = view.getScreenImage().getData(); Dataset dataset = service.create(new UnsignedByteType(), dims, outputName,