public void setLut(LUT lut) { if (lut==null) setColorModel(null); else { setColorModel(lut.getColorModel()); if (lut.min!=0.0 || lut.max!=0.0) setMinAndMax(lut.min, lut.max); } }
public void setColorModel(ColorModel cm) { record("setColorModel", cm, ColorModel.class); proc.setColorModel(cm); }
public void setLut(LUT lut) { if (lut==null) setColorModel(null); else { setColorModel(lut.getColorModel()); if (lut.min!=0.0 || lut.max!=0.0) setMinAndMax(lut.min, lut.max); } }
public void setColorModel(ColorModel cm) { record("setColorModel", cm, ColorModel.class); proc.setColorModel(cm); }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, new byte[256], s, new byte[256])); return ip; }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, s, s, new byte[256])); return ip; }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, s, new byte[256], new byte[256])); return ip; }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, new byte[256], new byte[256], s)); return ip; }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, s, new byte[256], s)); return ip; }
@Override public ImageProcessor process(ImageProcessor ip) { if (ip instanceof ColorProcessor) { Utils.log("Ignoring " + getClass().getSimpleName() + " filter for RGB image"); return ip; } byte[] s = new byte[256]; for (int i=0; i<256; ++i) s[i] = (byte)i; ip.setColorModel(new IndexColorModel(8, 256, new byte[256], s, s)); return ip; }
/** 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); }
/** Sets the single LUT of an ImagePlus to the first ColorTable of a Dataset */ private void setImagePlusLUTToFirstInDataset(final Dataset ds, final ImagePlus imp) { ColorTable cTable = ds.getColorTable(0); if (cTable == null) cTable = ColorTables.GRAYS; final LUT lut = make8BitLUT(cTable); imp.getProcessor().setColorModel(lut); // or imp.getStack().setColorModel(lut); }
private void setColorModel(ColorModel cm) { ImageProcessor baseImage = imagePlus.getProcessor(); baseImage.setColorModel(cm); if (imagePlus.getStackSize() > 1) { ImageStack stack = imagePlus.getStack(); stack.setColorModel(cm); } } }
/** Returns a PatchImage object containing the bottom-of-transformation-stack image and alpha mask, if any (except the AffineTransform, which is used for direct hw-accel screen rendering). */ public Patch.PatchImage createTransformedImage() { final Patch.PatchImage pi = createCoordinateTransformedImage(); if (null != pi) return pi; // else, a new one with the untransformed, original image (a duplicate): final ImageProcessor ip = getImageProcessor(); if (null == ip) return null; project.getLoader().releaseToFit(o_width, o_height, type, 3); final ImageProcessor copy = ip.duplicate(); copy.setColorModel(ip.getColorModel()); // one would expect "duplicate" to do this but it doesn't! return new PatchImage(copy, getAlphaMask(), null, new Rectangle(0, 0, o_width, o_height), false); }
private static void setGrayLUT(ImagePlus ip) { byte[] channel = new byte[256]; for (int i = 0; i < 256; i++) channel[i] = (byte)i; IndexColorModel c = new IndexColorModel(8, 256, channel, channel, channel); ip.getProcessor().setColorModel(c); if (ip.getStackSize() > 1) ip.getStack().setColorModel(c); } }
/** * Update the result image overlay with the corresponding slice */ public void updateResultOverlay() { ImageProcessor overlay = classifiedImage.getImageStack().getProcessor(displayImage.getCurrentSlice()).duplicate(); //IJ.log("updating overlay with result from slice " + displayImage.getCurrentSlice()); overlay = overlay.convertToByte(false); overlay.setColorModel(overlayLUT); win.resultOverlay.setImage(overlay); }
public void resetStack() { if (currentSlice==1 && stack!=null && stack.getSize()>0) { ColorModel cm = ip.getColorModel(); double min = ip.getMin(); double max = ip.getMax(); ImageProcessor ip2 = stack.getProcessor(1); if (ip2!=null) { ip = ip2; ip.setColorModel(cm); ip.setMinAndMax(min, max); } } }
/** * Update the result image overlay with the corresponding slice */ public void updateResultOverlay() { ImageProcessor overlay = classifiedImage.getImageStack().getProcessor(displayImage.getCurrentSlice()).duplicate(); //IJ.log("updating overlay with result from slice " + displayImage.getCurrentSlice()); overlay = overlay.convertToByte(false); overlay.setColorModel(overlayLUT); win.resultOverlay.setImage(overlay); }
private static void setPhysicsLUT(ImagePlus ip) { IndexColorModel c = new IndexColorModel(8, 256, makeColorChannel(redSteps), makeColorChannel(greenSteps), makeColorChannel(blueSteps)); ip.getProcessor().setColorModel(c); if (ip.getStackSize() > 1) ip.getStack().setColorModel(c); }
static void transfer(final ImagePlus src, final ImagePlus dst) { // Calibration: dst.setCalibration(src.getCalibration()); // Color model: final ColorModel cm = src.getProcessor().getColorModel(); dst.getProcessor().setColorModel(cm); dst.getStack().setColorModel(cm); // Min and max displaying: dst.setDisplayRange(src.getDisplayRangeMin(),src.getDisplayRangeMax()); }