Project

General

Profile

Files » Next_Image_As_Hyperstack_Tool.txt

added the default channel as option - Volker Baecker, 05/10/2012 11:42 AM

 
/**
* MRI Next_Image_As_Hyperstack_Tool
*
* Open the first image in a folder with rgb images. Press the "c" button to convert the image to a hyperstack.
* With the "n" button you can now open the next image in the folder and it will automatically be opened as
* a hyperstack.
*
* written 2012 by Volker Baecker (INSERM) at Montpellier RIO Imaging (www.mri.cnrs.fr)
*/

var helpURL = "http://dev.mri.cnrs.fr/wiki/imagej-macros/Next_Image_As_Hyperstack_Tool";
var display_modes = newArray("Composite", "Color", "Grayscale");
var display_mode = "Color";
var channels = newArray("1", "2", "3");
var default_channel = 1;

macro "Unused Tool - C037" { }

macro "Next Image As Hyperstack Tool Help Action Tool - C000T4b12?"{
run('URL...', 'url='+helpURL);
}

macro "Convert image to hyperstack Action Tool - C000T4b12c" {
run("RGB Stack");
run("Stack to Hyperstack...", "order=xyczt(default) channels=3 slices=1 frames=1 display="+display_mode);
Stack.setChannel(default_channel);
}

macro "Convert image to hyperstack Action Tool Options" {
getOptionsFromUser();
}

macro "Next image as hyperstack Action Tool - C000T4b12n" {
Stack.setChannel(1);
run("Open Next");
run("RGB Stack");
run("Stack to Hyperstack...", "order=xyczt(default) channels=3 slices=1 frames=1 display="+display_mode);
Stack.setChannel(default_channel);
}

macro "Next image as hyperstack Action Tool Options" {
getOptionsFromUser();
}

function getOptionsFromUser() {
Dialog.create("Next Image As Hyperstack Options");
Dialog.addChoice("display mode", display_modes, display_mode);
Dialog.addChoice("default channel", channels, default_channel);
Dialog.show();
display_mode = Dialog.getChoice();
default_channel = Dialog.getChoice();
}
(1-1/3)