public void saveDisplayRangesAndLuts(ImagePlus imp, FileInfo fi) { CompositeImage ci = (CompositeImage)imp; int channels = imp.getNChannels(); fi.displayRanges = new double[channels*2]; for (int i=1; i<=channels; i++) { LUT lut = ci.getChannelLut(i); fi.displayRanges[(i-1)*2] = lut.min; fi.displayRanges[(i-1)*2+1] = lut.max; } if (ci.hasCustomLuts()) { fi.channelLuts = new byte[channels][]; for (int i=0; i<channels; i++) { LUT lut = ci.getChannelLut(i+1); byte[] bytes = lut.getBytes(); if (bytes==null) {fi.channelLuts=null; break;} fi.channelLuts[i] = bytes; } } }
public void saveDisplayRangesAndLuts(ImagePlus imp, FileInfo fi) { CompositeImage ci = (CompositeImage)imp; int channels = imp.getNChannels(); fi.displayRanges = new double[channels*2]; for (int i=1; i<=channels; i++) { LUT lut = ci.getChannelLut(i); fi.displayRanges[(i-1)*2] = lut.min; fi.displayRanges[(i-1)*2+1] = lut.max; } if (ci.hasCustomLuts()) { fi.channelLuts = new byte[channels][]; for (int i=0; i<channels; i++) { LUT lut = ci.getChannelLut(i+1); byte[] bytes = lut.getBytes(); if (bytes==null) {fi.channelLuts=null; break;} fi.channelLuts[i] = bytes; } } }
/** Copies the LUTs and display mode of 'imp' to this image. Does nothing if 'imp' is not a CompositeImage or 'imp' and this image do not have the same number of channels. */ public synchronized void copyLuts(ImagePlus imp) { int channels = getNChannels(); if (!imp.isComposite() || imp.getNChannels()!=channels) return; CompositeImage ci = (CompositeImage)imp; LUT[] luts = ci.getLuts(); if (luts!=null && luts.length==channels) { lut = luts; cip = null; } int mode2 = ci.getMode(); setMode(mode2); if (mode2==COMPOSITE) { boolean[] active2 = ci.getActiveChannels(); for (int i=0; i<MAX_CHANNELS; i++) active[i] = active2[i]; } if (ci.hasCustomLuts()) customLuts = true; }
/** Copies the LUTs and display mode of 'imp' to this image. Does nothing if 'imp' is not a CompositeImage or 'imp' and this image do not have the same number of channels. */ public synchronized void copyLuts(ImagePlus imp) { int channels = getNChannels(); if (!imp.isComposite() || imp.getNChannels()!=channels) return; CompositeImage ci = (CompositeImage)imp; LUT[] luts = ci.getLuts(); if (luts!=null && luts.length==channels) { lut = luts; cip = null; } int mode2 = ci.getMode(); setMode(mode2); if (mode2==COMPOSITE) { boolean[] active2 = ci.getActiveChannels(); for (int i=0; i<MAX_CHANNELS; i++) active[i] = active2[i]; } if (ci.hasCustomLuts()) customLuts = true; }
assertTrue(ci.hasCustomLuts());
assertTrue(ci.hasCustomLuts());
assertTrue(ci.hasCustomLuts());
assertFalse(ci.hasCustomLuts());
assertTrue(ci.hasCustomLuts());
assertTrue(ci.hasCustomLuts());
assertEquals(chanPerPlane > 1, ci.hasCustomLuts());