Fiji freezes when displaying complex overlay

Hello all,

I have written a plugin that segments pathology images, and stores each population of cells as one ShapeRoi for visualization of the result. It has so far worked well for headless use when writing to a file, but I’m running into trouble when attempting to use it with the GUI, as displaying the output image with the overlay is making Fiji unresponsive. The images that provoke this behavior are around 2000x2000 pixels, with each ShapeRoi typically containing thousands of outlines.

Is there some way to work around this problem, to make the ROIs and overlay more lightweight perhaps? Or should I just accept this limitation and work with smaller images?

Instead of ROIs, you might want to work with label images (also known as “count masks”). For example, the #morpholibj plugin generates label images for segmentation, and Analyze Particles in plain ImageJ has an option to generate count masks.

If you want to visualize the segmentation result as an overlay on the original image, you can possibly do that using a label image within an ImageRoi instead of a ShapeRoi.