BodenmillerGroup / steinbock

A toolkit for processing multiplexed tissue images
https://bodenmillergroup.github.io/steinbock
MIT License
49 stars 14 forks source link

Intensities csv labeling objects only evens #241

Closed megleila closed 5 months ago

megleila commented 5 months ago

Hi Bodenmiller Group,

I am using Mesmer for segmentation, not through steinbock but directly as there were some segmentation parameters I wanted to optimize for my tissue. I had an issue with Mesmer that some of my ROI dimensions were too small in one dimension for the system to run (<256 pixels). The workaround was to pad the image in photoshop (ensuring the image is flattened), run it through Mesmer to generate the mask, and then crop the mask file to the exact dimension of the ROI.

When I put the resulting masks through steinbock, the intensities csv has only even numbered objects; doing a manual count of the segmentation, it seems that the number of cells may be close to the final (largest) even number -- ie if the segmentation image truly has 200 cells, the csv file lists objects 2, 4, 6, [...], 198, 200. I have made absolutely sure the input file going into mesmer for segmentation is flattened; I can't figure out how to get around this issue.

Thanks for all your help.

Megan

Milad4849 commented 5 months ago

Hi @megleila Thanks for your question. Please confirm that your files are the correct type and that your mask files contain labels as you expect (not only even, etc). It appears that steinbock is not the issue here and that you would have to look into your segmentation workflow for the source of the problem.

megleila commented 5 months ago

Hi -

How can I inspect that my mask file contains labels as I expect? I don’t know of a way to check to see if there are only evens, to see specific cell labeling in a mask file; tried using ImageJ Cell Annotation plugin but couldn't get this information. I have been working on this for weeks and feel like I have tried everything and I am still getting this error. The mask file going into steinbock has identical properties and file info as reported by ImageJ as every other mask file. I have attached the mask file that is giving me this issue. All mask files like this are giving me the same, evens only, issue – and I have manually confirmed that it is skipping half of the cells rather than just mis-naming them (would be simple to fix).

Megan


From: Milad Adibi @.> Sent: Monday, February 5, 2024 7:58 PM To: BodenmillerGroup/steinbock @.> Cc: Baker, Megan @.>; Mention @.> Subject: Re: [BodenmillerGroup/steinbock] Intensities csv labeling objects only evens (Issue #241)

Hi @megleilahttps://github.com/megleila Thanks for your question. Please confirm that your files are the correct typehttps://bodenmillergroup.github.io/steinbock/latest/file-types and that your mask files contain labels as you expect (not only even, etc). It appears that steinbock is not the issue here and that you would have to look into your segmentation workflow for the source of the problem.

— Reply to this email directly, view it on GitHubhttps://github.com/BodenmillerGroup/steinbock/issues/241#issuecomment-1928584302, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAH2R6OS5IO6ALPZV2H325DYSF527AVCNFSM6AAAAABC2YSLMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRYGU4DIMZQGI. You are receiving this because you were mentioned.Message ID: @.***>

Milad4849 commented 5 months ago

Hi @megleila I do not see any attachment. You can use napari for visualizing masks, depending on your configuration, you can do that via steinbock view. Alternatively you can use napari independent of steinbock. Please check your masks and, as mentioned before, confirm that your object masks have the correct file types.

megleila commented 5 months ago

Hey -- Thank you so much for this suggestion. Napari was very helpful - I hadn't explored it yet, and cross-checking the annotations it seems something about cropping the size back to the original size resulted in the evens only labeling error, and I was able to see these annotations in Napari. I was able to download the napari-crop plugin and crop the padded mask file and maintain the correct cell annotations in Napari. Thanks so much for your help!