Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating segmentation masks for small images #709

Open
ashishshel opened this issue Jan 29, 2024 · 3 comments
Open

Error creating segmentation masks for small images #709

ashishshel opened this issue Jan 29, 2024 · 3 comments

Comments

@ashishshel
Copy link

Hi,
I have configured and set up the Mesmer pipeline to generate cell segmentation masks from DNA and Membrane tif files. The pipeline works well with all images that are above 256*256 dimensions. However, for images smaller than these dimensions I am getting an error indicating an incompatibility with shape. I have attached screenshots of the error. Further, I have also checked if there was a 'lower limit' for the image dimensions hard-coded in the scripts for the pipeline but could not find it. Could you please guide me in resolving this issue. Thanks.
Screenshot 2024-01-29 at 3 33 51 PM
Screenshot 2024-01-29 at 3 34 42 PM

@ngreenwald
Copy link
Collaborator

Hmmm, interesting issue. What should happen is that images smaller than 256x256 are padded prior to prediction. It seems that logic may not be working correctly. I'm wondering if this is because one of your dimensions is larger, and the other smaller? Maybe we only check the first dim, not both?

As a workaround, you can create a 286x286 blank image, and then assign your smaller image within that larger padded version. The padded image will be able to generate predictions, and then you can subset back out the original 286x206.

@megleila
Copy link

Hello -

I did this and am getting a new issue. Small ROIs, specifically with one dimension less than 256, will not be processed using Mesmer. So I have done as you said and assigned the DNA and Membrane channels within a larger canvas background in photoshop and flatten the image. I send the larger image through Mesmer and it works, and then crop it back to the original size. However in downstream analyses the mask file is only being read as having even numbered cells; ie every other cell is not picked up. E.g. if the true number of cells in an image is 154, cells 2,4,6,...,154 will be listed in output csv files, but the even numbered cells are missed. I have manually counted the cells on the image and confirmed that it's not simply mis-numbering, but actually missing exactly half of the cells.

I've looked at the mask files that have undergone this process and they appear (in ImageJ) to have identical properties and file info. I cannot figure out how to get around this. I asked the downstream analysis software I use (steinbock, bodenmiller lab) and they say it has to be related to the mask rather than anything to do with steinbock. Attaching a mask file that has undergone this cropping process that has this issue for reference.

Thanks,
Megan

Batch17_004.tiff.zip

@rossbar
Copy link
Contributor

rossbar commented Feb 14, 2024

Which version of deepcell-tf are you using? There was a problem with small tiles that was fixed by #673, though I'm not sure that's the same issue as reported here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants