Image not found in ImageCalculator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image not found in ImageCalculator

Ihiertje
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");
Reply | Threaded
Open this post in threaded view
|

Re: Image not found in ImageCalculator

Volker Baecker
Hi Iris,
the line

imageCalculator("Multiply create 32-bit", "Fluo_mask", "Excit_mask");

should be
imageCalculator("Multiply create 32-bit", Fluo_mask, Excit_mask);

if you put the name into quotes the image calculator will look for
images with the titles Fluo_Mask and Excit_mask and not interpret
Fluo_Mask and Exit_Mask as variables.

The title as returned by getTitle() without any modifications should be
fine.

I hope this helps a little.

Best regards,
Volker

Ihiertje:

> 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");
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Image-not-found-in-ImageCalculator-tp5017418.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html