Example usage
This section gives a brief presentation of the steps together with examples of actual command line usage. It ends with a complete script that could be used to process a dataset with only a few modifications. The next section, details, shows all command line options and contain in depth descriptions of some of the steps.
Extract images as tiff files from nd2
radiantkit nd2_to_tiff CJ_20240702_CJ052_SLIDE012.nd2
Segment nuclei
Please check the command line options with
radiantkit tiff_segment --help
In this case we let radiantkit know the name of the channel containing the nuclei, ask to apply a mild low pass filter and allows it to use 8 threads. Please note that options like –only-focus produce 2D images and that is not supported in the downstreams analysis at the moment.
radiantkit tiff_segment --gaussian 2 CJ_20240702_CJ052_SLIDE012 --inreg "cjDAPI.*\.tif" --threads 8
The result is that we get a tiff_segment.log.txt file in the folder CJ_20240702_CJ052_SLIDE012 as well as a binary mask, file.mask.tif for each file.tif.
Processing 8 image of size [41, 1608, 1608] using 8 threads used less than 32 GB of RAM and took about 3 minutes.
Extract radial profiles
radiantkit measure_objects CJ_20240702_CJ052_SLIDE012 cjDAPI
This will create a CJ_20240702_CJ052_SLIDE012/objects/nuclear_features.tsv which contains some measurements of the nuclei.
Select nuclei
This step looks at the size and intensity of the nuclei and automatically selects the nuclei that looks like non G2.
radiantkit select_nuclei CJ_20240702_CJ052_SLIDE012 cjDAPI
Generate a report
Example script
Given a folder structure like this:
├── CJ_20240702_CJ052_SLIDE007
├── CJ_20240702_CJ052_SLIDE008
├── CJ_20240702_CJ052_SLIDE009
├── CJ_20240702_CJ052_SLIDE010
├── CJ_20240702_CJ052_SLIDE011
└── CJ_20240702_CJ052_SLIDE012
The following script would process all images and generate a report:
#!/bin/bash
set -e
## Settings, adjust to you images!
dx=110 # pixel size (nm)
dy=110
dz=300 # axial direction
nucprefix=cjDAPI # Prefix of the files containing the nuclei staining
nthread=8 # Number of concurrent threads to use
# Per folder processing
process_cond() {
# Automatic 3D segmentation
radiantkit tiff_segment ${1} \
--threads ${nthread} \
--gaussian 2.0 \
--inreg "^${nucprefix}.*\.tif$" \
-y
# Measure properties of the segmented objects
radiantkit measure_objects ${1} ${nucprefix} \
--threads ${nthread} \
--aspect ${dz} ${dy} ${dx} \
-y
# Select G1 nuclei
# Needs at least 6 nuclei
radiantkit select_nuclei ${1} ${nucprefix} \
--k-sigma 2 --threads ${nthread} \
-y
# Measure radial profiles for all segmented nuclei
radiantkit radial_population ${1} ${nucprefix} \
--aspect ${dz} ${dy} ${dx} \
--mask-suffix mask_selected \
--threads ${nthread} -y \
--slice2d
}
# Process each folder / condition
process_cond CJ_20240702_CJ052_SLIDE007
process_cond CJ_20240702_CJ052_SLIDE008
process_cond CJ_20240702_CJ052_SLIDE009
process_cond CJ_20240702_CJ052_SLIDE010
process_cond CJ_20240702_CJ052_SLIDE011
process_cond CJ_20240702_CJ052_SLIDE012
# Make a report (radiant.report.html)
# using all conditions that can be found in subfolders
radiantkit report .