# 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="/files/5nBcuXyqTC4J7wTfYxX8" 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="/files/vjztmTjQvTM83d0PC6rW" 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="/files/mMsyCmslR1nIrsZNF1vx" alt=""><figcaption></figcaption></figure>

Here is another example with postoperative CT scans.

<figure><img src="/files/0D6MukbZWo1RrKHi35KV" 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="/files/4d9lDTvjEiXSb9jJG5cp" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://netstim.gitbook.io/leaddbs/lead-dbs/step2-image-import/converting-nifti-images-into-bids.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
