Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TANS #6

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "contarg/test/data"]
path = contarg/test/data
url = https://github.com/nih-fmrif/contarg_test_data.git
[submodule "contarg/resources/Targeted-Functional-Network-Stimulation"]
path = contarg/resources/Targeted-Functional-Network-Stimulation
url = https://github.com/Shotgunosine/Targeted-Functional-Network-Stimulation
5 changes: 5 additions & 0 deletions .idea/contarg.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/webServers.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 44 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,42 @@ contarg hierarchical run \
* Seedmap + classic
* `contarg seedmap run --targeting-method=classic`
* Seedmap + cluster
* `contarg seedmap run --targeting-method=cluster`
* `contarg seedmap run --targeting-method=cluster`
* TANS + refernce correlation
* `contarg tans run --target-method=reference`
* TANS + depression circuit spatial similarity
* `contarg tans run --target-method=DCSS`

For Seedmap methods you should provide a seedmap in MIN152NLin6Asym space.
You can use the one in test/data/derivatives/contarg/seedmap/hcp_working,
remember you may need to download it with `datalad get`.
Alternatively, you can use `contarg seedmap subjectmap` and `contarg seedmap groupmap` to make one.

TANS is Targeted Functional Network Stimulation implemented by Chuck Lynch. I've just wrapped it in python and made a
CLI. In order to run that, you will need Matlab, Freesurfer, FSL, connectome-workbench, ANTs, and SimNibs 4.0.

## ROIs
Currently we just have spherical ROIs based on Cash et al., 2022 for defining SGC and DLPFC.
They were created as follows.
We've vot 4 reference masks and 4 stim masks. Most were created via the AFNI commands below. coleBA46 was based on extraction of MNI
coordinates from Cole et al., 2020. We hand traced an ROI that enclosed those points and followed gyral landmarks on
MNI152NLin6Asym (1mm resolution). We then cleaned up the hand traced mask via inlation/delation and fit it with a convex
hull using Mango.
```commandline
# make SGC mask
# make SGC mask 10 mm sphere at MNI 6,16,-10
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(100-(x+6)*(x+6)-(y+16)*(y+16)-(z+10)*(z+10))' \
-prefix SGCsphere_space-MNI152NLin6Asym_res-02.nii.gz
# make blSGC mask
# make blSGC mask 10 mm spheres at (-6,16,-10 and 6,16,-10)
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(100-(x-6)*(x-6)-(y+16)*(y+16)-(z+10)*(z+10))' \
-prefix leftSGCsphere_space-MNI152NLin6Asym_res-02.nii.gz
3dcalc -a SGCsphere_space-MNI152NLin6Asym_res-02.nii.gz \
-b leftSGCsphere_space-MNI152NLin6Asym_res-02.nii.gz \
-expr 'step(a+b)' \
-prefix bilateralSGCspheres_space-MNI152NLin6Asym_res-02.nii.gz
# make a bilateral full SGC mask 12 mm sphere at 0, 24, -14
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(144-(x-0)*(x-0)-(y+24)*(y+24)-(z+14)*(z+14))' \
-prefix bilateralfullSGCsphere_space-MNI152NLin6Asym_res-02.nii.gz
# BA9 20mm -36, 39, 43
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(400-(x-36)*(x-36)-(y+39)*(y+39)-(z-43)*(z-43))' \
Expand All @@ -84,12 +97,38 @@ They were created as follows.
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(400-(x-37)*(x-37)-(y+26)*(y+26)-(z-49)*(z-49))' \
-prefix F3sphere_space-MNI152NLin6Asym_res-02.nii.gz

# BA9 30mm -36, 39, 43
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(900-(x-36)*(x-36)-(y+39)*(y+39)-(z-43)*(z-43))' \
-prefix dilatedBA9sphere_space-MNI152NLin6Asym_res-02.nii.gz

# BA46 30mm -44, 40, 29
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(900-(x-44)*(x-44)-(y+40)*(y+40)-(z-29)*(z-29))' \
-prefix dilatedBA46sphere_space-MNI152NLin6Asym_res-02.nii.gz

# 5cm 30mm -41, 16, 54
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(900-(x-41)*(x-41)-(y+16)*(y+16)-(z-54)*(z-54))' \
-prefix dilated5cmsphere_space-MNI152NLin6Asym_res-02.nii.gz

# F3 30mm -37, 26, 49
3dcalc -a ~/.cache/templateflow/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz \
-expr 'step(900-(x-37)*(x-37)-(y+26)*(y+26)-(z-49)*(z-49))' \
-prefix dilatedF3sphere_space-MNI152NLin6Asym_res-02.nii.gz

# DLPFC
3dcalc -a BA9sphere_space-MNI152NLin6Asym_res-02.nii.gz -b BA46sphere_space-MNI152NLin6Asym_res-02.nii.gz \
-c 5cmsphere_space-MNI152NLin6Asym_res-02.nii.gz -d F3sphere_space-MNI152NLin6Asym_res-02.nii.gz \
-expr 'step(a + b + c + d)' \
-prefix DLPFCspheres_space-MNI152NLin6Asym_res-02.nii.gz

# Dilated DLPFC
3dcalc -a dilatedBA9sphere_space-MNI152NLin6Asym_res-02.nii.gz -b dilatedBA46sphere_space-MNI152NLin6Asym_res-02.nii.gz \
-c dilated5cmsphere_space-MNI152NLin6Asym_res-02.nii.gz -d dilatedF3sphere_space-MNI152NLin6Asym_res-02.nii.gz \
-expr 'step(a + b + c + d)' \
-prefix dilatedDLPFCspheres_space-MNI152NLin6Asym_res-02.nii.gz

# DLPFC + brainmask
3dcalc -a BA9sphere_space-MNI152NLin6Asym_res-02.nii.gz -b BA46sphere_space-MNI152NLin6Asym_res-02.nii.gz \
Expand Down
5 changes: 4 additions & 1 deletion contarg/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import click
from .run_hierarchical import contarg
from .run_seedmap import contarg as contargsm
from .run_tans import contarg as contargtans
from .run_pfm import contarg as contargpfm

contarg = click.CommandCollection(sources=[contarg, contargsm])

contarg = click.CommandCollection(sources=[contarg, contargsm, contargtans, contargpfm])

if __name__ == "__main__":
contarg()
Loading