Package: gcnn-dmri
Gauge equivariant CNNs for Diffusion MRI (gcnn_dmri)gcnn_dmri incorporates gauge equivariance into cnns designed to process diffusion MRI (dMRI) data. The dmri signal is realized on an antipodally identified sphere, i.e the real projective space. Inspired byCohen et al.we model this 'half-sphere' as the top of an icosahedron. Interestingly, invoking the correct padding naturally leads us to use the full dihedral group,, to include reflections in addition to rotations of the hexagon, as shown in the image on the right. Here we show the application of such gauge equivariant layers to de-noisingHuman Connectome ProjectdMRI data limited to six gradient directions, a problem similar to the work ofTian et al.Data preparationSelect random subject id's for training and testing, one approach is shown indataHandling/subject_list_generator.py.Similar toTian et al.we use a mask that avoids CSF. For this we need a grey matter and a white matter mask, which can be made frommri_binarizewith the flags--all-wmand--gmrespectively.Further steps are shown inniceData.py:make_freesurfer_masksruns the shell script to make the mask mentioned above.make_loss_mask_and_structuralfinalizes the mask, T1 and T2 images with the correct padding and resolution.make_diffusioncreates diffusion volumes with fewer gradient directions, directions are choosen in the sequence of the aquisition and then cut off at desired number.dtifit_on_directionsrunsdtifiton the new diffusion volumes with fewer directions.We obtain the following folder structure:── <training/testing>
      ├── <subject_id>
      │   ├── diffusion
      │   │   └── <# of gradient directions>
      │   │       ├── diffusion
      │   │       │   ├── bvals
      │   │       │   ├── bvecs
      │   │       │   ├── data.nii.gz
      │   │       │   ├── nodif_brain_mask.nii.gz
      │   │       │   └── S0mean.nii.gz
      │   │       └── dtifit
      │   │           ├── dtifit_< >.nii.gz
      │   ├── freesurfer_mask
      │   │   ├── mask_all_wm.nii.gz
      │   │   └── mask_gm.nii.gz
      │   ├── masks
      │   │   ├── mask_all_wm.nii.gz
      │   │   ├── mask_gm.nii.gz
      │   │   └── mask.nii.gz
      │   └── structural
      │       ├── T1.nii.gz
      │       └── T2.nii.gzTrainingSimilar toTian et al.(and references therein) we use a residual network architecture but with the addition of gauge equivariant convolutions on the half icosahedron. The training script with the parameters used istraining_script.py. Note that structural mri images (T1.nii.gzandT2.nii.gz) are also used as inputs.PredictionsPredictions can be performed with the scriptpredicting_script.py. This will create a diffusion volume file,data_network.nii.gzalong withbvecs_networkandbvals_network, upon which one may performdtifit. Following are some results of the denoising, the left grey images are fractional anistropy and right colored images are theV1vector:Documentation:https://akhanf.github.io/gcnn_dmriSource Code:https://github.com/akhanf/gcnn_dmriPyPI:https://pypi.org/project/gcnn_dmri/Graph-equivariant CNNs for diffusion MRIInstallationpipinstallgcnn_dmriDevelopmentClone this repositoryRequirements:PoetryPython 3.7+Create a virtual environment and install the dependenciespoetryinstallActivate the virtual environmentpoetryshellTestingpytestDocumentationThe documentation is automatically generated from the content of thedocs directoryand from the docstrings
of the public signatures of the source code. The documentation is updated and published as aGithub project pageautomatically as part each release.ReleasingTrigger theDraft release workflow(pressRun workflow). This will update the changelog & version and create a GitHub release which is inDraftstate.Find the draft release from theGitHub releasesand publish it. When
a release is published, it'll triggerreleaseworkflow which creates PyPI
release and deploys updated documentation.Pre-commitPre-commit hooks run all the auto-formatters (e.g.black,isort), linters (e.g.mypy,flake8), and other quality
checks to make sure the changeset is in good shape before a commit/push happens.You can install the hooks with (runs for each commit):pre-commitinstallOr if you want them to run only for each push:pre-commitinstall-tpre-pushOr if you want e.g. want to run all checks manually for all files:pre-commitrun--all-filesThis project was generated using thewolt-python-package-cookiecuttertemplate.