Discussion:
"Stack to Hyperstack" in Batch Mode
sebastian06
2012-06-04 13:19:41 UTC
Permalink
Hi,

I have a macro which used the stack splitter. And since I do not want all
the images to be displayed (after the splitting) I try to use the Batch
Mode.

part of code:

...
setBatchMode(true);
// split complete file into single tiles --> z-stacks
run("Stack Splitter", "number="+numstacks);

// close original window
wait(1000);
selectImage(title_orig);
close();

// save splitted z-stacks and adapt dimensions
for (i=1; i<=numstacks; i++) {

if (i > 999){
fidstr = i; // i has 4 digits
current_title = "stk_"+i+"_"+title_orig;
}
else if (i > 99){
fidstr = "0"+i; // i has 3 digits
current_title = "stk_0"+i+"_"+title_orig;
}
else if (i > 9){
fidstr = "00"+i; // i has 2 digits
current_title = "stk_00"+i+"_"+title_orig;
}
else if (i > 0){
fidstr = "000"+i; // i has 1 digit
current_title = "stk_000"+i+"_"+title_orig;
}

selectImage(current_title); // select current image
run("Stack to Hyperstack...", "order=xyczt(default) channels="+numch+"
slices="+numz+" frames="+numt+" display=Grayscale");
save(substackdir+"tile_"+fidstr+".tif");
print("Current Tile Saved: ","tile_"+fidstr+".tif");
selectImage(current_title);
close();

}
...



But all the tiles are always displayed during. If I comment the line, where
the stack in converted to a hyperstack ( run("Stack to
Hyperstack...","order ...), the images are not displayed. Why is this
command "overrides" the setBatchMode(true)? Is this expected?

So my question is, how can I prevent the image display since I have to use
this line.

Cheers,

Sebi
--
Please avoid top-posting, and please make sure to reply-to-all!

Mailing list web interface: http://groups.google.com/group/fiji-users
Wayne Rasband
2012-06-04 16:23:51 UTC
Permalink
Hi,
I have a macro which used the stack splitter. And since I do not want all the images to be displayed (after the splitting) I try to use the Batch Mode.
...
setBatchMode(true);
// split complete file into single tiles --> z-stacks
run("Stack Splitter", "number="+numstacks);
// close original window
wait(1000);
selectImage(title_orig);
close();
// save splitted z-stacks and adapt dimensions
for (i=1; i<=numstacks; i++) {
if (i > 999){
fidstr = i; // i has 4 digits
current_title = "stk_"+i+"_"+title_orig;
}
else if (i > 99){
fidstr = "0"+i; // i has 3 digits
current_title = "stk_0"+i+"_"+title_orig;
}
else if (i > 9){
fidstr = "00"+i; // i has 2 digits
current_title = "stk_00"+i+"_"+title_orig;
}
else if (i > 0){
fidstr = "000"+i; // i has 1 digit
current_title = "stk_000"+i+"_"+title_orig;
}
selectImage(current_title); // select current image
run("Stack to Hyperstack...", "order=xyczt(default) channels="+numch+" slices="+numz+" frames="+numt+" display=Grayscale");
save(substackdir+"tile_"+fidstr+".tif");
print("Current Tile Saved: ","tile_"+fidstr+".tif");
selectImage(current_title);
close();
}
...
But all the tiles are always displayed during. If I comment the line, where the stack in converted to a hyperstack ( run("Stack to Hyperstack...","order ...), the images are not displayed. Why is this command "overrides" the setBatchMode(true)? Is this expected?
This bug is fixed in the ImageJ 1.46p daily build. You can upgrade by using the Help>Update ImageJ command and selecting "daily build" from the drop down menu.

-wayne
--
Please avoid top-posting, and please make sure to reply-to-all!

Mailing list web interface: http://groups.google.com/group/fiji-users
sebastian06
2012-06-04 20:24:20 UTC
Permalink
Perfect.

Thanks, Sebi
Post by sebastian06
Hi,
I have a macro which used the stack splitter. And since I do not want
all the images to be displayed (after the splitting) I try to use the Batch
Mode.
Post by sebastian06
...
setBatchMode(true);
// split complete file into single tiles --> z-stacks
run("Stack Splitter", "number="+numstacks);
// close original window
wait(1000);
selectImage(title_orig);
close();
// save splitted z-stacks and adapt dimensions
for (i=1; i<=numstacks; i++) {
if (i > 999){
fidstr = i; // i has 4 digits
current_title = "stk_"+i+"_"+title_orig;
}
else if (i > 99){
fidstr = "0"+i; // i has 3 digits
current_title = "stk_0"+i+"_"+title_orig;
}
else if (i > 9){
fidstr = "00"+i; // i has 2 digits
current_title = "stk_00"+i+"_"+title_orig;
}
else if (i > 0){
fidstr = "000"+i; // i has 1 digit
current_title = "stk_000"+i+"_"+title_orig;
}
selectImage(current_title); // select current image
run("Stack to Hyperstack...", "order=xyczt(default)
channels="+numch+" slices="+numz+" frames="+numt+" display=Grayscale");
Post by sebastian06
save(substackdir+"tile_"+fidstr+".tif");
print("Current Tile Saved: ","tile_"+fidstr+".tif");
selectImage(current_title);
close();
}
...
But all the tiles are always displayed during. If I comment the line,
where the stack in converted to a hyperstack ( run("Stack to
Hyperstack...","order ...), the images are not displayed. Why is this
command "overrides" the setBatchMode(true)? Is this expected?
This bug is fixed in the ImageJ 1.46p daily build. You can upgrade by
using the Help>Update ImageJ command and selecting "daily build" from the
drop down menu.
-wayne
--
Please avoid top-posting, and please make sure to reply-to-all!

Mailing list web interface: http://groups.google.com/group/fiji-users
Loading...