royerlab / ultrack

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

not able to add multiple segmentation layers to 'Auto detect contours from labels' workflow in the Napari plugin #162

Closed jazberna1 closed 2 weeks ago

jazberna1 commented 2 weeks ago

Hello,

If I understood well from the publication, Ultrack is able to track cells by combining multiple segmenation inputs. That's is precisely what I am trying to do using the 'Auto detect contours from labels' workflow in the Napari plugin. However from the 'labels' dropdown menu I can only select a single layer (see screenshot). It is possible that this has not been implemented in the Napari plugin?

IMG20241107113538

Thanks Jorge

JoOkuma commented 2 weeks ago

Hi @jazberna1,

This will detect individual contours, to combine them, you can do it manually using napari.

contour_1 = viewer.layers[<YOUR CONTOUR>].data
contour_2 = viewer.layers[<YOUR OTHER CONTOUR>].data
viewer.add_image((contour_1 + contour_2) / 2, name="combined contour")

foreground_1 = viewer.layers[<FOREGROUND>].data
foreground_2 = viewer.layers[<OTHER FOREGROUND>].data
viewer.add_image(np.logical_or(foreground_1, foreground_2), name="combined foreground")

does this solve your problem?

best, Jordao

jazberna1 commented 2 weeks ago

Hello @JoOkuma,

Thanks so much. I've been able to use your code above. Then I chose the 'Manual selection of inputs' workflow in Napari to select the appropiate detetion (the 'combined foreground' layer in your example) and contours (the 'combined contour' layer in your example).

Did I get it right?

Thanks! Jorge

JoOkuma commented 2 weeks ago

@jazberna1, yes, you got it right!