Skip to content
Snippets Groups Projects
Commit 129fcef5 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Use clear_workspace() and reset_ij_options for fluorescein

parent 99177787
No related branches found
No related tags found
No related merge requests found
......@@ -233,6 +233,62 @@ function stripOmeSuffix(orig) {
return orig;
}
function clear_workspace() {
/*
* Ensure a clean workspace, i.e.
* - no open image windows
* - an empty Log window
* - no ROIs
* - no results
*/
// clear the Log window
print("\\Clear");
// close all open images
if (nImages > 0) {
run("Close All");
}
// make sure the ROI manager is empty
roiManager("reset");
// empty the results table
run("Clear Results");
}
function reset_ij_options() {
/*
* Make sure to set all relevant ImageJ options to a useful state for being
* able to provide consistent results independent of what has been
* configured or done by the user before.
*
* IMPORTANT: the order of the commands is highly relevant, on changes
* careful tests need to be done to ensure correct behavior.
*/
// disable inverting LUT
run("Appearance...", " menu=0 16-bit=Automatic");
// set foreground color to be white, background black
run("Colors...", "foreground=white background=black selection=red");
// pad edges when eroding a binary image
run("Options...", "pad");
// set saving format to .txt files
run("Input/Output...", "file=.txt");
// ============= WARNING WARNING WARNING =============//
// the commands below this marker *MUST NOT* be moved
// upwards as they seem to be overridden by some of the
// "run(...)" calls otherwise, turning them useless!
// set "Black Background" in "Binary Options"
setOption("black background", true);
}
function log_formatter(message) {
print('image "' + getTitle() + "'' [type=" + bitDepth() + "] [id=" + getImageID() + "]: " +
message);
......@@ -253,29 +309,22 @@ function logd(message) {
//////////////// set the user environment /////////////////////////////////////////////////////
// results will potentially be screwed up if other images are open, so close all:
if (nImages > 0) {
run("Close All");
}
clear_workspace();
reset_ij_options();
print("\\Clear"); // clear the Log window
print("============================================");
print("NoiSee is published in Ferrand, Schleicher & Biehlmaier et al. 2018");
print("============================================");
print("running on ImageJ version " + getVersion);
run("Options...", "pad"); // pad edges when eroding
setOption("black background", true); // set "Black Background" in "Binary Options"
// roiManager("reset"); // results are only correct if no previous ROI exists
run("Clear Results"); // empty the results table
run("Appearance...", " menu=0 16-bit=Automatic"); // disable inverting LUT
run("Colors...", "foreground=white background=black selection=red");
run("Input/Output...", "file=.txt"); // set saving format to .txt files
process_fluo();
//////////////// fluorescein method ////////////////////////////////////////////////////////////////
function process_fluo() {
setBatchMode(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment