"Thresholded 32bits float images required" error message shown when processing a 32-bit stack image

Hi! I’m working on performing a ratiometric analysis of a fluorophore which changes emission color based on the redox state of the organelle. Here is my protocol to perform ratiometric analysis in FIJI:

  1. Open image by the bio-formats importer
  2. Image → Type → 32 bit.
  3. Draw a region of interest (ROI) in an area where there are no cells. Calculate the mean intensity in this ROI.
  4. Subtract the calculated mean background from the stack.
  5. Using the subtracted z-stack, find the middle slice and threshold on mitochondria: Image → Adjust → Threshold and click Apply on the Threshold window. Apply to all slices in the stack. Check Set background pixels to NaN.
  6. Create the ratio z stack: Process → Image Calculator. Divide the reduced (470 nm excitation) stack by the oxidized (365 nm excitation) stack.
  7. Draw an ROI around the area of interest. Choose Analyze → Tools → ROI Manager, and click Add to store the ROI. Multiple regions may be stored in the manager. In ROI Manager, select all ROIs, then choose More → Multi-Measure to measure all stack slices. Export data to a spreadsheet for analysis.

My FIJI version is 1.52v. My machine OS is Mac Mojave 10.14.6.

So my problem happened in step 5. My file is already converted to 32 bit, but when I finish thresholding and set background pixels to NaN, it shows an error message said: “Thresholded 32-bit image required”. The progress bar seems to stuck in the middle of the stack.

This problem happens occasionally. I’ve tried to upgrade or downgrade to different versions of FIJI, but the problem is not solved. Sometimes it works at the first image opened, but not the rest. This also happens to my college who is using a Windows system. Interestingly, if I use a macro to perform the whole process, it doesn’t show an error message. Here I include my macro:

dir1 = getDirectory("Choose Source Directory ");

dir2 = getDirectory("Choose_Destination Directory ");

list = getFileList(dir1);

for (i=0; i<list.length; i++) {

// setup

print("\\Clear");

roiManager("reset");

roiManager("Show None");

run("Clear Results");

run("Collect Garbage");

showProgress(i+1, list.length);

filename = dir1 + list[i];

print(filename);

print(list[i]);

if (endsWith(filename, ".ome.tiff")) {

run("Bio-Formats Importer", "open=" + filename + " autoscale color_mode=Default split_channels view=Hyperstack stack_order=XYCZT");

Stack.getDimensions(width, height, ch, slices, frames);

imagewidth = width;

imageheight = height;

imageZstack = slices;

close(list[i] + " - C=0");

close(list[i] + " - C=1");

close(list[i] + " - C=5");

run("Tile");

selectWindow(list[i] + " - C=3");

setSlice((imageZstack+1)/2);

run("Enhance Contrast", "saturated=0.35");

setTool("rectangle");

waitForUser("SelectROI for background measurement for oxidized channel:");

run("Measure");

bkgoxi = getResult("Mean");

run("Select None");

selectWindow(list[i] + " - C=4");

setSlice((imageZstack+1)/2);

run("Enhance Contrast", "saturated=0.35");

setTool("rectangle");

waitForUser("SelectROI for background measurement for reduced channel:");

run("Measure");

bkgred = getResult("Mean");

run("Select None");

selectWindow(list[i] + " - C=3");

run("Subtract...", "value="+bkgoxi+" stack");

run("32-bit");

selectWindow(list[i] + " - C=4");

run("Subtract...", "value="+bkgred+" stack");

run("32-bit");

//Here is the part is puzzling me. Using the macro it goes through without a problem.

//But when I try to operate manually, it shows "A 32-bit image required" error when I convert the background to NaN.

selectWindow(list[i] + " - C=3");

setAutoThreshold("IsoData dark");

run("NaN Background", "stack");

selectWindow(list[i] + " - C=4");

setAutoThreshold("IsoData dark");

run("NaN Background", "stack");

//create ratio channel

imageCalculator("Divide create 32-bit stack", list[i] + " - C=4", list[i] + " - C=3");

setSlice((imageZstack+1)/2);

run("Enhance Contrast", "saturated=0.35");

ratioc = getInfo("window.title");

//measure roGFP ratio channel and save the file

setTool("freehand");

selectWindow(list[i] + " - C=2");

setSlice((imageZstack+1)/2);

waitForUser("Select ROIs in brightfield channel and add them into ROI manager");

roiManager("save", dir2 + list[i] + "_ROI.zip");

selectWindow(ratioc);

roiManager("multi measure");

selectWindow("Results");

saveAs("txt", dir2 + list[i] + "-results.txt");

close("*");

}

}

I also have some example images as attached.

I wonder this is a bug for FIJI that only happens when the “threshold” window is opened. Any insight would be appreciated!

JYY134-002-001.ome.tiff (5.6 MB)
JYY134-h2o2-001-005.ome.tiff (5.6 MB)

1 Like

Hey @emily.jiening.yang,

that’s a tricky one. Maybe there is a different way of achieving the same result. May I ask why you call NaN background before dividing images? What’s the desired result of that operation? You are masking it somehow, or?

Cheers,
Robert

Hi Robert! @haesleinhuepf

Thanks for the reply!
So the reason why I’m doing thresholding and NaN background is to remove background and only leave the mitochondria structure so I can get the ratiometric calculation between two channels (in my examples, it is ch4 divided by ch3). I’m only measuring the biosensor in mitochondria so need to mask out the rest. Sometimes this biosensor may generate a very high background which may skew the result. So by thresholding the image and make the background to NaN, I remove the background and it facilitates my calculation in the next step. Is there another way that I can create the mask and still do the image calculator to get the ratio between two channels in specific ROIs?
Another thing it really bugs me is it works fine when I use the macro to perform the same thing. I did not see the error message with the macro. But because I’m preparing a manuscript for the quantification method, I would like to make sure that it works when people are trying to quantify it manually without any knowledge of writing macros.

Thanks again for your help!
Emily

Hey @emily.jiening.yang,

this sounds very challenging. When going through your macro, I must admit, I was a bit confused because there are so many ROIs and channels. I couldn’t tell if/why ImageJ comes up with this error message. Nevertheless, as you’re obviously an advanced ImageJ Macro coder, I’d like to show you alternate approaches.
I realised in your data that there is C5 image, which is already masked. We could use this channel to generate a binary 3D image and then measure intensities of the objects in the other channels. Furthermore, you may want to do this measurement in 3D?

Using the MorpholibJ plugin, a potential solution would look like this:

close("*");

// open image
file = "JYY134-002-001.ome.tiff";
filename = "C:/Users/rober/Downloads/" + file;
run("Bio-Formats Importer", "open=" + filename + " autoscale color_mode=Default split_channels view=Hyperstack stack_order=XYCZT");

// simplify stack names so that MorpholibJ understands them
for (i = 0; i <= 5; i++) {
	selectWindow(file + " - C=" + i);
	rename("C" + i);
}

// threshold objects in channel 5 which are above 0
selectWindow("C5");
setThreshold(1, 65535);
setOption("BlackBackground", true);
run("Convert to Mask", "method=Default background=Dark black");

// measure intensity in 3D
run("Intensity Measurements 2D/3D", "input=C0 labels=C5 mean stddev max min median mode skewness kurtosis numberofvoxels volume neighborsmean neighborsstddev neighborsmax neighborsmin neighborsmedian neighborsmode neighborsskewness neighborskurtosis");

mean = Table.get("Mean", 0);

print("C0 Mean: " + mean);

Using CLIJ a solution would look like this:

close("*");

// open image
file = "JYY134-002-001.ome.tiff";
filename = "C:/Users/rober/Downloads/" + file;
run("Bio-Formats Importer", "open=" + filename + " autoscale color_mode=Default split_channels view=Hyperstack stack_order=XYCZT");

// initialize graphics card
run("CLIJ2 Macro Extensions", "cl_device=");
Ext.CLIJ2_clear();

// push images to the GPU
for (i = 0; i <= 5; i++) {
	selectWindow(file + " - C=" + i);
	rename("C" + i);

	// push image to GPU memory
	input = getTitle();
	Ext.CLIJ2_push(input);
}

// threshold objects in channel 5 which are above 0
Ext.CLIJ2_greaterConstant("C5", binary_image, 0);
Ext.CLIJ2_pull(binary_image);

// measure intensity in 3D
Ext.CLIJ2_statisticsOfLabelledPixels("C0", binary_image);

mean = Table.get("MEAN_INTENSITY", 0);

print("C0 Mean: " + mean);

Both solutions are obiously shorter and don’t do the full analysis of your workflow. However, I thought you may like to see how to do such measurements in 3D.

Let us know if this helps!

Cheers,
Robert

1 Like

I don’t understand why you get this error message, but when I do ratiometric image analysis I always do the thresholding and background subtraction on the original images (i.e., 8-bit, 12-bit, etc.). I only create a 32-bit image when I actually do the division, e.g.:

imageCalculator(“Divide create 32-bit stack”, “Image 1”,“Image2”);

Hope this helps,
Paul.

Hi Robert!

Thanks for the methods you provided here! Definitely learn something new and would love to try it out! Honestly, I didn’t know how to work on this type of analysis in 3D, therefore, I work on this type of analysis by 2D and sum them up afterward (which is not that efficient).
So the C5 channel is actually coming from another image analysis software. We’ve used this commercial software for a long time but I would love to switch to open-source software, which will make this quantification more available to the community. So for this quantification, I will still need to find a way to create a mask, which is the step I’m having trouble/error message with. But with your recommended 3D quantification methods, maybe I can just simply duplicate a stack and create a mask instead of “set background to NaN” to avoid the error (So far I haven’t encountered any problem with creating an 8-bit mask image).

Hi Paul,

Thanks for your comment. I’ve actually tried to convert my image to 32-bit before the thresholding but the error message still shows up. The “set background to NaN” setting requires 32-bit images so I can’t do the same thing as you did. But it is still nice to see how other people are doing the ratiometric image analysis!

I guess I don’t really understand why you need to set background to NaN?

Hi Paul!

So the reason why I need to set background to NaN is because I only want to perform the ratiometric analysis on specific area, which is the mitochondria. The biosensor I’m using to measure the redox state sometimes generates high background in the cytoplasm. That’s the reason why I need to perform thresholding and set background to NaN to remove them.

Hi Emily,
Traditionally when carrying out ratiometric imaging (e.g., fura-2) I’ve always created a binary mask by thresholding a copy of the 8-, 12- or 14-bit image (either a single image, or an average of several images at the beginning of the timelapse), then multiplied the timelapse images by the mask (in which background pixels = 0, and non-background pixels = 1).
Paul.