//imageJ array is zero ordered FYI channel=getArgument(); Stack.getActiveChannels(activeChan); if (substring(activeChan,channel-1,channel)=="1"){ activeChan=substring(activeChan,0,channel-1)+"0"+substring(activeChan,channel,lengthOf(activeChan)); //if 1 is there change that to a 0 and reverse } else { activeChan=substring(activeChan,0,channel-1)+"1"+substring(activeChan,channel,lengthOf(activeChan)); } Stack.setActiveChannels(activeChan);