crossotope_mapping
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: TrevorKMDay
- Language: Shell
- Default Branch: main
- Size: 1.19 MB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
- Releases: 4
Metadata Files
README.md
ILI
Trevor Day // day00096@umn.edu
Code to create the Singularity container for ILI ROI creation and processing.
The steps are to:
roi: Create the mixed ROIs for a given source ROI.analysis: For each of those mixed ROIs, create a seedmap and calculate its laterality.ili: From the results ofanalysis, calculate the ILI for all available results.
Setup
This repository relies on a second repository as a submodule. When cloning for the first time, run the following code (see this StackOverflow answer).
git submodule update --recursive --remote
The container itself requires Git Large File Storage.
To get the .sif file:
git lfs fetch
git lfs checkout
Running ROI creation
The container requires two bind points: the input ROI and the location to save the created crossotopes to.
The directory containing the ROI gets bound to /roi and the outputs to
/roi_outputs. The name of the file must still be passed to the container
with --input_roi. The output directory does not.
roi_name=example.dscalar.nii
roi_outputs=container_rois
# This is done to make sure too many ROIs aren't created
rm -rf ${roi_outputs}
mkdir -p ${roi_outputs}
singularity run \
-B data/example_roi/:/roi \
-B ${roi_outputs}:/roi_outputs \
my_img.sif roi \
--input_roi /roi/${roi_name} \
-n 10
The ROI creation:
- Creates a mirror of your input on the right hemisphere. (Needs update to start in the right hemisphere.)
- Generates
ndifferentdscalarsfor each value ofnrhbetween 1 and the total size of your ROI. So if you ask for-n 10repeats of a 100-greyordinate ROI, you will create 100 ROIs. - The
dscalarsare mapped ontodlabelfiles (infsLR32kspace: needs update to add164kspace). - The
dlabels are split into left/rightlabel.giifiles. Only the GIFTIs are saved from all this processing: You don't need any of the other files.
ROI tree
ili_manager.py
|- rois_create_mirror.sh
|- rois_permute_ROI.R
|- rois_dscalar_to_surface.sh
Running analysis
The analysis works best using derivatives from the DCAN Labs ABCD pipelines.
The analysis flow requires a lot more bind points. From top to bottom:
- The session-level directory containing the
dtseries, and motion.matfile. - The ROIs created using the ROI flow above.
- The Matlab runtime.
R2023bis known to work with this code. - The JSON configuration file for the analysis parameters (see below).
- The directory to save the output CSV to. One CSV per session.
Additionally, the midthickness files must be including if smoothing is
enabled.
The options to the container itself are more self-explanatory.
If you bind the directory to its default value (i.e. binding the Matlab
as such ${MRE}:/matlab or example_config.json:/config.json), you do not
need to set the associated parameter.
- The positional arguments are the input
dtseriesfile and its associated motion.matfile.- If you do not wish to perform censoring, pass the string "NONE." As of Dec. 12, 2024, passing NONE doesn't seem to be working.
--roi_dirtakes the path to the ROIs and figures out how many there are.- Default:
/input_rois/
- Default:
--n_samplesis how many ROIs to use (e.g. if the ROI is 500 greyordinates, you don't have to use them all).- Default: 100.
- The path to the Matlab binary (
--matlab), since I can't package it in the container. - The path to the Matlab runtime (
--MRE).- Default:
/matlab/
- Default:
- The path to the JSON config file, which should be bound to the container
(
--json_config).- Default:
/config.json
- Default:
- Finally, the
--labelis prepended to the results, e.g.label_results.csv.- Default: "crossotope"
Example code:
MRE=/common/software/install/manual/matlab/R2023b/
singularity run \
-B ${ex_sub}/:/session/ \
-B container_rois/:/input_rois/ \
-B ${MRE}:/matlab/ \
-B config.json:/config.json \
-B container_output:/output/ \
my_img.sif analysis \
--n_samples 100 \
--matlab "$(which matlab)" \
--label foobar \
/session/${dtseries} \
/session/${motion}
Config file
All options regarding the processing itself (e.g. motion limits, minute limits) are included in a configuration JSON file, see below. This also makes the CLI options less overwhelming to navigate.
{
# Values for seedmap wrapper
"fd_threshold": 0.2, # Threshold in mm
"smoothing_kernel": 0, # Smoothing kernel in mm
# 0 = none
"max_minutes": 10, # Minutes to sample from dtseries
# 0 = no limit
"remove_outliers_yn": 1, # Whether to remove outliers (0/1)
"z_transform_yn": 1 # Whether to Z-transform results (0/1)
# Thresholds for determining laterality
"cluster_value_min": 0.4 # Value to threshold map at
"cluster_surf_area_min": 10, # Minimum cluster size to keep
# (mm^2)
}
Default values are those listed in example above. NB: You can't include comments in actual JSON files.
Minutes
dtseries files with less than 10 minutes of good data will be run; the output
files have a different name than those that met the criterion.
Files with less than 30 s of good data will not be run at all.
Z-threshold
Currently, the no-transformation option isn't complete. Keep it set to 1.
Analysis tree
ili_manager.py
|- analysis-run_seedmap.sh
|- seedmap_wrapper.py
|- Cifti_conn_matrix_to_corr_dt_pt
|- MATLAB
|- analysis-cluster.sh
Benchmarks
On MSI
- ROI creation: With 16 GB RAM: 7-8 minutes for 490 total ROIs (1 s/ROI, or 61 ROIs/minute).
- Analysis: With 56 GB RAM: 20 minutes for 100 samples (12 s/ROI or 5 samples per minute).
ILI Calculation
The analysis step above creates one CSV per session with the actual L/R
values for possible futher computation. The subcommand ili takes a
single-level directory of n CSVs and returns a single CSV with n non-header
rows with the name of the file and the computed ILI value.
singularity run crossotope.sif ili input_dir output.csv
The maximum size of each ROI will be estimated by the largest value in the
results. Technically, n values are sampled between {1..size}, which means
this doesn't affect the values materially, especially for n in the hundreds.
You can suppy a JSON file with the max size of each ROI, that takes the simple format:
{
"roi1": 100,
"roi2": 150
}
Extracting FD
The motion exclusion results for every framewise displacement (FD)
threshold between 0.0 and 0.5 mm (in steps of 0.01 mm)
are provided in the ABCD HCP pipeline .mat files. This makes it easy to
extract the amount of data that were used in each analysis post hoc.
The command below extracts from a single .mat file and FD threshold the
following values: TR (in seconds), frames remaining,
seconds remaining (i.e. TR times frames remaining), and the
mean FD of the remaining frames.
singularity run crossotope.sif fd [mat file] [fd]
This code should be run on a list of .mat files. Future versions will
incorporate output of FD statistics as part of analysis, but hasn't been
integrated yet.
Acknowledgements
- Seed map wrapper development: Robert Hermosillo, PhD; Greg Conan
- Testing and development: Eric Feczko, PhD; Maryam Mahmoudi, PhD
Change log
Dec. 12, 2024: ver. 0.7.2
- Fixed issue with opening temporary directories.
- Added information to print statements to help locate issues (not complete).
Dec. 2, 2024: ver. 0.7.0
- Many fixes in order to get around MATLAB problems caused by MSI updated to Rocky 8.
- As a consequence, the seed map wrapper was writing out one-frame
dtseriesfiles, which are now being averaged to create adscalar, resulting in a new warning, which can be safely ignored. - Currently tested to be working with
MATLAB R2023b.
Owner
- Name: Trevor K. M. Day
- Login: TrevorKMDay
- Kind: user
- Location: Minneapolis, MN
- Company: Institute of Child Development, UMN
- Twitter: TrevorMcDay
- Repositories: 2
- Profile: https://github.com/TrevorKMDay
PhD student Institute of Child Development University of Minnesota, Twin Cities
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: Crossotope
message: >-
If you use this software, please cite it using the
metadata from this file. Paper in review.
title: "Crossotope mapping"
version: 0.7.0
type: software
authors:
- given-names: Trevor Kincaid McAllister
family-names: Day
email: day00096@umn.edu
affiliation: University of Minnesota
orcid: 'https://orcid.org/0000-0003-2911-8312'
- given-names: Robert
family-names: Hermosillo
email: hermosir@umn.edu
affiliation: University of Minnesota
orcid: 'https://orcid.org/0000-0003-2959-8483'
- given-names: Eric
family-names: Feczko
email: feck001@umn.edu
affiliation: University of Minnesota
orcid: 'https://orcid.org/0000-0003-1337-5517'
repository-code: 'https://github.com/TrevorKMDay/crossotope_mapping'
repository: >-
https://gitlab.com/Fair_lab/Cifti_conn_matrix_to_corr_dt_pt
abstract: >-
Code to calculate laterality of resting-state correlations
from a ROI. Contains code to generate necessary ROI inputs
and calculate laterality of resulting seedmaps.
keywords:
- fMRI
- rsfMRI
license: CC-BY-4.0
GitHub Events
Total
- Watch event: 1
- Push event: 18
- Create event: 2
Last Year
- Watch event: 1
- Push event: 18
- Create event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.25
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- TrevorKMDay (4)
Pull Request Authors
- TrevorKMDay (4)