labsyspharm / mcmicro

Multiple-choice microscopy pipeline
https://mcmicro.org/
MIT License
104 stars 58 forks source link

CODEX Raw data #545

Open andreevg04 opened 6 months ago

andreevg04 commented 6 months ago

Dear MCMICRO Team,

I stumble upon this problem. I have my project with raw (where my raw data is separated only by "_".raw.qptiff). I have my marker.csv and my params.yml Here are the params.yml: workflow: start-at: illumination stop-at: background qc-files: copy tma: false viz: false background: true background-method: backsub multi-formats: .qptiff segmentation: unmicst segmentation-recyze: false downstream: scimap options: ashlar: -m 30 cypository: --model zeisscyto ilastik: --num_channels 1 mcquant: --masks cell.tif _cp_masks*.tif naivestates: -p png imagej-rolling-ball: 100 -n=4 -j="-Xmx4g" modules: illumination: name: basic container: labsyspharm/basic-illumination version: 1.1.1 registration: name: ashlar container: labsyspharm/ashlar version: 1.18.0 dearray: name: coreograph container: labsyspharm/unetcoreograph version: 2.2.9 cmd: python /app/UNetCoreograph.py --outputPath . input: --imagePath background: name: backsub container: ghcr.io/schapirolabor/background_subtraction version: v0.4.1 cmd: |- python3 /background_subtraction/background_sub.py \ -r ${image} -m ${marker} \ -o ${image_id}_backsub.ome.tif -mo markers_bs.csv segmentation:

Another note: When I delete the Illumination from the exemplar-002 and have only raw, markers.csv and then the params (default) I get the same error. When I dont have the extra params file it starts running normally by default, so it has to be something from this file that is causing trouble.

andreevg04 commented 6 months ago

I replaced the params.yml with this workflow: start-at: registration stop-at: background qc-files: copy background: true background-method: backsub multi-formats: .qptiff segmentation: unmicst segmentation-recyze: false The Error message now is ERROR ~ Error executing process > 'registration:ashlar (1)'

Caused by: Process registration:ashlar input file name collision -- There are multiple input files for each of the following file names: raw The name of the image is tissue_Scan_1_Cycle_x.qptiff where x is from 0 to 14

Even reducing the naming to Cycle_1.qptiff, Cycle_2.qptiff didnt help. The images are 4x1x1

I tried also --in project --multi-formats .qptiff this but got the same error

The images are not in tiles but they are WSI. I want to perform the registration of the WSI

ArtemSokolov commented 6 months ago

@jmuhlich can provide more details, but ASHLAR is not really designed to align pre-stitched images. It's not going to produce accurate registration, and you will get marker combinations that make no sense for individual cells.

Can you check with your microscope vendor about disabling on-board stitching? It would be ideal if you were able to download raw tiles from the instrument and letting ASHLAR do simultaneous stitching and registration to get accurate results.

Alternatively, you can look into running an external tool to do WSI alignment (e.g., https://github.com/labsyspharm/palom). You can then place the output from that external tool into the registration/ subfolder and start-at: segmentation to run the rest of the pipeline.

andreevg04 commented 6 months ago

I couldnt get the unstitched file so I will process the registerred one. Thank you for that!!!

On a side note:I have following issue: I have big ome.tiff images that I want to process with MCMICRO or simillar pipelines but because of hardware limitations I have to slice the large images beforehand and save the metadata in each slice, to be able to process it in MCMICRO like their examples on IMC. I tried some python coding and got the sliced images to be saved as a z-stack, but the MCMICRO pipeline got error message of: that the pixel size is missing and the coordinates of the slices.

ArtemSokolov commented 6 months ago

Hi @andreevg04,

Can you provide a little bit more detail about your process? Are you saving all your slices into a single z-stack?

Can you also please share you parameter file that you are using?

andreevg04 commented 6 months ago

Hi @ArtemSokolov may I send you an email/link with images with the details. I am saving the slices in a single z-stack becaus the examples were like this. But I since I am a programming novice I cant save the metadata/coordinates to the slices. The parameter file for MCMICRO is just the default. I wanted to just test it so I didnt use any specifics.

ArtemSokolov commented 6 months ago

If you save all slices into a single z-stack, the file size will be the same as the original .ome.tiff. So, how will it help you with hardware limitations?

My suggestion would be to put your tiles into the registration/ subfolder as individual .tif files and then run the pipeline with the following params.yml:

workflow:
  start-at: registration

It will process each tile separately, but you will need to aggregate the quantification tables manually.

Alternatively, you can try running the entire .ome.tiff on a machine with more memory / disk storage.

andreevg04 commented 6 months ago

The main problem was that it couldnt load the image in memory as the original .ome.tiff when I performed some processing and color deconvolution to it in the beginning. That is why I decided to slice the image and proces the tiles which then worked. Nevertheless I wasnt able to start the MCMICRO pipeline with the errors I described. What you are suggesting will not produce a composite image then, correct? My plan was to generate a composite large multichannel image and then process it further. Would you happen to have any ideas or someone that has done such image slicing?

ArtemSokolov commented 6 months ago

Sorry, looks like I listed the wrong step above. You would want to do:

workflow:
  start-at: segmentation

The tiles don't need to be registered, which is the module that wants to know tile coordinates. You should be able to proceed directly to cell segmentation instead.

At the high level, yes, by splitting the image and segmenting each tile separately, you would need to either stitch the segmentation masks back together before quantification or simply combine the quantification tables (but probably be mindful of cells near the edges of tiles, as they may get double-counted). I am not aware of any tools that do these automatically, but I admit that it's been a while since I last looked.

One other suggestion is to try other segmentation modules. MCMICRO runs UnMicst by default, which is a very resource-intensive module (both memory and disk). Try selecting one of the other modules and see if that still runs up against your hardware limitations. The following documentation pages may be useful: