> For the complete documentation index, see [llms.txt](https://netstim.gitbook.io/leaddbs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://netstim.gitbook.io/leaddbs/lead-dbs/step3-volume-registrations/coregister-volumes.md).

# Coregister Volumes

| **Context**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ul><li><em>Lead-DBS uses different implemented tools for coregistration. As a default, Lead-DBS chooses the SPM tools for coregistration between MRI images, whilst ANTs is used for coregistration between MRI and CT. This pre-defined setting is based on the Lead-DBS users' experience, and the user can change it at any time within the GUI. Lead offers to choose from a wide range of the most common coregistration methods in the field (i.e., SPM, ANTs, FSL and Brainsfit) as well as several customized ANTs pre-sets.</em></li><li><em>Lead aligns all of the patient images to each other to ensure that they are in the same space and have the same resolution. During coregistration, images are shifted in space linearly, which means that all voxels in the same image keep the same relative distance to each other. Coregistration scales and skews the images but does not expand one region while shrinking the other.</em> </li><li><em>Pre-operative T1-weighted MRI is defined by Lead-DBS as a base file. All the other images are then aligned into this base file. If T1 is unavailable, Lead-DBS chooses T2-weighted MRI images as a ground truth instead.</em></li><li><em>In the first step, Lead-DBS checks the resolution of the base file. The resolution is sufficient if it is better than 1 mm on every axis.  A base resolution lower than 1 mm on any one axis will be upsampled to ensure maximal coregistration (and normalization) accuracy. During upsampling process, missing intensity values are generated by interpolating from the surrounding intensity values.</em></li><li><em>If we have more than one pre-operative anatomical scan, Lead-DBS aligns them to the base file. Post-operative data are aligned after that.</em></li><li><em>Coregistration is one of the crucial steps in electrode localization, and we must check its accuracy thoroughly.</em> Coregistration was successful when images seem completely aligned. We can check this using Lead-DBS, but additional viewing methods such as Slicer 3D can be used (<https://www.slicer.org/>).</li></ul> |

## How to

<figure><img src="/files/jZFarTuKnDwAhbqsU8e9" alt=""><figcaption><p>UI settings for coregistration.</p></figcaption></figure>

1. Load your patient folder in BIDS format into Lead as described in [1. Load Patient Folder](/leaddbs/lead-dbs/step1-load-patient-folder.md).
2. Select the patient you want to register in the window on the left (arrow 1).
3. Select `Coregistration Volumes` and `Check Results`, so you can see the output of coregistration (arrows 2 and 3).&#x20;
4. If coregistration has been run before, select `Retouch/overwrite approved results` (arrow 4) to get a new instance of coregistration results.
5. Press `Run`. The processing power of your computer determines the duration of the coregistration step.&#x20;
6. To see how to check your results, consult [Checking the Coregistration and Normalization](/leaddbs/lead-dbs/step3-volume-registrations/checking-the-coregistration.md).

| **Output**                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ul><li>A pop-up window with information about methods and references. If this information is not needed, the window can be closed.</li><li>New coregistration data will appear in the selected file, under <code>derivatives/leaddbs/patient\_name/coregistration/</code>.</li></ul> |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://netstim.gitbook.io/leaddbs/lead-dbs/step3-volume-registrations/coregister-volumes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
