BodenmillerGroup / steinbock

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

DeepCell input data #148

Closed rahilgholami closed 2 years ago

rahilgholami commented 2 years ago

Hi

To segment raw image data (directly on image intensities) using DeepCell, as you mentioned, DeepCell expects two-channel images as input.

when I run steinbock segment deepcell --minmax command, I run into the following error which means (labeled) channels are not aggregated to 2 channels.

aggr_func(img[channel_groups == channel_group], axis=0) IndexError: boolean index did not match indexed array along dimension 0; dimension is 47 but corresponding boolean dimension is 40

It seems it doesn't take the deepcell column into account which is provided in the panel.csv file.

Would you help me figure out what the problem could be?

jwindhager commented 2 years ago

Hi @rahilgholami, thanks for reaching out. To get to the bottom of this, could you please provide the following:

  1. The steinbock alias you are using (alias steinbock=...)
  2. The contents of your panel.csv in the steinbock working directory
  3. The number of channels in your TIFF file (easy to check with e.g. ImageJ)

Cheers

rahilgholami commented 2 years ago

Thank you @jwindhager for your reply!

  1. alias steinbock="docker run -v /path/to/data:/data -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.Xauthority:/home/steinbock/.Xauthority:ro -u $(id -u):$(id -g) -e DISPLAY=$(hostname):0 ghcr.io/bodenmillergroup/steinbock:0.15.0"

  2. In fact, I am running for the example data (data from 4 patients) you provided in 03-prerequisites.Rmd and also panel.csv from "https://zenodo.org/record/6642699".

  3. The number of channels is 47 but based on the panel.csv file only 40 channels are kept.

jwindhager commented 2 years ago
  1. alias steinbock="docker run -v /path/to/data:/data -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.Xauthority:/home/steinbock/.Xauthority:ro -u $(id -u):$(id -g) -e DISPLAY=$(hostname):0 ghcr.io/bodenmillergroup/steinbock:0.15.0"

I don't think this is the alias you actually used, since the path to your local steinbock data/working directory (/path/to/data) has not been updated.

  1. In fact, I am running for the example data (data from 4 patients) you provided in 03-prerequisites.Rmd and also panel.csv from "https://zenodo.org/record/6642699".

I just ran the steinbock.sh script from the Zenodo repository (https://zenodo.org/record/6642699/files/steinbock.sh) with steinbock v0.15.0 without problems. This script is the one included in the IMCWorkflow, so you likely have a problem in your local setup.

  1. The number of channels is 47 but based on the panel.csv file only 40 channels are kept.

The number of channels in the images should be 40 (just verified after running the script mentioned above). Likely, something went wrong with extracting the images. Did you use the panel file for image extraction? Did you edit the panel file after extracting the images? Please note that the number of rows in the steinbock panel needs to match the number of channels in the images.

rahilgholami commented 2 years ago
  1. I just posted the command, I surely updated the working directory.
  2. I ran again from preprocessing step and now it is working!
  3. As you said, there was something wrong with the image extraction, however I never touched the panel file.

thank you for your help!