I was thinking it would behave along the lines of
AbstractTileableDetectionPlugin and make use of the logic that is implemented there (or somewhere near there).
We had created a StarDist-Python connection in Groovy by exporting tiles, running the native StarDist on them and re-importing RoiSet.zip files. We had to deal with the overlaps ourselves which worked pretty well.
Then when cellpose came along, we figured we could use it in the same way, especially considering how it needs GPU to be fast enough even for inference, is not tensorflow based and needs MKL as a dependency.
So we got this groovy script that exports the tiles, calls a conda or virtualenv environment to process the image folder, and then re-imports whatever RoiSets were churned out by the script.
Right now they are not generic, and we do not make use of
TileExporter, but it would make a lot of sense to have the
TileImporter as well…
That way our script is reduced to a
ProcessBuilder command and some logic to handle normalization for the whole image rather than the individual tiles.
The idea of running python virtualenvs was that at least this way we will not have to reimplement deep learning pipelines in Java (For Fiji, or QuPath) each time we want to use them. DeepImageJ and CARE are great, but as you noticed when re-implementing StarDist, they do not contain the post-processing steps that make the algorithm so powerful (NMS suppression and Star-Convex shape estimation for StarDist).
This way we can use any pipeline from Python and it costs us one python script to handle the command line arguments that are needed.
Anyway that’s the direction we headed into and we’re super stoked that it worked out the way it did.
I was also playing around trying to make a QuPath command that checks for virtualenvs and allows you to run the
AbstractTileableDetectionPlugin logic but I got a bit stuck with how to
- Export regions (in parallel if we want)
- Run the python script (But just once, this part is not parallel nor run one time per tile)
- Make sure that the separate regions with detections are now reimported properly.
But the Groovy script does enough for now let’s say