.. _prerequisites:
Prerequisites
=============
This section describes the prerequisites for running the toolbox.
- :ref:`required_data`
- :ref:`registration`
- :ref:`cortical`
- :ref:`data_organisation`
.. _required_data:
Required Data
-------------
You'll need both T1 and diffusion MRI, preferally bias-corrected.
Ensure that the diffusion and T1 images are properly aligned,
producing transformation affine matrices that map between the two spaces.
You can achieve this using tools from `FSL `_.
Specifically, you can use FSL's `flirt `_
or `epi_reg `_.
This usually involves transforming B0 images into the structural (T1) space. If using ``epi_reg``, here's an example:
.. code-block:: console
$ epi_reg --epi= --t1= --t1brain= --out=
where ```` is the B0 image, ```` is the T1 image, ```` is the brain-extracted T1 image,
and ```` is the output transformation matrix that maps diffusion space into structural space.
To obtain the inverse transformation matrix ````, simply use FSL's
`convert_xfm `_:
.. code-block:: console
$ convert_xfm -omat -inverse
where ```` is the output transformation matrix that maps structural space back into diffusion space.
.. _registration:
Registration to Standard space
------------------------------
You'll also need to obtain the warp fields that aligns MNI 1mm standard space to the structural space.
This can be done via FSL's `fnirt `_:
.. code-block:: console
$ fnirt --ref= --in= --aff= --cout=
where ```` is the T1 image, ```` is the MNI 1mm standard space image,
```` is the affine transformation matrix that maps structural space to MNI 1mm space,
and ```` is the output warp field that maps MNI 1mm space to structural space.
.. _cortical:
Cortical and Subcortical Parcellations
--------------------------------------
You'll also need to generate cortical and subcortical parcellations from T1.
This can be done via Freesurfer's `recon-all `_:
.. code-block:: console
$ recon-all -all -i -s -sd -parallel -openmp
where ```` is the T1 image, ```` is the subject ID, ```` is the output directory,
and ```` is the number of threads to use.
.. _data_organisation:
Data Organisation
-----------------
If you're working with multiple subjects (where each subject has its own folder),
ensure that you organise the files for each subject consistently.
For example, the T1 and diffusion files
should have the same naming convention across subjects.
.. code-block:: console
subject001/
├── structural
│ ├── T1_brain.nii.gz
├── diffusion
│ ├── bvals
│ ├── bvecs
│ ├── data.nii.gz
└── otherfiles
subject002/
├── structural
│ ├── T1_brain.nii.gz
├── diffusion
│ ├── bvals
│ ├── bvecs
│ ├── data.nii.gz
└── otherfiles
subject003/
This will simplify the process moving forward.