Metadata-Version: 2.1
Name: contarg
Version: 0.0.4
Summary: Python package implementing/wrapping connectivity based rTMS targeting methods.
Project-URL: Homepage, https://github.com/nih-fmrif/contarg
Author-email: Dylan Nielson <adenosine@gmail.com>
License: CC)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Requires-Dist: click>=8.1.3
Requires-Dist: joblib>=1.2.0
Requires-Dist: nilearn>=0.10.0
Requires-Dist: niworkflows>=1.7.1
Requires-Dist: numpy>=1.24.1
Requires-Dist: pandas>=1.5.3
Requires-Dist: pybids==0.15.2
Requires-Dist: scikit-learn>=1.2.1
Requires-Dist: scipy>=1.10.0
Provides-Extra: dev
Requires-Dist: black~=23.1.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: datalad; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# ConTarg

A python package implementing/wrapping methods for functional connectivity personalized targeting of rTMS therapy.

## Getting test data
```commandline
datalad clone ///openneuro/ds002330
cd ds002330/sub-02
datalad get -r .
```


## Example run
```commandline
contarg hierarchical run \
--bids-dir=data/ds002330 \
--derivatives-dir=data/derivatives/ \
--database-file=data/pybids_0.15.2_db \
--run-name=firsttest \
--space=T1w \
--smoothing-fwhm=3 \
--ndummy=5 \
--tr=1.9 \
--subject=02 \
--run=1 \
--njobs=2


```

## ROIs
Currently we just have spherical ROIs based on Cash et al., 2022 for defining SGC and DLPFC.
They were created as follows.
```commandline
# make SGC mask
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.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
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.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
# BA9 20mm -36, 39, 43
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.nii.gz   \
       -expr 'step(400-(x-36)*(x-36)-(y+39)*(y+39)-(z-43)*(z-43))' \
       -prefix BA9sphere_space-MNI152NLin6Asym_res-02.nii.gz

# BA46 20mm -44, 40, 29
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.nii.gz   \
       -expr 'step(400-(x-44)*(x-44)-(y+40)*(y+40)-(z-29)*(z-29))' \
       -prefix BA46sphere_space-MNI152NLin6Asym_res-02.nii.gz

# 5cm 20mm -41, 16, 54
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.nii.gz   \
       -expr 'step(400-(x-41)*(x-41)-(y+16)*(y+16)-(z-54)*(z-54))' \
       -prefix 5cmsphere_space-MNI152NLin6Asym_res-02.nii.gz

# F3 20mm -37, 26, 49
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.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

# 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

# DLPFC + brainmask
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  \
       -e /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm_brain_mask.nii.gz \
       -expr 'and(step(a + b + c + d),e)'  \
       -prefix DLPFCspheresmasked_space-MNI152NLin6Asym_res-02.nii.gz
       
# BA46 + brainmask
3dcalc -a /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm.nii.gz   \
       -b /usr/local/apps/fsl/6.0.4/data/standard/MNI152_T1_2mm_brain_mask.nii.gz \
       -expr 'and(a,b)' \
       -prefix BA46spheremasked_space-MNI152NLin6Asym_res-02.nii.gz
```


This is a Python project packaged according to [Contemporary Python Packaging - 2023][].

[Contemporary Python Packaging - 2023]: https://effigies.gitlab.io/posts/python-packaging-2023/
