Make OR(combine) command faster?


I have a big image (10,000 x 10,000 pixels, 8-bit), where I run Analyze Particles… and get ~ 20,000 particles added to ROI Manager (this step takes ~ 5 sec). Then, I need to clear everything outside these selected particles. So, I run OR (Combine) command in the ROI Manager, add combined ROI to the Manager and run Clear Outside.

The problem I’m facing is that running OR(Combine) command on 20,000 ROIs takes a long time (more than 30 mins). Is there a workaround to expedite this step?

Specs: running latest version of Fiji (64-bit) on a Window 10 machine, and I’ve assigned 24GB memory out of a total 32GB to Fiji. java.version: 1.8.0_172


I think I found a workaround (by replacing the OR command with Fill), which reduces the processing time from >30 min to ~15 sec and achieves the same results. I thought I’ll mention the solution here, in case someone else might come across the same issue.

In my thresholded binary image, instead of selecting particles of sizes:10-200 and then running OR command followed by Clear Outside, I am now sequentially selecting smaller (size: 0-10) and larger (size: 200-infinity) particles and filling them with the background color (black) using roiManager(“Fill”). This leaves me with the desired particles of sizes: 10-200.