Hello evrybody =)
I am trying to write a macro which should process pictures in the last subfolder and have some problems. The microscope saves the images as following:
FolderA --> Sample1 --> stack --> frame_t_0.ets
FolderA --> Sample2 --> stack --> frame_t_0.ets
This means, the “FolderA” and “Sample1” folders will not contain any images, only the last folder (“stack”) will contain one file ("frame_t_0.ets). I would like ImageJ to process the frame_t_0.ets file and name it f.ex. Sample2_blue.
My macro starts like this:
input = getDirectory(“Input directory”);
output = “output_”+input;
suffix = “.ets”;
processFolder(input);
function processFolder(input) {
list = getFileList(input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + list[i]))
processFolder("" + input + list[i]);
if(endsWith(list[i], suffix))
{
path = input+list[i];
setBatchMode(true);
title = File.nameWithoutExtension;
run
if I try to run it, it just doesn’t do anything…I hope somebody can help me!
(additional info: on the mac of a friend this macro works, just not on my windows pc)
hole macro:
input = getDirectory(“Input directory”);
output = “output_”+input;
suffix = “.ets”;
processFolder(input);
function processFolder(input) {
list = getFileList(input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + list[i]))
processFolder("" + input + list[i]);
if(endsWith(list[i], suffix))
{
path = input+list[i];
setBatchMode(true);
title = File.nameWithoutExtension;
run(“Bio-Formats”, “open=[path] autoscale color_mode=Custom open_all_series split_channels view=Hyperstack stack_order=XYCZT use_virtual_stack series_0_channel_0_red=0 series_0_channel_0_blue=255 series_0_channel_1_red=255 series_0_channel_1_blue=0 series_1_channel_0_red=0 series_1_channel_0_blue=255 series_1_channel_1_red=255 series_1_channel_1_blue=0”);
selectWindow(“frame_t_0.ets - TRITC, DAPI - C=1”);
run(“Z Project…”, “start=1 stop=20 projection=[Max Intensity]”);
run(“Blue”);
saveAs(“JPEG”, input+“blue.jpg”);
selectWindow(“frame_t_0.ets - TRITC, DAPI - C=1”);
close();
selectWindow(“frame_t_0.ets - TRITC, DAPI - C=0”);
run(“Z Project…”, “start=1 stop=20 projection=[Max Intensity]”);
run(“Red”);
saveAs(“JPEG”, input+“red.jpg”);
selectWindow(“frame_t_0.ets - TRITC, DAPI - C=0”);
close();
selectWindow(“MAX_frame_t_0.ets - TRITC, DAPI - C=0”);
run(“Merge Channels…”, “c3=[MAX_frame_t_0.ets - TRITC, DAPI - C=1] c1=[MAX_frame_t_0.ets - TRITC, DAPI - C=0]”);
saveAs(“JPEG”, input+“merged.jpd”);
run(“Close”);
setBatchMode(false);
selectImage(nImages);
close();
}