How to import results to use with the Multipoint tool OR how to add "Alt click" to Cell Counter?

I have written a macro for automatically identify (for counting) two cell types, but it is not perfect and needs human correction. For this I convert the output of the macro to XML format that can be loaded by the Cell Counter plugin which works very well. Then, I manually delete mis-identified non-cells and add missed cells. The only nuisance is that switching between add and delete modes required an additional click on the Cell Counter window which breaks my stride (I count a lot so this matters). Is there any way to introduce something like Alt+click of the Multi-point tool for deleting points to Cell Counter? Alternatively, is there a way to import the coordinates of auto-identified cells for use with the Multi-point?

You can use the ROI manager to save and load multipoint selections with different counters. Type [t] to add a selection to the ROI manager. To edit a multipoint selection, click on it in the ROI manager, delete or move the points you want to change, then click Update in the ROI Manager.

1 Like

Thank you @imagejan.
My process now is: 1) to do particle analysis, 2) to save the results (Center of Mass for each particle) as a text file (two columns, X and Y coordinates, respectively of the CM of each particle), and 3) to convert this text file (using an R script, for reasons that are not very good) to the xml format. Up to this point everything is automated and done en masse. Then in the Cell Counter I load the xml for each image and correct it manually.
After trying to follow your instructions, I still could not figure out how to mimic this process with the Multi-point tool. Option1 would be to convert the mulitple ROIs representing the outlines of each particle into one multi-point ROI (where each point is the CM of the partcle). Option2 is to start with the text file I can already make and convert it into a multi-point ROI. Would either of these be possible? Option 2 is preferable, since it will allow me in the future to try other, not ImageJ-based programs for detecting cells.

Another question about multi-point: One feature of the Cell Counter that is extremely useful is that in the Delete mode, the closest point to the pointer gets deleted with each click, even if that point is quite far away from the pointer. Is that possible to set up with the multi-point tool?

I would think you could achieve that by writing some script code, using the ImageJ 1.x API:

  • You can parse XML easily using SciJava Common’s XML class. Or you can parse the text directly using either java.io classes, or whatever scripting language’s sexier way of doing it (e.g. Jython File I/O).

  • Once you have the data from your file, feed it to the PointRoi constructor that takes arrays of points.

You can use the Script Editor to prototype your script. Once it is working, save it into the plugins/Scripts folder of your ImageJ installation, and put an underscore in the name somewhere, for it to appear in the menu structure as a command.

You can make your script parameterized to easily prompt the user for settings (e.g., which XML/text file to load), as well as making the command usable from a macro.

Not trivially in the UI to my knowledge—it seems you have to click on the point to be deleted while holding Alt in order to remove it using the multi-point tool. But internally, the PointRoi.deleteHandle method does search for the closest point to delete, so you could call that from your script(s) as needed. Then react to mouse events (e.g., in Jython) and delete the closest point when the circumstances are right.

Taking a step back: are you sure you need to perform manual cell counting? It really slows down your analysis, and introduces a big potential for human error. If you post a sample image along with desired segmentation (what you are currently doing manually) to a new thread here, perhaps someone can help you automate it, so that these multipoint questions become moot.

1 Like