/** * Creates a color {@link ImagePlus} from a color {@link ImageDisplay}. Expects input expects * input ImageDisplay to have isRgbMerged() set with 3 channels of unsigned byte data. */ @Override public ImagePlus createLegacyImage(final ImageDisplay display) { final ImageDisplayService imageDisplayService = context.getService(ImageDisplayService.class); final Dataset ds = imageDisplayService.getActiveDataset(display); final ImagePlus imp = makeColorImagePlus(ds); pixelHarmonizer.updateLegacyImage(ds, imp); metadataHarmonizer.updateLegacyImage(ds, imp); positionHarmonizer.updateLegacyImage(display, imp); return imp; }
@Override public ImageDisplay createDisplay(final ImagePlus imp, final AxisType[] preferredOrder) { final Dataset ds = makeColorDataset(imp, preferredOrder); pixelHarmonizer.updateDataset(ds, imp); metadataHarmonizer.updateDataset(ds, imp); compositeHarmonizer.updateDataset(ds, imp); // CTR FIXME - add imageDisplayService.createImageDisplay method? // returns null if it cannot find an ImageDisplay-compatible display? final ImageDisplay display = (ImageDisplay) displayService.createDisplay(ds.getName(), ds); colorTableHarmonizer.updateDisplay(display, imp); // NB - correct thresholding behavior requires overlay harmonization after // color table harmonization overlayHarmonizer.updateDisplay(display, imp); positionHarmonizer.updateDisplay(display, imp); nameHarmonizer.updateDisplay(display, imp); return display; }