/** Controls which channels in a composite color image are displayed, where 'channels' is a list of ones and zeros that specify the channels to display. For example, "101" causes channels 1 and 3 to be displayed. */ public void setActiveChannels(String channels) { if (!(this instanceof CompositeImage)) return; boolean[] active = ((CompositeImage)this).getActiveChannels(); for (int i=0; i<active.length; i++) { boolean b = false; if (channels.length()>i && channels.charAt(i)=='1') b = true; active[i] = b; } updateAndDraw(); Channels.updateChannels(); }
/** Controls which channels in a composite color image are displayed, where 'channels' is a list of ones and zeros that specify the channels to display. For example, "101" causes channels 1 and 3 to be displayed. */ public void setActiveChannels(String channels) { if (!(this instanceof CompositeImage)) return; boolean[] active = ((CompositeImage)this).getActiveChannels(); for (int i=0; i<active.length; i++) { boolean b = false; if (channels.length()>i && channels.charAt(i)=='1') b = true; active[i] = b; } updateAndDraw(); Channels.updateChannels(); }
void getActiveChannels(ImagePlus imp) { if (!imp.isComposite()) interp.error("Composite image required"); boolean[] active = ((CompositeImage)imp).getActiveChannels(); int n = active.length; char[] chars = new char[n]; int nChannels = imp.getNChannels(); for (int i=0; i<n; i++) { if (i<nChannels) chars[i] = active[i]?'1':'0'; else chars[i] = '0'; } Variable channels = getVariableArg(); channels.setString(new String(chars)); }
void getActiveChannels(ImagePlus imp) { if (!imp.isComposite()) interp.error("Composite image required"); boolean[] active = ((CompositeImage)imp).getActiveChannels(); int n = active.length; char[] chars = new char[n]; int nChannels = imp.getNChannels(); for (int i=0; i<n; i++) { if (i<nChannels) chars[i] = active[i]?'1':'0'; else chars[i] = '0'; } Variable channels = getVariableArg(); channels.setString(new String(chars)); }
void toggleChannel(ImagePlus imp, int channel) { if (!imp.isComposite()) interp.error("Composite image required"); if (channel<1 || channel>imp.getNChannels()) interp.error("Invalid channel: "+channel); if (((CompositeImage)imp).getMode()!=IJ.COMPOSITE) ((CompositeImage)imp).setMode(IJ.COMPOSITE); boolean[] active = ((CompositeImage)imp).getActiveChannels(); active[channel-1] = active[channel-1]?false:true; imp.updateAndDraw(); Channels.updateChannels(); }
void toggleChannel(ImagePlus imp, int channel) { if (!imp.isComposite()) interp.error("Composite image required"); if (channel<1 || channel>imp.getNChannels()) interp.error("Invalid channel: "+channel); if (((CompositeImage)imp).getMode()!=IJ.COMPOSITE) ((CompositeImage)imp).setMode(IJ.COMPOSITE); boolean[] active = ((CompositeImage)imp).getActiveChannels(); active[channel-1] = active[channel-1]?false:true; imp.updateAndDraw(); Channels.updateChannels(); }
/** 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; }
public void update() { CompositeImage ci = getImage(); if (ci==null || checkbox==null) return; int n = checkbox.length; int nChannels = ci.getNChannels(); if (nChannels!=n && nChannels<=CompositeImage.MAX_CHANNELS) { instance = null; location = getLocation(); close(); new Channels(); return; } boolean[] active = ci.getActiveChannels(); for (int i=0; i<checkbox.length; i++) checkbox[i].setState(active[i]); int index = 0; switch (ci.getMode()) { case IJ.COMPOSITE: index=0; break; case IJ.COLOR: index=1; break; case IJ.GRAYSCALE: index=2; break; } choice.select(index); }
public void update() { CompositeImage ci = getImage(); if (ci==null || checkbox==null) return; int n = checkbox.length; int nChannels = ci.getNChannels(); if (nChannels!=n && nChannels<=CompositeImage.MAX_CHANNELS) { instance = null; location = getLocation(); close(); new Channels(); return; } boolean[] active = ci.getActiveChannels(); for (int i=0; i<checkbox.length; i++) checkbox[i].setState(active[i]); int index = 0; switch (ci.getMode()) { case IJ.COMPOSITE: index=0; break; case IJ.COLOR: index=1; break; case IJ.GRAYSCALE: index=2; break; } choice.select(index); }
protected void transferChannelSettings( final CompositeImage ci, final SetupAssignments setupAssignments, final VisibilityAndGrouping visibility ) { final int nChannels = ci.getNChannels(); final int mode = ci.getCompositeMode(); final boolean transferColor = mode == IJ.COMPOSITE || mode == IJ.COLOR; for ( int c = 0; c < nChannels; ++c ) { final LUT lut = ci.getChannelLut( c + 1 ); final ConverterSetup setup = setupAssignments.getConverterSetups().get( c ); if ( transferColor ) setup.setColor( new ARGBType( lut.getRGB( 255 ) ) ); setup.setDisplayRange( lut.min, lut.max ); } if ( mode == IJ.COMPOSITE ) { final boolean[] activeChannels = ci.getActiveChannels(); visibility.setDisplayMode( DisplayMode.FUSED ); for ( int i = 0; i < activeChannels.length; ++i ) visibility.setSourceActive( i, activeChannels[ i ] ); } else visibility.setDisplayMode( DisplayMode.SINGLE ); visibility.setCurrentSource( ci.getChannel() - 1 ); }
if (cb==checkbox[i]) { if (ci.getMode()==IJ.COMPOSITE) { boolean[] active = ci.getActiveChannels(); active[i] = cb.getState(); if (Recorder.record) {
if (cb==checkbox[i]) { if (ci.getMode()==IJ.COMPOSITE) { boolean[] active = ci.getActiveChannels(); active[i] = cb.getState(); if (Recorder.record) {