royerlab / ultrack

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

Segment detection #75

Open tischi opened 4 months ago

tischi commented 4 months ago

I think the Otsu+EDT approach does not work very well for my new data:

image

I found in your code also this:

def _segmentation_topology(im: np.ndarray) -> np.ndarray:
    # sigmas could be tuned
    # the larger the sigma, the fewer minima you have for the watershed
    # so you can use a larger sigma to merge small segments
    sigmas = (0, 0, 2, 2) # T Z Y X
    blurred = ndi.gaussian_filter(im, sigma=sigmas)

    # normalizing
    blurred = blurred - blurred.min()
    blurred = blurred / blurred.max()

    inverted = 1.0 - blurred  # inverting
    return inverted

And I am wondering what that is? Is that simply a normalised gaussian blur?

In fact that is looking better I would say:

image
tischi commented 4 months ago

Hmmm, however for the latter I am now getting:

Explored 0 nodes (0 simplex iterations) in 0.02 seconds (0.00 work units)
Thread count was 1 (of 64 available processors)

I guess that means the watershed did not find anything?

Could you explain what one "node" is?

JoOkuma commented 4 months ago

This node is from the gurobi solver output. Each node is a solution; it looks like your tracking problem is empty.

To debug I would check:

Is your detection map non-empty?

Are you setting the min_area too high, thus removing all cells from the candidate hypothesis?

tischi commented 4 months ago

Is min_area == min_volume == min_num_pixels for 3-D?

tischi commented 4 months ago

And how could I check the detection map? I see is the call segment(detection, edges, config, overwrite=True), but it does not seem to return anything?

JoOkuma commented 4 months ago

Is min_area == min_volume == min_num_pixels for 3-D?

Yes.

And how could I check the detection map? I see is the call segment(detection, edges, config, overwrite=True), but it does not seem to return anything?

segment computes the possible partitions of the input detection map. It returns nothing because it stores these results in the database. Unfortunately, we don't have a tool to visualize this. We had one in the past, but it has not been updated. I'll open an issue for this.

If the final segmentation does not contain a lot of regions from your input detection, it means you're penalizing too much on the tracking_config.<appear, division, or disappear>_weights, and you should bring them closer to zero.

@tischi I appreciate your questions; they highlight what needs to be improved. Don't refrain from asking.