# DBS electrode reconstruction

**URL:** <https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872>\
**Category:** Support\
**Created:** [January 19, 2018, 2:24am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872 "2018-01-19T02:24:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [January 19, 2018, 2:24am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/1 "2018-01-19T02:24:27Z")

</div>

Hi,

I’m interested in DBS electrode reconstruction and was wondering if there was a way to do this in 3D Slicer. I’ve used the Editor and Model Maker modules to segment out the DBS leads. I am now trying to figure out the contact positions for each lead. I understand that the PaCER method in Matlab is able to model the center-line for each lead and subsequently obtain a lead skeleton and derive the contact coordinates. After seeing this discussion, I ran the ‘Extract Skeleton’ module on one of the segmented leads using 1000 points and a 2D skeleton type; the points can be clearly seen within the leads. I installed the SlicerVMTK module to compute the center-line but having trouble using the Input function, i.e., I cannot load anything. A,so, if there is an easier way to do DBS electrode reconstruction in 3D Slicer, that would be great to know. Thanks for your help.

Vinny

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 19, 2018, 5:45pm UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/2 "2018-01-19T17:45:24Z")

</div>

Pierre Jannin’s group in Rennes developed a nice system for DBS planning and guidance based on Slicer and PyDBS. You can download an overview paper from [here](https://www.researchgate.net/publication/262075665_PyDBS_an_automated_image_processing_workflow_for_deep_brain_stimulation_surgery). Maybe @mholden8 can give you more details or can help you get in contact with them.

If you only need DBS lead segmentation, then I think Segment Editor’s `Grow from seeds` effect could work very well. You may need to crop and resample the volume using Crop volume module (to have high, anisotropic resolution so that region growing can follow the leads more robustly). You should be able to segment multiple leads at once, specifying one small seed segment for each, and a larger seed for “other”.

> [@Vinny](#):
>
> having trouble using the Input function, i.e., I cannot load anything

I would be happy to help with this, too, but of course I need much more accurate description of what you did, what you expected to happen, and what happened instead.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [January 20, 2018, 1:01am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/3 "2018-01-20T01:01:28Z")

</div>

Hi Andras,

Thank you very much for your reply. I’ll go through the PyDBS paper and  
will contact @mholden8 for further details on PyDBS. I  
have been manually segmenting the electrodes using the Threshold Effect in  
the Editor Module and removing any artifact (surgical staples, etc…)  
prior to using the Model Maker module and saving the output in both NIFTI  
and VTK formats. I’m establishing a tractography workflow and imported the  
white matter tracts into 3d Slicer and converted to VTK. I’d like to be  
able to quantify distances between white matter tracts of interest and the  
electrode contacts in 3d Slicer. So, my goal is to determine the contact  
coordinates on the segmented lead.

I was thinking that computing a center-line through the segmented lead and  
deriving a polynomial expression may help with determining the coordinates  
of the four contacts. Alternatively, I’ve used PaCER to derive the lead  
skeleton and the xyz contact coordinates and saved them as an excel file.  
I’m certain that Slicer has a method of plotting these contact coordinates  
onto the segmented lead. Maybe I can start with this and see what I get.  
Will the Python Interactor help with this or is there an established module  
that I could use for plotting these coordinates onto the image?

Regards,

Vinny

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 22, 2018, 7:38pm UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/4 "2018-01-22T19:38:51Z")

</div>

I’ve updated `‘Extract Skeleton` module to be able to export centerline points to markups fiducial list node (and improved point computation accuracy). It will be available in tomorrow’s nightly build.

Once you have your centerline points in markups node, then you can use `Markups To Model` module (available in MarkupsToModel extension) to create a trajectory model using spline or polygonal line fitting.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [January 22, 2018, 7:54pm UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/5 "2018-01-22T19:54:10Z")

</div>

Hi Andras,

Thank you very much for the update! I look forward to testing this out  
soon.

Regards,

Vinny

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [January 24, 2018, 2:17am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/6 "2018-01-24T02:17:24Z")

</div>

Hi Andras,

Thanks, the trajectory model works great. Is there a way of getting the equation of the calculated trajectory model?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/1/51356c6f351c2fc19197ca446be1e5edfb1cd7db.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 24, 2018, 4:23am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/7 "2018-01-24T04:23:00Z")

</div>

You cannot get the trajectory model, but you can get the curve point at any resolution (by setting high value for “segments per point”). I’ve also updated the module so that when you specify 0 for radius then instead of a tube model, a simple polyline model is generated.

You can get points of the line in the output model as a numpy array like this:

```
curveModelNode = slicer.util.getNode('MarkupsToModelModel')
points = slicer.util.arrayFromModelPoints(curveModelNode)
```

---

<div class="post-metadata">

**Author:** ![mholden8](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mholden8/32/1112_2.png) [@mholden8](https://discourse.slicer.org/u/mholden8)\
**Post date:** [January 25, 2018, 1:39pm UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/8 "2018-01-25T13:39:47Z")

</div>

@Vinny, I just spoke directly to Dr. Pierre Jannin about this. He says he would be happy to chat with you about using PyDBS for DBS electrode reconstruction. He asks you to contact him directly. Please find his contact info here: [https://medicis.univ-rennes1.fr/members/pierre.jannin/index](https://medicis.univ-rennes1.fr/members/pierre.jannin/index).

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [January 25, 2018, 5:19pm UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/9 "2018-01-25T17:19:48Z")

</div>

@mholden8, thank you very much for speaking to Dr. Jannin about this and providing me his contact information. @lassoan: thanks for all your help so far.

---

<div class="post-metadata">

**Author:** ![shwetasked](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@shwetasked](https://discourse.slicer.org/u/shwetasked)\
**Post date:** [September 14, 2025, 7:48am UTC](https://discourse.slicer.org/t/dbs-electrode-reconstruction/1872/10 "2025-09-14T07:48:56Z")

</div>

Hi Vinny,

Came across your thread from, oh 7 years ago now! I was wondering how your DBS electrode reconstruction went, were you able to do it using 3D Slicer and the PaCER toolbox? I’m embarking on a similar project myself, with the goal of making models of reconstructed DBS electrodes on a patient’s brain accessible for their viewing and understanding, and also for researchers and clinicians to be able to represent these figures accurately in their publications!
