royerlab / ultrack

Cell tracking and segmentation software
https://royerlab.github.io/ultrack
BSD 3-Clause "New" or "Revised" License
86 stars 11 forks source link

Retrieve only instance segmentation masks #136

Open ajinkya-kulkarni opened 1 month ago

ajinkya-kulkarni commented 1 month ago

Hello team, thanks for the repo! I was wondering if there is a way to get only the instance segmented masks instead of the added tracking as well. I find the ensemble segmentation idea really useful, and would like to ideally train ultrack on a custom dataset (2D images and their 2D instance segmented masks), and infer the trained model on unseen 2D images.

JoOkuma commented 1 month ago

Hi @ajinkya-kulkarni, you could provide a copy of your 2D images and create a time-lapse as:

video = np.stack([image] * 5)

and run ultrack on it as a timelapse with max_noise above 0, for example config.segmentation_config.max_noise = 0.01.

Then you select a single plane from the output video, they should be very similar because they are the original image with a bit of noise.

The noise is necessary because all of your images are the same.

ajinkya-kulkarni commented 1 month ago

Interesting, thanks, will try it out!

ajinkya-kulkarni commented 1 month ago

Hi @JoOkuma, planning to try your suggestion today. Do you have a minimal example notebook I can try out for just getting the masks from my images?