Login  Register

Image not found in ImageCalculator

Posted by Ihiertje on Oct 19, 2016; 2:06pm
URL: http://imagej.273.s1.nabble.com/Image-not-found-in-ImageCalculator-tp5017418.html

Hi,

I'm quite new to making macro's with Imagej. The error that I get each time is that is stays "image not found in line 70". Line 70 is the line after the imageCalculator.

I think the imageCalculator does not recognize my "fluo_mask" and 'Excit_mask' which are defined earlier. However, I tried different things like getTitle or getImageID when i selected the right window with selectWindow. However, this error still stays.

Hopefully someone can help me.

Kind regards,

Iris

// Select fluorescence image
print("Select fluorescence_raw image");
F_image = File.openDialog("Select a File");
open(F_image)
Fluo_image = getTitle();

selectWindow(Fluo_image);
waitForUser("See if it is right image and press OK, or cancel to exit macro");

//Substract the minimum of the whole image
print("substract the minimum value of the whole image");
getMinAndMax(min,max);
print(min);
run("Subtract...", "value=min");
waitForUser("See if image is subtracted and press OK, or cancel to exit macro");

// Select a threshold for this image (max. 15% of total)
print("Select threshold of max. 15 %")
run("Threshold...");                          
waitForUser("set the threshold and press OK, or cancel to exit macro");
run("Convert to Mask");
run("Divide...", "value=255.000");
selectWindow("Threshold");
run("Close");

// Save mask
print("Mask is saved");
F_mask = getTitle();
dotIndex = indexOf(F_mask,".");
Fluo_mask = substring(F_mask,0,dotIndex)
Fluo_mask = Fluo_mask+"_mask.tiff"
saveAs("Tiff", "E:\\...\\...\\Masks\\"+Fluo_mask)

// Select excitation image
print("Select excitation image");
E_image = File.openDialog("Select a File");
open(E_image)
Excit_image = getTitle();

selectWindow(Excit_image);
waitForUser("See if it is right image and press OK, or cancel to exit macro")

//Substract the minimum of the whole image
print("substract the minimum value of the whole image")
getMinAndMax(min,max)
print(min)
run("Subtract...", "value=min");
waitForUser("See if image is subtracted and press OK, or cancel to exit macro")

// Set threshold with max. of 25%.
print("Select threshold of max. 25 %");
run("Threshold...");                          
waitForUser("set the threshold and press OK, or cancel to exit macro");
run("Convert to Mask");
run("Divide...", "value=255.000");
selectWindow("Threshold");
run("Close");

// Save excitation mask
print("Mask is saved");
E_mask = getTitle();
dotIndex = indexOf(E_mask,".");
Excit_mask = substring(E_mask,0,dotIndex)
Excit_mask = Excit_mask+"_mask.tiff"
saveAs("Tiff", "E:\\....\\...\\Masks\\"+Excit_mask)

//Multiply fluorescence mask with excitation mask
imageCalculator("Multiply create 32-bit", "Fluo_mask", "Excit_mask");