Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active February 18, 2021 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutterer/2ebf786ace7c53c86fe60b076ed5ba0c to your computer and use it in GitHub Desktop.
Save mutterer/2ebf786ace7c53c86fe60b076ed5ba0c to your computer and use it in GitHub Desktop.
A macroset to toggle channel in composite images.
// suggested by Michael Nelson @IAMichaelNelson
// Senthil Arumugam @dopaminator suggested the jitter channel vizassist function
macro "toggle CH1 [F1]" {toggleChannel(1);}
macro "toggle CH2 [F2]" {toggleChannel(2);}
macro "toggle CH3 [F3]" {toggleChannel(3);}
macro "toggle CH4 [F4]" {toggleChannel(4);}
macro "toggle CH5 [F5]" {toggleChannel(5);}
macro "toggle CH6 [F6]" {toggleChannel(6);}
macro "toggle CH7 [F7]" {toggleChannel(7);}
macro "toggle CH7 [F8]" {jitter_channel_vizassist();}
function toggleChannel(i) {
if (nImages<1) return;
if (!is("composite")) return;
Stack.getActiveChannels(s);
c=s.substring(i-1,i);
Stack.setActiveChannels(s.substring(0,i-1)+!c+s.substring(i));
Stack.getDisplayMode(mode);
Stack.setChannel(i);
}
function jitter_channel_vizassist() {
Stack.getPosition(channel, slice, frame);
for (i=0;i<10;i++) {
toggleChannel(channel);
wait(200);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment