Show labels in different color

analyze-particles
imagej
label

#1

Hi i am new to ImageJ and i am doing a porosity analysis.

In the “Analyze Particle” window you can check “Add to Manager”. And after analysis is done i have labels in all of my detected pores. But since my pores are black and my labels in black too i cannot see the labels anymore. Is there a way to make them visible?
And is there a way to search for a specific label in the image?

Thanks!


Inconsistency displaying labels in my particles - ImageJ or Me?
#2

@Manuel_Fuelling

If I am understanding your issue correctly… I think all you have to do is go in your ROI Manager window to "More >>" > "Labels" and then there you can adjust the color.

And for searching for a label… you will have to Script something for this. Is that what you were aiming to do? You can check the Built-in Macro Functions list for appropriate function calls…

eta


#3

You can set the color and size of labels in the Image>Overlay>Labels dialog. Here is a macro example:

  run("Blobs (25K)");
  setAutoThreshold("Default");
  run("Analyze Particles...", "size=200 show=Overlay exclude");
  resetThreshold();
  run("Labels...", "color=white font=14 show draw bold");
  run("In [+]");


#4

Thanks! that helped a lot.
Somehow the labels are gone, after closing the image and reopening. if i save it as tiff then only the overlay is saved. How can i save the labels?


#5

The labels and overlay are saved with the image when you save in TIFF format and reopen in ImageJ. To export to other programs, flatten the image (Image>Overlay>Flatten) before saving.


#6

Hi Wayne,

Sorry to butt in but I’ve come across an issue when I try to export as you suggested here. I’ve added labels onto TIFF files using the Multi-point tool and now want to export the image with the labels on it. I find that the Flatten function only works if the label type is ‘dot’. Using circle or crosshair there’s no visible labels in the saved PNG image when I re-open it later. Am I missing something?

Thanks!


#7

I am unable to reproduce this problem. I created medium sized point selections in each of the four supported types, added them to an overlay, flattened the image and saved it in PNG format, and found the labels were easily readable when the image was reopened (see screenshot).

Screenshot


#8

Hi Wayne,

Thanks so much for looking into this. I have done a few tests again and it seems like the issue is not dependent on the type of point as I initially thought.

What I find is that when, after using the point or multi-point tool, I run Image>Overlay>Flatten and save as PNG the image is saved but doesn’t display the points (see on the left of the screenshot below). The issue appears to be circumvented by running Flatten twice on the image before saving as PNG (see on the right of the screenshot below).

I’d never used the points tool before, so I don’t know if this could be because I’m working with a multichannel TIFF? It’s not a huge issue anyway but I was mostly curious to figure out what the issue might be.

Thanks again,

Carlos


#9

I can confirm that the behavior of the Flatten command is inconsistent when using multi-channel composite images and multi-point selections. The following macro illustrates the issue:

newImage("HyperStack", "8-bit composite-mode label", 200, 200, 3, 1, 1);
xPoints = newArray(50,50,50);
yPoints = newArray(35,50,65);
makeSelection("point", xPoints, yPoints)
getDimensions(_, _, channels, _, _);
print("Before: " + channels + " channel(s)");
print("Before: " + Overlay.size + " elements in overlay");
eval("script", "IJ.log(\"Current selection: \" + IJ.getImage().getRoi());");
print("*****");
run("Flatten");
rename("first flattened");
getDimensions(_, _, channels, _, _);
print("After first flatten: " + channels + " channel(s)");
print("After first flatten: " + Overlay.size + " elements in overlay");
eval("script", "IJ.log(\"Current selection: \" + IJ.getImage().getRoi());");
print("*****");
run("Flatten");
rename("second flattened");
getDimensions(_, _, channels, _, _);
print("After second flatten: " + channels + " channel(s)");
print("After second flatten: " + Overlay.size + " elements in overlay");
eval("script", "IJ.log(\"Current selection: \" + IJ.getImage().getRoi());");

which produces the output:

Before: 3 channel(s)
Before: 3 elements in overlay
Current selection: Roi[Points, count=3]
*****
After first flatten: 1 channel(s)
After first flatten: 0 elements in overlay
Current selection: Roi[Points, count=3]
*****
After second flatten: 1 channel(s)
After second flatten: 0 elements in overlay
Current selection: null