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

quantification:mcquant error after segmentation with Mesmer #475

Open
nancyliy opened this issue Jan 24, 2023 · 4 comments
Open

quantification:mcquant error after segmentation with Mesmer #475

nancyliy opened this issue Jan 24, 2023 · 4 comments

Comments

@nancyliy
Copy link

I encountered the following error when running the MCMICRO pipeline at the quantification stage of the workflow:

Error executing process > 'quantification:mcquant (1)'

Caused by:
Process quantification:mcquant (1) terminated with an error exit status (1)

Command executed:

python /app/CommandSingleCellExtraction.py --image pilot_2--mesmer.ome.tif --masks cell*.tif --output . --channel_names markers.csv

Command exit status:
1

Command output:
{'masks': ['cell.tif'], 'image': 'pilot_2--mesmer.ome.tif', 'channel_names': 'markers.csv', 'output': '.', 'intensity_props': {'intensity_mean'}, 'mask_props': None}
Extracting single-cell data for pilot_2--mesmer.ome.tif...

Command error:
WARNING: DEPRECATED USAGE: Environment variable SINGULARITYENV_TMPDIR will not be supported in the future, use APPTAINERENV_TMPDIR instead
INFO: underlay of /usr/bin/nvidia-smi required more than 50 (434) bind mounts
Traceback (most recent call last):
{'masks': ['cell.tif'], 'image': 'pilot_2--mesmer.ome.tif', 'channel_names': 'markers.csv', 'output': '.', 'intensity_props': {'intensity_mean'}, 'mask_props': None}
Extracting single-cell data for pilot_2--mesmer.ome.tif...
File "/app/CommandSingleCellExtraction.py", line 11, in
SingleCellDataExtraction.MultiExtractSingleCells(**args)
File "/app/SingleCellDataExtraction.py", line 263, in MultiExtractSingleCells
ExtractSingleCells(masks,image,channel_names,output, mask_props=mask_props, intensity_props=intensity_props)
File "/app/SingleCellDataExtraction.py", line 236, in ExtractSingleCells
scdata_z = MaskZstack(masks_loaded,image,channel_names_loaded_checked, mask_props=mask_props, intensity_props=intensity_props)
File "/app/SingleCellDataExtraction.py", line 145, in MaskZstack
MaskChannel(masks_loaded[mask_names[nm]],image_loaded_z, intensity_props=intensity_props)
File "/app/SingleCellDataExtraction.py", line 35, in MaskChannel
dat = measure.regionprops_table(
File "/home/users/nancyliy/.local/lib/python3.9/site-packages/skimage/measure/_regionprops.py", line 974, in regionprops_table
regions = regionprops(label_image, intensity_image=intensity_image,
File "/home/users/nancyliy/.local/lib/python3.9/site-packages/skimage/measure/_regionprops.py", line 1290, in regionprops
props = RegionProperties(sl, label, label_image, intensity_image,
File "/home/users/nancyliy/.local/lib/python3.9/site-packages/skimage/measure/_regionprops.py", line 288, in init
raise ValueError('Label and intensity image shapes must match,'
ValueError: Label and intensity image shapes must match, except for channel (last) axis.

The input registration image pilot_2--mesmer.ome.tif and the output mask cell*.tif are too large to be shared here but I am happy to share those files via OneDrive if needed to examine the image shapes.

Thank you!

Nextflow_Pilot2.txt

@ArtemSokolov
Copy link
Collaborator

Hi @nancyliy,

The following error indicates that the input image and the label mask have different dimensions:

ValueError: Label and intensity image shapes must match, except for channel (last) axis.

What is the width & height of pilot_2--mesmer.ome.tif and cell.tif? Was there any additional processing done to the images? It would be strange for Mesmer to produce a mask image that has different dimensions than the original image.

@nancyliy
Copy link
Author

@ArtemSokolov Thanks for your suggestion. I would like to know how to get the dimensions of input pilot_2--mesmer.ome.tif and the mask cell.tif printed from within the SingleCellDataExtraction.py attached here as sanity checks.

run_quantifictation.txt
CommandSingleCellExtraction.txt
SingleCellDataExtraction.txt

There was no additional processing done to the images beyond MCMICRO pipeline.

Thank you!

@ArtemSokolov
Copy link
Collaborator

ArtemSokolov commented Jan 26, 2023

There are a lot of different ways to determine image dimensions, depending on what's installed on your system.

import tifffile
tifffile.imread('exemplar-001/registration/exemplar-001.ome.tif').shape
# (12, 3139, 2511)
tifffile.imread('exemplar-001/segmentation/mesmer/exemplar-001.ome.tif').shape
# (3139, 2511)

In the above example, we can see that the input image contains 12 channels, each channel being a 3139 x 2511 pixel image. Similarly, the segmentation mask is a single-channel 3139 x 2511 pixel image.

@nancyliy
Copy link
Author

Thanks @ArtemSokolov ! I used your advice I found out my mask has a dimension of (11520, 19392, 2) -- suggesting it has 2 compartments. Then instead of using --compartment both, I run the mcmicro pipeline on nuclear and whole-cell separately and that successfully overcame the problem:) A big big thank you to your timely help!

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

2 participants