BodenmillerGroup / steinbock

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

random forest-based segmentation using Ilastik/CellProfiler #249

Closed mjnajafpanah closed 3 months ago

mjnajafpanah commented 3 months ago

I'm analyzing an IMC tissue image dataset (which have 33 channels). When I'm using steinbock toolkit to process the data, I setup the steinbock alias and pull the late version of docker container and move on with the processing steps as follow:

Go to the working directory where the 'raw' folder is located

BASEDIR=$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) cd "${BASEDIR}"

steinbock alias setup

shopt -s expand_aliases alias steinbock="docker run -v ${BASEDIR}:/data -u $(id -u):$(id -g) ghcr.io/bodenmillergroup/steinbock:0.16.1"

raw data preprocessing

steinbock preprocess imc panel --help

$ steinbock preprocess imc panel --channelcol channel --namecol name $ steinbock preprocess imc images --hpf 50

random forest-based segmentation using Ilastik/CellProfiler

$ steinbock classify ilastik prepare --cropsize 512 --seed 12345

As I'm working in my dataset, I'm skipping these two lines (which is related to the example dataset if I'm right):

rm pixel_classifier.ilp && mv IMCWorkflow.ilp pixel_classifier.ilp

rm -r ilastik_crops && mv analysis/crops ilastik_crops

Then, I'm getting error following the classify ilastik fix step; which still haven't found a solution! Please let me know if you have any idea.

$ steinbock classify ilastik fix Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/app/steinbock/steinbock/main.py", line 17, in steinbock_cmd_group(prog_name="steinbock") File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/opt/steinbock-venv/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) File "/app/steinbock/steinbock/_cli/utils.py", line 34, in wrapper return func(args, **kwargs) File "/app/steinbock/steinbock/classification/_cli/ilastik.py", line 336, in fix_cmd ilastik.fix_ilastik_project_file_inplace( File "/app/steinbock/steinbock/classification/ilastik/_ilastik.py", line 385, in fix_ilastik_project_file_inplace _fix_input_data_group_inplace( File "/app/steinbock/steinbock/classification/ilastik/_ilastik.py", line 421, in _fix_input_data_group_inplace shape=ilastik_crop_shapes[ilastik_crop_file.stem], KeyError: '231019_Espinoza_S08_5231_A6_1_001_x1390_y451_w512_h512'

nilseling commented 3 months ago

Transferring here since this is steinbock related.

Milad4849 commented 3 months ago

Hi @mjnajafpanah Before I look at this in any detail:

mjnajafpanah commented 3 months ago

Hi @Milad4849 You right. Some of the images have low dimensions. Even if I remove those strange .tiff files the error still happening. Using deep-learning algorithm I'm also getting an error the following error: (As I said my images has 33 channels and the program complaining about the number of channels. Is there a pre-step that I'm missing?)

$ steinbock segment deepcell --app mesmer -o masks_deepcell 2024-04-04 17:24:59,679 ERROR steinbock.segmentation.deepcell - Error segmenting objects in img/231019_Espinoza_S08_5231_A6_1_001.tiff: Invalid number of aggregated channels: expected 2, got 33 Traceback (most recent call last): File "/app/steinbock/steinbock/segmentation/deepcell.py", line 130, in try_segment_objects raise SteinbockDeepcellSegmentationException( steinbock.segmentation.deepcell.SteinbockDeepcellSegmentationException: Invalid number of aggregated channels: expected 2, got 33 2024-04-04 17:24:59,768 ERROR steinbock.segmentation.deepcell - Error segmenting objects in img/231019_Espinoza_S08_5231_A6_1_002.tiff: Invalid number of aggregated channels: expected 2, got 33 Traceback (most recent call last): File "/app/steinbock/steinbock/segmentation/deepcell.py", line 130, in try_segment_objects raise SteinbockDeepcellSegmentationException( steinbock.segmentation.deepcell.SteinbockDeepcellSegmentationException: Invalid number of aggregated channels: expected 2, got 33 2024-04-04 17:24:59,850 ERROR steinbock.segmentation.deepcell - Error segmenting objects in img/231019_Espinoza_S08_5231_A6_1_003.tiff: Invalid number of aggregated channels: expected 2, got 33

Milad4849 commented 3 months ago
Milad4849 commented 3 months ago

Please close the issue if your problem is resolved.

mjnajafpanah commented 3 months ago

Done. Thanks.

Mohammad


From: Milad Adibi @.> Sent: Tuesday, April 16, 2024 6:53 PM To: BodenmillerGroup/steinbock @.> Cc: Najaf Panah, Mohammad Javad @.>; Mention @.> Subject: Re: [BodenmillerGroup/steinbock] random forest-based segmentation using Ilastik/CellProfiler (Issue #249)

CAUTION: This email is not from a BCM Source. Only click links or open attachments you know are safe.


Please close the issue if your problem is resolved.

— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BodenmillerGroup_steinbock_issues_249-23issuecomment-2D2060085247&d=DwMFaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=4DhvbN7IEXgxPlg3Sc_Ok3yYJcjRdOyzoRnQ4SfoMTjDRRx-Ttmkm4px9ikg7uJL&m=0IX33uS7nqqC3kQztTbWD8y0b4wQvklEWCOaOF-_mhpEOGJEx_6EAhmrz67hCIod&s=kT_HTdDB022xRcbwylu1EIGs_puSH3QJVNFsMJrBHGU&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_A3SLMPNZ3VYFDN5ACWF5NKTY5W2WFAVCNFSM6AAAAABFWYZEUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRQGA4DKMRUG4&d=DwMFaQ&c=ZQs-KZ8oxEw0p81sqgiaRA&r=4DhvbN7IEXgxPlg3Sc_Ok3yYJcjRdOyzoRnQ4SfoMTjDRRx-Ttmkm4px9ikg7uJL&m=0IX33uS7nqqC3kQztTbWD8y0b4wQvklEWCOaOF-_mhpEOGJEx_6EAhmrz67hCIod&s=9GJ_xs2FUrZmXAX3vjyqiJ8LhfkBlMxzrm3frrvtnjQ&e=. You are receiving this because you were mentioned.Message ID: @.***>