# Converting NIfTI-images into BIDS

| <h4 id="toc95749082">Context</h4>                                                                                                                                                                                                                                                                                                                                                                                                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ol><li>In the following steps, Lead DBS converts the legacy NIfTI-images into Brain Imaging Data Structure (BIDS) images.</li><li>BIDS is a data structure for neuroimaging and behavioural data used in the imaging domain.</li><li>This step is necessary to re-assure that the lead-DBS will be able to work with data. Moreover, using BIDS is an easy way to store and re-use the data between various toolboxes.</li></ol> |

| <h4 id="toc95749083">Info panel</h4>                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <ol><li><strong>Make sure that one folder stores all of your patient data, that data are in NIfTI format, and the file names do not contain any spaces or special character</strong>s.</li><li>The folder should contain <strong>pre-operative anat files and post-operative postop files</strong>.</li><li>CT files cannot be used as pre-operative data, MRI files are used instead.</li></ol> |

Screenshot 1. Patient file - NIfTI

<figure><img src="https://652347722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEKrtfptpsNlKGfPk7Bs%2Fuploads%2FZw94bO7LZrrutE5FRLG0%2Fpatientfolder.png?alt=media&#x26;token=6ce5825d-3c39-4b79-bc61-802f2590f67d" alt=""><figcaption></figcaption></figure>

To start the importing process, simply select "Import NIfTI to BIDS dataset" and click "RUN". It is possible to import multiple patient files by holding shift and selecting multiple patients.

<figure><img src="https://652347722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEKrtfptpsNlKGfPk7Bs%2Fuploads%2FslQrn6eOBW0shmMw1nIV%2Fimport.png?alt=media&#x26;token=02057884-4d4c-4db6-9de0-21339c1daa7c" alt="" width="563"><figcaption></figcaption></figure>

A window will pop up where you need to s**pecify the session (preop or postop), type (anat, functional, dwi), modality and acquisition (sag, cor, axial, iso)**

<figure><img src="https://652347722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEKrtfptpsNlKGfPk7Bs%2Fuploads%2Fv5GAOPFSKCZ51h055ejV%2Fimport-modality123.png?alt=media&#x26;token=20af01f2-f397-49c9-9df3-bbca3d11040f" alt=""><figcaption></figcaption></figure>

Here is another example with postoperative CT scans.

<figure><img src="https://652347722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEKrtfptpsNlKGfPk7Bs%2Fuploads%2FDnvSSGN7GnrZrcpwl4ct%2Fpostopct.png?alt=media&#x26;token=137d5f22-8706-46bc-8595-814449e0cccb" alt=""><figcaption></figcaption></figure>

#### Output

* After Lead migrated all NIfTI files into BIDS format, you can find them in the selected output folder/dataset directory. In our case, the folder’s name was “Directory”
* The folder contains three main sub-folders: “derivatives”, “raw data” and "source data". Each of these files contains data about our patients. The raw images that we have just converted will be stored under the **"rawdata/sub-\[PATIENTNAME]”** folder. The Lead will use these data for further analysis.
* “Dataset\_description” file contains information about your dataset.

<figure><img src="https://652347722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEKrtfptpsNlKGfPk7Bs%2Fuploads%2FFTK6HgeScKV9mMOjSTe8%2Ffolder2.png?alt=media&#x26;token=0a204873-ceff-4924-98c0-a4f5a49a2179" alt=""><figcaption></figcaption></figure>
