Best tool for manually identifying objects of more than one class?

Dear all,

Would anyone be able to suggest the best software/tool for manually outlining objects of more than one class (e.g. Cell Type 1, Cell Type 2) and then being able to save all of:

  1. The combined mask for all objects (instance-level; uint8)
  2. The separate masks for each of the two or more classes of objects (instance-level; uint8)

I have considered using the IdentifyObjectsManually module in CellProfiler but it doesn’t seem to be possible to label more than one class of object on the same image in one pass and recombining two separate masks faithfully seems tricky (Converting Objects to Images, Saving Images, Image Math on images, Identifying Primary Objects, etc.).

I have also thought about using the ROI Manager on FIJI ImageJ. Is there a tool/script available to identify different classes of object in one pass on here and save the separate and combined masks in one go (uint8 object level)?

Alternative suggestions also appreciated!

Many thanks
Emma

I am not quite sure what you mean by “one pass”. Either way, you are going to have to stop and tell it which is which at some point. If you use the ROI manager in ImageJ, you can just select all the ones belonging to the same class and then save them. Then move on to the next class. If by “one pass”, you mean you want to select everything before saving anything, then you can do that with the ROI manager; you just need to remember which is which and then, when saving, select only those that are in the same class. If you want something that will keep track of which is which for you, you could consider using the Trainable Weka Segmentation plugin for ImageJ (included by default with Fiji). It does that as part of a larger process which you may not be interested in. After you have classified the cells, you can then transfer them (albeit one at a time) to the ROI manager.

I am not sure about other software like CellProfiler.

Similar to Weka, I think Ilastik could be a good option as well.

  • Select Pixel classification
  • Open your image
  • Feature selection in your case is not relevant since you wont train a model (maybe you still have to select one)
  • Create your classes
  • Paint on your images
  • Right clic on label and export the mask image.

If you open it in Fiji, it will look black most probably because it is a binary image (0-1 pixel values). But if you move the mouse over you will see that it is not 0 everywhere (you can also try to adjust Brightness/contrast)

There are also dedicated platform for outlining object with Polygon ROI
See :

1 Like

Thanks Andrew. It sounds like ROI Manager is going to be the best option.

Apologies for not being clear. In terms of ‘one pass’ I meant being able to do the outlining for the different object classes on a single image so that I can see all the outlines for Class 1 objects and Class 2 objects on the same image (perhaps highlighted in a different colour for each for example) while I’m doing my manual outlining.

In CellProfiler, it looks like I would have to just outline/label the Class 1 objects and then reload the raw image and just outline/label the Class 2 objects without being able to see the Class 1 labels I have already drawn. (I have thought of some potential workarounds to this combining different CP modules but it’s a bit clunky and I’d rather just be able to label different classes of object on the same image in one go.)

Thanks for your help!

Thanks for this. This looks useful!

Could I save my Ilastik mask as an object/instance level mask rather than as a binary (1 vs 0) mask for each class?

i.e. If I have clumped cells that I am manually outlining- am I able to export a mask that still maintains the instance-level information as well as the binary 1 vs 0 for cell vs background? I wouldn’t want the clumped cells to be exported as one large cell object; instead I’d imagine that each pixel almost has two labels attached to it (one for if it is cell vs background (1 vs 0); and the other a unique identifier that says to which cell object it belongs). In CellProfiler this is achieved by first saving my identified objects as a uint16 image before saving as a 16-bit TIFF.

Let me know if that doesn’t make sense and I can clarify further.

It’s probably not going to be a very popular answer, but for doing multi class at once I actually often like to use photoshop and just use actions (F1 f2 etc) to rapidly change between the R G B brushes, Once complete on an image, I script another action to remove the template layer and flatten.save as a mask image - this you can then load into CP, FIJI, or whatever other tool for further processing. I opt for PS vs any other solution just because I find it to be the quickest at browsing/marking up RGB images of 10k x 10k dimensions (zooming, panning, switching tools) effortlessly.

2 Likes

Thanks for this! Will also take a look at this.

Unfortunately it does not seem possible, the default saves a binary mask for each class so each cell of a given class will have the same identifier… Even by painting actually, if 2 cells of the same class are touching you dont really have a chance to tell that they are separate objects.
Maybe someone from Ilastik could comment on that.

I agree with @BoZap, I used similarly the freeware Paint.NET once because it is very convenient with the layer system, you can have different color/cells in the same layer/class. You can erase… And each layer can be saved as a tif image.

You still have to take care that you dont have overlap between the paintings of separate layers otherwise I dont know how your classifier would deal with multiple classes for a given pixel.

If no one else will suggest it then I guess I will… you may want to try QuPath (https://qupath.github.io/)

It has various tools to create annotations of different kinds (see examples), with lots of shortcuts and tricks to help make your annotations more accurate.

For example, there are brush and wand tools that can adapt their size according to zoom [which you can control with the mouse wheel], and which can instantly turn into eraser tools if you press the Alt key). You can control the annotation visibility by pressing A, and if you’re working with fluorescence data you can toggle channels on and off by pressing the corresponding numeric key.

There’s also built-in support to define your own classes and the colors used to display them, and you can view them even when overlapping (either filled or unfilled, Shift + F). At the end you can easily convert the annotations to ImageJ ROIs, or export them however you like with custom scripts.

There are some video tutorials at here that show the annotation tools in action, along with various other features.

Disclosure: I wrote QuPath… and gave quite a lot of attention to making the process of annotating images less unpleasant, since I had to do it a lot.

3 Likes

Thanks for this. All very useful.

Thanks Pete. I will definitely take a look at this!

I have heard of QuPath but hadn’t yet had a chance to delve into its functionality. It sounds like it may have a lot of what I’m after. I’ll watch the videos and give it a try and let you know how it goes.

TrakEM2 https://imagej.net/TrakEM2 is not too bad for manual annotation.