Difference between revisions of "Automatic DBS lead topology correction"

From MGH/MIT Parallel Transmission Resources
Jump to navigation Jump to search
Line 9: Line 9:
  
 
=== Instructions ===
 
=== Instructions ===
Download the zip file using the link above and unzip it. If you have a GPU running on a Linux computer, go to the CODE/ folder and compile the gamma distance GPU kernel as follows:
+
Download the zip file using the link above and unzip it.
 +
 
 +
==== Compitlation ====
 +
If you have a GPU running on a Linux computer, go to the CODE/ folder and compile the gamma distance GPU kernel as follows:
 
nvcc -ptx GLOBAL_CONST_CUDAKernel.cu
 
nvcc -ptx GLOBAL_CONST_CUDAKernel.cu
 
This will create the GLOBAL_CONST_CUDAKernel.ptx file required to launch the kernel from Matlab. The GLOBAL_CONST_CUDAKernel.ptx file present in the CODE/ subfolder was created on a CentOS Linux computer (version 7.2.1511) using CUDA 6.5. You may try to use it, but there is no guarantee that it will work on your computer.
 
This will create the GLOBAL_CONST_CUDAKernel.ptx file required to launch the kernel from Matlab. The GLOBAL_CONST_CUDAKernel.ptx file present in the CODE/ subfolder was created on a CentOS Linux computer (version 7.2.1511) using CUDA 6.5. You may try to use it, but there is no guarantee that it will work on your computer.
  
The subfolder EXAMPLE/ contains an example of how to run the code. All the options used in this script are commented and should be easy to understand. There are several things to note in this script:
+
==== Running an example ====
 +
The subfolder EXAMPLE/ contains an example of how to run the code. The master script is RUN_OPT_bilateral.m. All the options used in this script are commented and should be easy to understand. There are several things to note in this script:
 
* Both the left and right DBS leads are loaded in Matlab and are connected in a single wireframe dataset. The topology correction process is run on this "super-lead" in order to remove gamma distance violations not only between the segments of a given lead, but also between segments belonging to different leads. Once the topology correction has been performed, the leaft and right leads can be separated again.
 
* Both the left and right DBS leads are loaded in Matlab and are connected in a single wireframe dataset. The topology correction process is run on this "super-lead" in order to remove gamma distance violations not only between the segments of a given lead, but also between segments belonging to different leads. Once the topology correction has been performed, the leaft and right leads can be separated again.
*
+
* The topology correction process is run at several multi-resolution levels. In the RUN_OPT_bilateral.m, the multi-resolution process has only two iterations: In the first iteration, the input lead are resampled with a 5 mm linear resolution and the topology correction process is run on this resampled lead model. In the second iterations, the corrected lead resulting from the first iteration is resampled at 3 mm resolution and the topogy correction process is run again on this refined wireframe model. This multi-resolution strategy avoids the correction process to get stuck on a local minimum that does not satisfy the constraints. More multi-resolution loops and resolutions can be added by simply lines 21 and 22 of the script.
 +
* The topology correction process itself is the Matlab function deform_path_LINEAR.m. The input to this function are, in this order:
 +
** The

Revision as of 13:44, 27 May 2016

Citation

What this code does

Download files

The code, examples and additional scripts for creation of DBS leads in HFSS can be downloaded here.

Instructions

Download the zip file using the link above and unzip it.

Compitlation

If you have a GPU running on a Linux computer, go to the CODE/ folder and compile the gamma distance GPU kernel as follows: nvcc -ptx GLOBAL_CONST_CUDAKernel.cu This will create the GLOBAL_CONST_CUDAKernel.ptx file required to launch the kernel from Matlab. The GLOBAL_CONST_CUDAKernel.ptx file present in the CODE/ subfolder was created on a CentOS Linux computer (version 7.2.1511) using CUDA 6.5. You may try to use it, but there is no guarantee that it will work on your computer.

Running an example

The subfolder EXAMPLE/ contains an example of how to run the code. The master script is RUN_OPT_bilateral.m. All the options used in this script are commented and should be easy to understand. There are several things to note in this script:

  • Both the left and right DBS leads are loaded in Matlab and are connected in a single wireframe dataset. The topology correction process is run on this "super-lead" in order to remove gamma distance violations not only between the segments of a given lead, but also between segments belonging to different leads. Once the topology correction has been performed, the leaft and right leads can be separated again.
  • The topology correction process is run at several multi-resolution levels. In the RUN_OPT_bilateral.m, the multi-resolution process has only two iterations: In the first iteration, the input lead are resampled with a 5 mm linear resolution and the topology correction process is run on this resampled lead model. In the second iterations, the corrected lead resulting from the first iteration is resampled at 3 mm resolution and the topogy correction process is run again on this refined wireframe model. This multi-resolution strategy avoids the correction process to get stuck on a local minimum that does not satisfy the constraints. More multi-resolution loops and resolutions can be added by simply lines 21 and 22 of the script.
  • The topology correction process itself is the Matlab function deform_path_LINEAR.m. The input to this function are, in this order:
    • The