diff --git a/docs/main-getting-started.md b/docs/main-getting-started.md index 383e521..b587e00 100644 --- a/docs/main-getting-started.md +++ b/docs/main-getting-started.md @@ -1,7 +1,7 @@ # Getting started ## Quick start -1. Install QuPath, ABBA and conda. +1. Install [QuPath](https://qupath.github.io), [ABBA](https://teamncmc.github.io/cuisto/guide-install-abba.html) and [conda](https://conda-forge.org/download/). 2. Create an environment : ``` conda create -c conda-forge -n cuisto-env python=3.12 diff --git a/docs/tips-preprocessing.md b/docs/tips-preprocessing.md index 89c2ee1..81740b5 100644 --- a/docs/tips-preprocessing.md +++ b/docs/tips-preprocessing.md @@ -27,9 +27,9 @@ First and foremost, export the images from the microscope software to OME-TIFF. ### Split channels and find brain mask Copy the script `preprocess_split_channels.py` located in `scripts/preprocessing` on your computer. Read the options at the top of the script and edit according to your need. -Especially, the `TASKS` dictionnary what actions are to be performed. +Especially, the `TASKS` dictionary specifies what actions are to be performed. -This script will : +The process is the following : 1. (if `move=True`) Move images from `~/input_directory` to `~/images/merged_original/`. The files will be renamed depending on the options set in the script header. The `IN_PREFIX` parameter allows the slice number to be parsed. The `OUT_PREFIX` is the prefix of the renamed image and all subsequent use. @@ -37,7 +37,7 @@ This script will : ZEN exported images named : `A1A4_s1.ome.tiff`, `A1A4_s2.ome.tiff`, ... Setting `IN_PREFIX` to `"_s"` and `OUT_PREFIX` to `animalid_` will result in image being moved from `~/input_directory/animalid_s1.ome.tiff` to `~/images/animalid_001.ome.tiff`, and so on. The `images` folder name is customizable but will always be in the parent directory of `input_drectory`. -2. (if `split=True`) While moving and renaming the image, it will also read the actual image data, and split each channel in separate single-channel images. The image files will have the same name and are stored in `~/ch01`, `~/ch02`... folders. +2. (if `split=True`) While moving and renaming the image, it will also read the actual image data, and split each channel in separate single-channel images. The image files will have the same name and are stored in `~/images/ch01`, `~/images/ch02`... folders. 3. (if `clean=True`) The parameter `DETECTION_CHANNEL` sets which channel will be used to find the brain contour. The corresponding single-channel file is read, [brain detection](#brain-contour-detection) is performed, the resulting mask is saved in `~images/masks`. Since the image is already loaded, the mask is also applied directly to it, and the cleaned, masked image is saved in `~/images/chXX_cleaned`, where `XX` corresponds to `DETECTION_CHANNEL`. ??? Info @@ -49,17 +49,17 @@ This script will : If for some images the mask is not satisfactory, note down their names and : 1. Delete the mask file (not the preview !). -2. Detele the corresponding cleaned images in each channel. +2. Detele the corresponding cleaned image in each channel. 3. Open ImageJ, drag & drop the corresponding single-channel original image from the channel used for detection. 4. Manually edit it so that the brain slice is easily detected. This means deleting the bits not part of the slice, usually when those bits are close to the slice itself. One could for instance use the `Freehand selections` tool, select the parts to remove and hit ++del++. -5. Save the image (++ctrl+s++), overwritting the original. +5. Save the image (++ctrl+s++), overwriting the original. 6. Repeat for each un-satisfactory mask. 7. Back to the script, turn off `reformat` and `split` in `TASKS`, since that's already done. Only the missing masks will be computed, and only the missing images from the `chXX_cleaned` folders will be written (unless `overwrite_cleaned` is set to `True`). ??? Example Automatic brain contour detection failed for `animalid_012.tiff`. I delete `~/images/masks/animalid_012.tiff`. I also delete `~/images/ch01_cleaned/animalid_012.tiff`, `~/images/ch02_cleaned/animalid_012.tiff` and `~/images/ch03_cleaned/animalid_012.tiff`. - I drag & drop `~/images/ch01/animalid_012.tiff` in ImageJ, draw the brain contour manually with Freehand selections tool, invert the selection, hit ++del++, save the image, overwritting it. + I drag & drop `~/images/ch01/animalid_012.tiff` in ImageJ, draw the brain contour manually with Freehand selections tool, invert the selection, hit ++del++, save the image, overwriting it. Finally, I edit the script, setting `reformat=False` and `split=False` in `TASKS`, and re-run the script. Only one mask will be computed and applied. Now, we only have to merge all the channels back to single pyramidal OME-TIFF images ready to be used in QuPath. @@ -71,7 +71,7 @@ This one is more straighfoward : 1. Fill the input directory. This is where the script can find each `chXX_cleaned` folders, `~/images/` in the example above. 2. Fill the output directory. This could be for instance `~/images/merged_cleaned/`. -3. Fill the `CHANNELS` parameters. This is a dictionnary, setting the name and color of each channel. The order is important, it needs to be sorted as the `chXX_cleaned` folders are. +3. Fill the `CHANNELS` parameters. This is a dictionary, setting the name and color of each channel. The order is important, it needs to be sorted as the `chXX_cleaned` folders are. ??? Example The first channel (`ch01_cleaned`) corresponds to the NISSL staining imaged in the CFP channel, the second channel (`ch02_cleaned`) corresponds to the EGFP channel. `CHANNELS` would then look like : `{"CFP": (0, 0, 255), "EGFP": (0, 255, 0)}`.