# Automated multiple trajectory planning algorithm for the placement of stereo-electroencephalography (SEEG) electrodes in epilepsy treatment

- 1k Downloads
- 5 Citations

## Abstract

### Purpose

About one-third of individuals with focal epilepsy continue to have seizures despite optimal medical management. These patients are potentially curable with neurosurgery if the epileptogenic zone (EZ) can be identified and resected. Stereo-electroencephalography (SEEG) to record epileptic activity with intracranial depth electrodes may be required to identify the EZ. Each SEEG electrode trajectory, the path between the entry on the skull and the cerebral target, must be planned carefully to avoid trauma to blood vessels and conflicts between electrodes. In current clinical practice trajectories are determined manually, typically taking 2–3 h per patient (15 min per electrode). Manual planning (MP) aims to achieve an implantation plan with good coverage of the putative EZ, an optimal spatial resolution, and 3D distribution of electrodes. Computer-assisted planning tools can reduce planning time by quantifying trajectory suitability.

### Methods

We present an automated multiple trajectory planning (MTP) algorithm to compute implantation plans. MTP uses dynamic programming to determine a set of plans. From this set a depth-first search algorithm finds a suitable plan. We compared our MTP algorithm to (a) MP and (b) an automated single trajectory planning (STP) algorithm on 18 patient plans containing 165 electrodes.

### Results

MTP changed all 165 trajectories compared to MP. Changes resulted in lower risk (122), increased grey matter sampling (99), shorter length (92), and surgically preferred entry angles (113). MTP changed 42 % (69/165) trajectories compared to STP. Every plan had between 1 to 8 (median 3.5) trajectories changed to resolve electrode conflicts, resulting in surgically preferred plans.

### Conclusion

MTP is computationally efficient, determining implantation plans containing 7–12 electrodes within 1 min, compared to 2–3 h for MP.

## Keywords

Computer-assisted planning Epilepsy Neurosurgery Image-guided neurosurgery## Introduction

Between 20 and 40 % of focal epilepsy patients are refractory to antiepileptic medications [13]. Such patients are candidates for curative surgery, which aims to resect the epileptogenic zone (EZ) that generates seizures [3]. In about 25 % of surgical candidates, the EZ cannot be inferred from noninvasive imaging data, and intracranial electroencephalography (EEG) is needed to identify the EZ [7].

Stereo-EEG (SEEG) records EEG signals via depth electrodes surgically implanted in the brain. SEEG electrodes record from a 1-cm core around the cerebral entry to the distal end (target) that may be placed in hippocampus, amygdala, or midline or neo-cortex in temporal, frontal, parietal, or occipital lobes. Electrode implantation carries a risk of haemorrhage, neurologic deficit, and infection [4].

- 1.
Integrating information across imaging modalities to locate critical structures, GM, and targets.

- 2.
Optimising several criteria for each trajectory to sample the target, avoid critical structures, and obtain a suitable angle to traverse the skull.

- 3.
Adjusting trajectories to maximise GM capture and avoid electrode conflicts, whereby two electrodes may contact each other. Placing a new electrode may require adjusting previously planned trajectories.

We present an automated multiple trajectory planning (MTP) algorithm that calculates a combination of trajectories, or plan, for a set of targets. Trajectories are assessed on proximity to critical structures (risk score) and sampling of GM [GM-white matter (GM-WM) ratio]. Our MTP algorithm uses dynamic programming to reduce the search space and a depth-first search to find a plan whereby each electrode trajectory is surgically feasible, does not interfere with other trajectories, avoids critical structures, and maximises GM sampling. MTP is integrated into the EpiNav\(^{\mathrm{TM}}\) software platform [29] to enable manual trajectory assessment.

The remainder of the manuscript is organised as follows. The third section describes the previous work in computer-assisted trajectory planning. The fourth section describes our MTP algorithm. The fifth section describes the evaluation of our MTP algorithm. The sixth section discusses MTP, and the seventh section provides concluding remarks.

## Previous work in trajectory planning

Trajectory planning algorithms have been developed for deep brain stimulation (DBS) electrodes [1, 2, 8, 14], biopsy needles [11, 16, 20, 23, 24], or SEEG electrodes [5, 6, 26, 27, 29]. These methods provide either: (1) assisted planning to aid manual trajectory selection [11, 16, 20]; (2) automated planning for a single trajectory planning [1, 2, 8, 10, 14, 24, 25, 29]; or (3) automated multiple trajectory planning [5, 6, 26, 27].

Single trajectory planning algorithms automatically determine the best trajectory for one electrode given a specific quantitative measure. [25] assessed trajectories using a risk score calculated by summing traversal costs, where regions to be avoided had a high traversal cost, along the trajectory. Similarly, [10] summed traversal costs along the trajectory but added a penalty for trajectories near blood vessels to reduce the risk of haemorrhage. [1] assessed trajectories by first removing potential trajectories that were an unsafe distance from critical structures. The remaining trajectories were assessed by a weighted sum of (1) the minimum distance to critical structures and (2) the cumulative distance from all critical structures. [23] calculated a traversal cost by first computing a per pixel risk score, based on distance to critical structures. They then determined two risk scores: (1) maximum risk along the trajectory and (2) a summation of the risk along the trajectory. The user could select which of these two risk scores to use. [8] developed a generic optimisation algorithm for trajectory planning, allowing a user to define a set of hard constraints, rules that must not be violated, and soft constraints, rules that could be minimised. The generic optimisation eliminates trajectories that violate the hard constraints and then finds the trajectory which minimises the summation of soft constraints. [2] used a similar approach, defining hard constraints, specific entry points and avoiding critical structures (ventricles, blood vessels, sulci), and soft constraints, minimising overlap with the caudate and GM. [14] combined 6 soft constraints and 2 hard constraints to define a weighted cost function that determined the best trajectory for targeting the subthalamic nucleus. [26] developed an algorithm that maximises distances from critical structures and GM sampling. [24] developed an algorithm that optimises a weighted sum of the trajectory distance to critical structures so that blood vessels, with a high weight, are always avoided, while WM tracts and regions of cortical function, with a low weight, may be traversed if no other path exists. Constraints in [24] are specific to placing electrode for DBS and may not be generalisable to SEEG electrode implantation.

Multiple trajectory planning algorithms determine the best combination of trajectories, or plan, for multiple electrodes. Multiple trajectory planning not only takes into account the quantitative measures for individual electrodes but also that electrodes must not contact each other. [26] optimised three electrodes with targets in the amygdala, anterior and posterior hippocampus so that risk was minimised and there were no conflicts between electrodes. In [26] potential entry points were constrained by the use of target specific entry map priors. A more extensive evaluation of this method on 37 patients was presented in [27] in which increased GM sampling by optimising the number of electrode contacts in GM was demonstrated.

[5] presented a multiple trajectory planning algorithm that operates serially. The algorithm sets the first electrode to the best trajectory, and additional electrodes are set by removing trajectories that interfere with existing electrodes, and then selecting the best trajectory. This algorithm is dependent on trajectory order and may not find an optimal plan. [6] overcame these limitations by evaluating all potential plans and returning the best plan. However, enumerating all potential plans is computationally expensive when evaluating many targets or many potential trajectories per target. To reduce the number of potential plans, [6] reduced potential entry points by randomly sampling within a user-specified region.

Previous work from our group presented an automated entry point search algorithm [29] in which all points on the skull were potential entry points, removing the need to manually specify entry regions or define entry map priors for each target. All points on the skull result in 2000–10,000 potential entry points, and for eight targets this corresponds to a minimum of \(1\text {E}26\) potential plans.

We present a MTP algorithm that combines dynamic programming to reduce the number of potential plans, and depth-first searching, to find a suitable plan. Trajectories are assessed by risk score, measured as the cumulative distance to blood vessels from the trajectory [29], and GM sampling, measured as the proportion of electrode contacts that are in GM. Our algorithm is an improvement over the current state of the art in that it: (1) finds a combination of electrode trajectories with no limitations on the number or order of electrodes and (2) is computationally efficient, finding a plan with 7 to 12 electrode in under one minute, and (3) is integrated in the EpiNav\(^{\mathrm{TM}}\) software platform to enable manual assessment.

## Multiple trajectory planning algorithm

A trajectory is defined as \(v = \lbrace T, E, R, G \rbrace \) where *T* is the target in the brain, *E* is the entry on the skull, *R* is the risk score, and *G* is the GM-WM ratio. For a set of *N* targets a plan is defined as \(V( N ) = \lbrace v_{1,a_{1}},\ldots , v_{N,a_{N}} \rbrace : a_{i} \in \lbrace 1,\ldots , M_{i} \rbrace , i \in \lbrace 1, \ldots , N \rbrace \) where \(M_{i}\) is the number of potential trajectories for the \(i^{\mathrm{th}}\) target. The plan *V*( *N* ) is defined such that each trajectory attains one of *N* targets. MTP finds a plan \(V_{\mathrm{min}}( N )\) that attains all targets, minimises *R*, maximises *G*, and avoids conflicts between electrodes.

Prior to trajectory planning, segmentation of the skull and critical structures is performed as described in the section “Critical structure extraction”. For each target \(T_{i}\), a risk score \(R_{i,a_{i}}\), that quantifies proximity to blood vessels, and a GM-WM ratio \(G_{i,a_{i}}\), that quantifies GM sampling, are calculated as described in the section “Single trajectory planning algorithm”. The MTP algorithm described in the section “Multiple trajectory planning algorithm” calculates \(V_{ \mathrm{min}}( N )\). The EpiNav\(^{\mathrm{TM}}\) software platform enables manual assessment of \(V_{\mathrm{min}}( N )\) as described in the section “Plan visualisation and assessment”.

### Critical structure extraction

Automated trajectory planning is dependent on accurately segmenting critical structures (arteries, veins, and sulci), GM, and the skull surface. Algorithms chosen for these tasks are currently being used in the clinic to generate 3*D* models for manual trajectory planning and have been used in presurgical patient evaluation for over 4 years [19, 21]. Blood vessels are segmented with a customised vessel extraction tool [30] from CT angiography, 3*D* phase contrast MRI, or T1-weighted MRI with gadolinium enhancement. GM and the cortex were segmented using FreeSurfer [9]. Sulci were extracted from the cortex surface. Figure 1c illustrates an example segmentation for veins (cyan), arteries (red), and sulci (peach).

Skull segmentation with template registration constrains entry points to regions suitable for implantation. A patient-specific skull is segmented from a CT scan using thresholding and morphologic dilation to ensure a fully connected surface. The template skull is aligned to the patient skull using Iterative Closest Points (ICP) [28] to minimise the distance between the two surfaces. The template skull excludes regions inappropriate for implantation such as the face, ears, and regions inferior to the transverse sinus. Figure 1 shows an example patient (white) and template (yellow) skull.

### Single trajectory planning algorithm

Previous work from our group [29] presented real-time automated single trajectory planning (STP) for a target \(T_i\). STP calculates potential entry points \(\hat{E}_{i,a_{i}} : a_{i} \in \lbrace 1, \ldots , M_{i} \rbrace \) by considering trajectory length and entry angle (described in the section “Entry point search”). Next trajectories, defined as \(\overline{\hat{E}_{i,a_{i}} T_{i}}\), that intersect critical structures (arteries, veins, or sulci) are removed from consideration. Then at evenly spaced points along each trajectory \(x \in \overline{E_{i,a_{i}} T_{i}}\) the distance to the nearest blood vessel \(f_{\mathrm{crit}}(x)\) is found (described the section “Bounding volume hierarchy (BVH) for trajectory evaluation”). Finally for \(\overline{E_{i,a_{i}} T_{i}}\) a risk score \(R_{i,a_{i}}\), computed from \(f_{\mathrm{crit}}(x)\), and a GM-WM ratio \(G_{i,a_{i}}\) are calculated (described in the section “Trajectory ranking”). A stratified ranking algorithm sorts trajectories by first minimising \(R_{i,a_{i}}\) and then maximising \(G_{i,a_{i}}\).

#### Entry point search

- 1.
**Trajectory length**The length of \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) must be shorter than \(d_{{\mathrm{length}}}\), the maximum electrode length. - 2.
**Entry angle**The angle between \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) and the skull normal must be less than \(d_{{\mathrm{angle}}}\), the angle that can be accurately drilled.

#### Bounding volume hierarchy (BVH) for trajectory evaluation

Each trajectory \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) is tested for intersection with critical structures (arteries, veins, sulci) using a bounding volume hierarchy (BVH) to enable real-time calculation. Trajectories that intersect these structures are removed from consideration. All remaining trajectories are sampled at 128 evenly spaced points *x* such that \(x\in \overline{E_{i,a_{i}} T_{i}}\). For every *x*, the distance to the nearest blood vessel (arteries, veins) \(f_{\mathrm{crit}}(x)\) is calculated. BVH construction and traversal are described below.

*Bounding volume hierarchy construction* For each critical structure (arteries, veins, and sulci) a BVH is constructed as in [12]. Each triangle in the surface is assigned a 30-bit Morton code [15], calculated by combining the 10-bit Morton code of each triangle vertex coordinate. An efficient bit-wise sorting of the triangles is performed using the Morton codes. The BVH is created by iteratively splitting triangles according to the highest different bit between Morton codes. This is repeated until each leaf node contains one triangle. Finally, for every node a bounding box is calculated. For each leaf node the bounding box is calculated as the smallest rectangle that contains the triangle. The bounding box for all other nodes is the union of the bounding boxes of their children nodes.

*Bounding volume hierarchy traversal* BVH traversal detects collision of \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) with each critical structure. Initially the top BVH node is added to the queue. If \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) intersects the bounding box of the first node in the queue, its children nodes are added to the queue. Once a leaf node is reached \(\overline{\hat{E}_{i,a_{i}} T_{i}}\) is removed from consideration if it intersects the triangle of the leaf node.

For the remaining trajectories, the closest distance between each point \(x \in \overline{E_{i,a_{i}} T_{i}}\) and the \(j\hbox {th}\) critical structure \(f_{j}(x)\) is calculated. For this computation sulci are not included. Initially the top BVH node is added to the queue and \(f_{j}(x) = \infty \). The first node in the queue is removed, and the distance between each child node and its bounding box \(f_{bb}(x)\) is calculated. For a point inside the bounding box \(f_{bb}(x) = 0\). If \(f_{bb}(x) < f_{j}(x)\) the node is added to the queue so that the first node corresponds to the smallest value of \(f_{bb}(x)\). For a leaf node the distance between *x* and the triangle is computed, if \(f_{tri}(x) < f_{j}(x)\), then \(f_{j}(x) = f_{tri}(x)\). This is repeated until no nodes are in the queue. After all critical structures have been evaluated, the closest distance is calculated as \(\displaystyle f_{\mathrm{crit}}(x) = {{\mathrm{arg\,min}}}_{j} ( f_{j}(x))\).

#### Trajectory ranking

*Risk score* The risk score \(R_{i,a_{i}}\) measures cumulative distance to blood vessels. The trajectory \(\overline{E_{i,a_{i}} T_{i}}\) has a high risk if the nearest critical structure is less than a “Safety Margin”, determined by the user-defined value \(d_{\mathrm{safety}}\). If \(\overline{E_{i,a_{i}} T_{i}}\) has a distance to the nearest critical structure greater than a “Risk Zone”, determined by the user-defined value \(d_{\mathrm{risk}}\), it has no potential risk.

*x*and the nearest critical structure. For normalisation purposes if \(f_{{\mathrm{crit}}}(x) > d_{{\mathrm{risk}}}\), then \(f_{{\mathrm{crit}}}(x)= d_{{\mathrm{risk}}}\) so that the final value the

*x*contributes to the risk score is zero. If \(f_{{\mathrm{crit}}}(x) < d_{{\mathrm{safety}}}\), then automatically \(R_{i,a_{i}} = 1\), representing the highest risk.

*Grey matter-white matter ratio*GM-WM ratio measures the proportion of electrode contacts in GM. GM-WM ratio corresponds to the SEEG efficiency for each trajectory as GM generates seizures. For each trajectory \(\overline{E_{i,a_{i}} T_{i}}\) a set of

*J*contact points, \(c_{j} : j \in \{1, \ldots , J \}\) each with a sampling radius \(c_r\) are defined. Each contact point is assessed if \(c_{j} \pm c_{r}\) is located in GM. GM-WM ratio is calculated as,

*J*is the number of contact points. \(H[\cdot ]\) is defined so negative values, locations inside GM, are 1 and positive values, locations outside GM, are 0. Similar to \(f_{{\mathrm{crit}}}(x)\) a BVH is used to calculate \(f_{gm}(\cdot )\).

*Stratified ranking* Trajectories are first ranked by \(R_{i,a_{i}}\) so that \(v_{i,1}\) has the lowest risk. Next trajectories are placed into *K* histogram bins so the \(k^{\mathrm{th}}\) bin contains \(v_{i,a_i}: (k-1)/K \le a_i < k/K\). Within each bin trajectories are ranked according to \(G_{i,a_{i}}\) so \(v_{i,1}\) has the highest GM-WM ratio.

### Multiple trajectory planning algorithm

#### Depth-first search algorithm

Algorithm 1 iteratively (1) calculates \(\hat{V}_{{\mathrm{min}}}(n)\), a suitable plan for *n* trajectories and (2) rejects \(\hat{V}_{{\mathrm{min}}}(n)\) if electrodes conflict. At each iteration of Algorithm 1 a set of low risk plans, defined as \({\mathbf {V}}_{p} (n) = [V_1(n), \ldots , V_q(n)]\), is calculated. For the lowest risk plan \(\hat{V}_{{\mathrm{min}}}(n) \in {\mathbf {V}}_{p} (n)\) the function \(D_{{\mathrm{all}}}( \cdot )\) detects conflict between electrodes by finding the minimum Euclidean distance between all pairs of trajectories in \(\hat{V}_{{\mathrm{min}}}(n)\) (i.e. \(\min (D(\overline{E_{i,a_{i}} T_i}, \overline{E_{j,a_{j}} T_j} ) : \forall i, \forall j \in \{ 1, \ldots , n\} , i \ne j)\)). When an electrode conflict is detected \({\mathbf {V}}_{p}(n)\) is updated as described in the section “Dynamic programming for determining potential combinations”. Once \(\hat{V}_{{\mathrm{min}}}(n)\) has no conflicts, \(n \longleftarrow n+1\) and the algorithm continues until \(V_{{\mathrm{min}}}(N)\) is found.

#### Dynamic programming for determining potential combinations

For each target \(T_i\), trajectories are ranked so \(v_{i,1}\) is the best trajectory (in the section “Trajectory ranking”). Initially, \({\mathbf {V}}_{p} (n) \longleftarrow [V_1]\) where \(V_1 = \lbrace v_{1,1} \rbrace \) which corresponds to adding a potential plan containing the best trajectory for the \(1{\mathrm{st}}\) electrode. At the next step, \(n=2\), \({\mathbf {V}}_{p}(n) \longleftarrow [ \lbrace V_{{\mathrm{min}}}(n-1), v_{n,1}\rbrace ]\), which corresponds to adding the best trajectory for the \(2{\mathrm{nd}}\) electrode. Algorithm 1 proceeds in this manner until electrode conflict is detected.

- 1.
Finding trajectories

*i*and*j*that violate \(D(\overline{E_{i,a_{i}} T_i}, \overline{E_{j,a_{j}} T_j} ) < d_{{\mathrm{traj}}}\). Note that \(i \in \{1,\ldots , n-1\}\) and \(j=n\) otherwise an electrode conflict would have been detected earlier. - 2.
Updating the \(i^{\mathrm{th}}\) trajectory \(\tilde{V}_{i} (n) = \min ({\mathbf {V}}_{p}(i))\).

- 3.
Updating the \(n^{\mathrm{th}}\) trajectory: \(\tilde{V}_{n} (n) = \lbrace v_{1,a_{1}},\ldots , v_{i,a_{i}}, \ldots , v_{n,a_{n}+1}\rbrace \).

- 4.
Adding \(\tilde{V}_{i}(n)\) and \(\tilde{V}_{n}(n)\) to \({\mathbf {V}}_{p}(n)\).

### Plan visualisation and assessment

#### Quantitative measures

Four measures of trajectory suitability, length, angle, risk score, and GM-WM ratio, are displayed in the EpiNav\(^{\mathrm{TM}}\) platform. Trajectory length is calculated as the length of \(\overline{E T}\), where *E* is the entry point and *T* is the target. Trajectory angle is calculated as the angle of \(\overline{E T}\) with respect to the skull normal. Trajectory risk score is calculated as in Equation 2, and GM-WM ratio is calculated as in Equation 3.

#### Trajectory profile

The trajectory profile provides a (a) risk profile and (b) GM profile. The risk profile displays \(f_{{\mathrm{crit}}}(x)\) (described in the section “Trajectory ranking”) for \(x \in \overline{E T}\). The colour of \(f_{{\mathrm{crit}}}(x)\) corresponds to the closest blood vessel at *x*. The GM profile displays the colour corresponding to the tissue type (GM or WM) each electrode contact is located in. Regions of the trajectory outside the cortex are shown in the electrode colour.

Figure 3 displays the risk profile in the upper right panel. Red corresponds to trajectory regions closest to an artery, cyan to trajectory regions closest to a vein. The red line indicates the “Safety Margin” \((d_{{\mathrm{safety}}})\). The black line indicates the position of the probe eye view (Fig. 3, bottom right panel), black text shows the distance between the probe eye view and *T*, and red text shows the distance to the nearest critical structure \((f_{{\mathrm{crit}}}(x))\).

#### Probe eye view

The probe eye view displays an image perpendicular to the trajectory. This allows the user to navigate along the trajectory and assess proximity to critical structures. The probe eye view is generated by finding the geometric plane perpendicular to \(x \in \overline{E T}\). Nearest neighbour interpolation calculates the intensity value for each pixel in this plane. Figure 3 displays a probe eye view in the bottom right panel.

## Experimental design and results

### Dataset description

Evaluations were performed on retrospective data from 18 patients with medically refractory epilepsy who underwent SEEG implantation. All patients had unilateral implantations with between 7 and 12 electrodes for a total of 165 electrodes. All studies involving human participants were in accordance with the ethical standards of the institutional and/or national research committee and with the 1964 Helsinki Declaration and its later amendments or comparable ethical standards. For this type of study formal consent is not required.

### Experimental design

Each electrode target was manually determined by an expert neurosurgeon relying on conventional 2*D* visualisation. Targets remained fixed across planning methods.

*J*, \(c_j\), and \(c_r\) were determined by choosing a common SEEG electrode configuration.

Parameter values determined from expert neurosurgeons. \(d_{{\mathrm{angle}}}\) is the largest angle safely realised with a surgical drill

Parameter | Value |
---|---|

\(d_{{\mathrm{length}}}\) | 80.0 mm |

\(d_{{\mathrm{angle}}}\) | \(25^{\circ }\) |

\(d_{{\mathrm{safety}}}\) | 3.0 mm |

\(d_{{\mathrm{risk}}}\) | 10.0 mm |

| 10 |

\(c_j\) | 6 mm intervals from electrode tip |

\(c_r\) | 1.2 mm |

\(d_{{\mathrm{traj}}}\) | 10.0 mm |

| 10 |

### Experiment 1: trajectory ranking strategies

We compared trajectories determined by risk score [29] and stratified ranking described in the section “Trajectory ranking”. Risk score ranking finds the trajectory with the lowest risk score, while stratified ranking finds a trajectory that minimises risk score while maximising GM-WM ratio. Stratified ranking is expected to increase GM-WM ratio and risk score compared to risk score ranking. A two-tailed Student’s t test was used to compare trajectories between the two ranking methods, with the null hypothesis being that the methods calculate similar trajectories.

Figure 4 displays GM-WM ratio and risk score for trajectories calculated with the two ranking methods. Both methods produced trajectories with similar risk scores, and stratified ranking increased the risk score on average \(0.02 (0.0-0.13)\) and was not statistically significant \((p=0.497)\). Stratified ranking increased the GM-WM ratio by a mean of \(0.08 (0.0-0.57)\) and in 22/165 trajectories by over 0.2. The difference in GM-WM ratio is statistically significant \((p=5.5 \times 10^{-7})\). Stratified ranking improved GM-WM ratio with an insignificant increase in risk score.

### Experiment 2: target order independence

We evaluated the effect of target order on MTP. For each plan, target order was randomly selected 5 times and the trajectories for each target were compared. The order targets were considered did not change the final plan, and in all cases the same trajectory was returned.

### Experiment 3: planning strategies

#### Quantitative assessment

A two-tailed Student’s t test was used to compare trajectory measures between MTP and the other methods (MP, STP) with the null hypothesis being the methods return similar trajectories. To account for multiple comparisons \((n=2)\), a Bonferroni correction is applied; hence, a statistically significant value is \(\alpha = 0.05/n = 0.025\).

All 165 trajectories changed between MP and MTP. Figure 5 displays quantitative measures for each trajectory. MTP reduced the length of 92/165 trajectories \((p=0.033)\), reduced the angle with respect to the skull surface normal in 113/165 trajectories \((p=2.7 \times 10^{-8})\), increased GM-WM ratio in 99/165 trajectories \((p=7.0 \times 10^{-3})\), reduced the risk score in 122/165 trajectories \((p=9.3 \times 10^{-8})\), and reduced the distance to the closest sulci in 70 / 165 trajectories\((p=0.50)\). For 7 trajectories MTP returned trajectories with a risk score of 1, while MP returned trajectories with a risk score \( {<}1\); however, these MP trajectories violated the angle constraint (angle \(> d_{{\mathrm{angle}}}\)) (Fig. 6).

*p*between 0.03 and 0.60). Although changes in quantitative measure of risk were not statistically significant, there were significant practical differences in that STP provided implantation plans that could not be surgically implemented due to electrodes being placed too close to each other. In contrast MTP found implantation plans in which each electrode trajectory was placed so that it could be implemented during surgery. MTP calculated a higher risk score than STP in 38/69 trajectories. Additionally, GM-WM ratio decreased in 42/69 trajectories. For one trajectory MTP calculated a much higher trajectory risk score (1 compared to 0.28); however, no low risk trajectories were able to avoid conflicts with other electrodes.

#### Clinical assessment

- 1.
Avascularity: each trajectory was assessed with the probe eye view to confirm the absence of nearby blood vessels. Each plan was scored as the ratio of safe, avascular trajectories to all trajectories.

- 2.
Conflicts: each plan was assessed in the volumetric view for conflicts between electrodes, due to either contact or inadequate spacing. Each plan was scored as the number of conflicts.

- 3.
Feasibility: each electrode was assessed on the feasibility of surgical implementation taking into account the entry point and trajectory. Each plan was scored as the ratio of feasible electrodes to all electrodes.

Measures of plan feasibility for MP, STP, and MTP obtained by one neurosurgeon blinded to plan origin

Plan | Number of electrodes | Conflicts | Avascularity | Feasibility | ||||||
---|---|---|---|---|---|---|---|---|---|---|

MP | STP | MTP | MP | STP | MTP | MP | STP | MTP | ||

1 | 12 | | 3 | | 12 | 9 | 10 | 12 | 10 | 10 |

2 | 11 | | 3 | | 11 | 10 | 9 | 11 | 9 | 9 |

3 | 7 | | 2 | | 7 | 5 | 6 | 7 | 5 | 6 |

4 | 7 | | 1 | | 7 | 6 | 6 | 7 | 6 | 6 |

5 | 9 | | 2 | | 9 | 9 | 9 | 9 | 8 | 8 |

6 | 12 | | 3 | | 12 | 11 | 11 | 12 | 11 | 11 |

7 | 7 | | 5 | | 7 | 6 | 6 | 7 | 7 | 7 |

8 | 8 | | 2 | | 8 | 7 | 7 | 8 | 6 | 6 |

9 | 7 | | 1 | | 7 | 7 | 7 | 6 | 7 | 7 |

10 | 8 | | 1 | | 8 | 6 | 6 | 8 | 5 | 6 |

11 | 8 | | 2 | | 8 | 8 | 7 | 8 | 5 | 5 |

12 | 11 | | 3 | | 11 | 11 | 11 | 11 | 9 | 9 |

13 | 10 | | 5 | | 10 | 8 | 9 | 10 | 9 | 9 |

14 | 12 | | 4 | | 12 | 12 | 12 | 12 | 10 | 10 |

15 | 8 | | 3 | | 8 | 6 | 6 | 8 | 7 | 7 |

16 | 10 | | 1 | | 10 | 10 | 10 | 10 | 9 | 9 |

17 | 11 | | 2 | | 11 | 11 | 11 | 11 | 10 | 10 |

18 | 7 | | 3 | | 6 | 7 | 7 | 7 | 5 | 5 |

All | 165 | | 67 | | 164 | 149 | 150 | 165 | 138 | 140 |

Table 2 reports the plan feasibility measures. All three methods were effective at finding avascular trajectories for individual trajectories as determined by a neurosurgeon. This is expected as both STP and MTP are optimised according to risk score, a function of distance to critical structures. The 15 (16 for STP) trajectories that were determined to pass an unsafe distance to blood vessels were caused by the vessel segmentation algorithm not segmenting all of the small blood vessels. Only MP and MTP were effective at avoiding electrode conflicts, with the intertrajectory spacing being deemed sufficient for implementation by a neurosurgeon. Finally, all planning methods were reasonable at finding clinically feasible trajectories, although STP (138 / 165) and the MTP (140 / 165) were both inferior to MP (165 / 165). The main reasons for STP and MTP trajectories to be deemed not feasible were temporal electrodes not passing through the medial temporal lobe or orbitofrontal electrodes passing near or through the frontal sinus.

### Experiment 4: computational time

Computational efficiency of STP and MTP was evaluated. To enable a direct comparison between STP, which calculates the best trajectory for one target, and MTP, which calculates the best trajectories for *N* targets, the total time to determine all *N* trajectories was recorded. For STP the computation time is a summation of computation time for each target.

Plan computation time for STP and MTP reported in seconds

Plan | Number of electrodes | Algorithm | |
---|---|---|---|

STP time (sec) | MTP time (sec) | ||

1 | 12 | 3.62 | 8.77 |

2 | 11 | 21.68 | 21.72 |

3 | 7 | 25.83 | 25.85 |

4 | 7 | 14.70 | 14.71 |

5 | 9 | 11.18 | 19.41 |

6 | 12 | 13.68 | 14.17 |

7 | 7 | 22.32 | 28.43 |

8 | 8 | 13.87 | 25.60 |

9 | 7 | 11.31 | 11.75 |

10 | 8 | 4.19 | 4.21 |

11 | 8 | 20.03 | 20.05 |

12 | 11 | 43.68 | 57.38 |

13 | 10 | 11.95 | 21.00 |

14 | 12 | 18.22 | 19.11 |

15 | 8 | 11.39 | 24.14 |

16 | 10 | 3.85 | 3.86 |

17 | 11 | 3.15 | 4.96 |

18 | 7 | 9.22 | 9.23 |

median [range] | \(8.5\, [7 - 12]\) | \(12.77\, [3.15 - 43.68]\) | \(19.26\, [3.86 - 57.38]\) |

Computation time for the preprocessing steps was recorded. GM and cortex segmentation took \({\approx }20\) h, surface extraction for the blood vessels and sulci took between 150 and 180 s per structure, and skull segmentation and template registration took between 210 and 260 s. For SEEG electrode implantation patient scans are typically acquired at least 1 week prior to implantation planning; hence, preprocessing steps are not as time sensitive as MTP.

## Discussion

Our MTP algorithm is computational efficient, using dynamic programming to consider low risk plans in conjunction with a depth-first search algorithm to find a suitable plan. All plans evaluated containing between 7 and 12 electrodes were calculated in under a minute. Our MTP algorithm resolved electrode conflicts providing more feasible plans compared to STP. Figure 7 displays two plans determined by MP, STP, and MTP. Figure 7c displays a plan in which STP had two electrode conflicts (yellow–blue and pink–purple conflict), and such conflicts prevent the plan being surgically implemented. MTP had no conflicts as shown in Figure 7e. Figure 7d, f illustrates STP and MTP for a plan where one electrode was changed to resolve one electrode conflict (yellow–purple).

Our MTP algorithm has several differences from previously reported multiple trajectory planning algorithms [5, 6, 26, 27]. In terms of target selection, [6] required the user to select a target region from which potential target points were drawn from. [27] constrained target selection to three anatomic regions, amygdala, anterior, and posterior hippocampus. Our MTP algorithm requires the user to specify the target point.

For entry point selection [6] required the user to select an entry region on the skull. [27] defined entry map priors for each anatomic target to constrain potential entry points to surgically feasible regions. Our MTP algorithm uses a generic skull template to constrain entry points making it more flexible in the types of electrode trajectories proposed compared to other multiple trajectory planning algorithms. Constraining entry points may be desirable for some electrodes, for example to sample a specific superficial gyrus; however, it may be overly restrictive and result in nonoptimal trajectories for other electrodes.

When calculating trajectories both [6] and [27] sample target and entry regions to obtain a fixed number of trajectory combinations that are then evaluated in terms of risk and electrode conflicts. In contrast, our MTP algorithm considers all possible entry points when determining the trajectories.

Critical structures used to compute the risk score \(R_{i,a_{i}}\) (in the section “Critical structure extraction”) in this work were blood vessels (arteries and veins). Trajectories that intersected sulci were rejected, but sulci were not included in calculating \(R_{i,a_{i}}\). When analysing MP trajectories, it was found that while blood vessels were avoided by at least 3 mm (median value 5.11 mm), sulci were often much closer (median value 1.57 mm). Based on these results it was determined that maximising distance to sulci was not as important criteria as maximising distance to blood vessels. However, the algorithm presented to compute \(R_{i,a_{i}}\) is generalisable to other structures, such as sulci or ventricles, without significantly changing task complexity or expected results. Several other state-of-the-art methods have incorporated sulci avoidance by either taking into account the trajectory angle with respect to the cortex as in [6] or including sulci in the risk metric [27].

The introduction of a skull template (in the section “Critical structure extraction”) allows for potential entry points to be limited to surgically feasible regions. The face, ears, and base of the skull are avoided for safety and cosmetic reasons. Figure 8 provides an example where the use of the skull template is necessary to obtain a surgically feasible plan; without the skull template an electrode (orange) would have traversed the posterior fossa inferior to the transverse sinus and penetrated the tentorium cerebelli. However, the skull template as currently implemented is limited. Due to the variability in the position and size of the ears and forehead ICP registration does not always match nonfeasible regions between the patient and template skulls. Individually tailored skull templates would reduce the number of nonfeasible entry points but would increase planning time. Even with individually tailored skull templates our MTP algorithm would still suggest some nonfeasible trajectories. This is due to certain targets having accepted trajectories that neurosurgeons are reluctant to deviate from, even when these trajectories have a higher risk score. In future work, our MTP algorithm will be modified to enable the user to restrict specific electrodes to surgically preferred regions, thereby reducing infeasible trajectories.

In a clinical setting, individual electrode trajectories that are not feasible can be manually adjusted to an appropriate trajectory. However, depending on the location of trajectories, manually adjusting one trajectory may require adjustment of other trajectories to resolve conflicts between electrodes. The EpiNav\(^{\mathrm{TM}}\) software platform allows the user to fix individual electrode trajectories and rerun MTP on the remaining electrodes to find a suitable implantation plan as described in [17]. Multiple runs of MTP may be required to obtain an implantation plan in which all trajectories are safe and surgically feasible.

A thorough evaluation of our automated multiple trajectory planning algorithm for clinical use has been presented in [17]. In this study, three neurosurgeons compared 18 plans determined by MP and our MTP algorithm. All 18 plans were found to be feasible for clinical implementation. Individual trajectories were found to be safe for clinical implementation in \(77.1\,\% (128/166)\) of electrodes. \(10\,\% (18/166)\) of trajectories were found to be unsafe due to incorrect critical structure segmentation. To improve this performance, a more accurate vessel extraction algorithm is necessary to find avascular trajectories. \(7\,\% (12/166)\) of trajectories were deemed unsafe due to proximity to sulci or the midline, highlighting the need to incorporate sulci for a clinically realistic MTP algorithm.

## Concluding remarks

We present an automated multiple trajectory planning (MTP) algorithm using depth-first searching with dynamic programming. Our algorithm was evaluated with 18 plans with between 7 and 12 electrodes. Calculation of an implantation plan took on average \(19.26 (3.86-57.38)\) s. Implantation plans had a lower risk for 122 / 165 electrodes and higher grey matter-white matter (GM-WM) ratio for 99 / 165 electrodes. The computational efficiency of our algorithm enables near real-time planning of electrode implantations.

In this manuscript we focused on the development of our MTP algorithm leveraging existing methods for extracting the skull template, critical structures, and GM. Our algorithm was integrated into the EpiNav\(^{\mathrm{TM}}\) software platform to enable manual assessment of calculated trajectories. A larger, prospective, comprehensive clinical study of EpiNav\(^{\mathrm{TM}}\) is necessary to evaluate the utility of the software in planning intracerebral electrode implantations.

## Notes

### Acknowledgments

This study was funded by the Health Innovation Challenge Fund (HICF-T4-275, WT 97914), a parallel funding partnership between the Department of Health and Wellcome Trust. This work was undertaken at University College London Hospitals, which received a proportion of funding from the Department of Health’s National Institute for Health Research (NIHR), University College London Hospitals Biomedical Research Centre (BRC) funding scheme. The views expressed in this publication are those of the author(s) and not necessarily those of the Department of Health or Wellcome Trust.

## Compliance with ethical standards

## Conflict of interest

The authors declare that they have no conflict of interest.

## References

- 1.Bèriault S, Subaie F, Mok K, Sadikot AF, Pike GB (2011) Automatic trajectory planning of DBS neurosurgery from multi-modal MRI datasets. MICCAI 2011, vol 6891, Lecture Notes in Computer ScienceSpringer, Berlin Heidelberg, pp 259–266Google Scholar
- 2.Bériault S, Subaie FA, Collins DL, Sadikot AF, Pike GB (2012) A multi-modal approach to computer-assisted deep brain stimulation trajectory planning. Int J Comput Assist Radiol Surg 7(5):687–704CrossRefPubMedGoogle Scholar
- 3.David O, Blauwblomme T, Job AS, Chabardès S, Hoffmann D, Minotti L, Kahane P (2011) Imaging the seizure onset zone with stereo-electroencephalography. Brain 134(10):2898–2911CrossRefPubMedGoogle Scholar
- 4.de Almeida AN, Olivier A, Quesney F, Dubeau F, Savard G, Andermann F (2006) Efficacy of and morbidity associated with stereoelectroencephalography using computerized tomography or magnetic resonance imaging-guided electrode implantation. J Neurosurg 104(4):483–487CrossRefPubMedGoogle Scholar
- 5.De Momi E, Caborni C, Cardinale F, Castana L, Casaceli G, Cossu M, Antiga L, Ferrigno G (2013) Automatic trajectory planner for stereoelectroencephalography procedures: a retrospective study. IEEE Trans Bio-Med Eng 60(4):986–993CrossRefGoogle Scholar
- 6.De Momi E, Caborni C, Cardinale F, Casaceli G, Castana L, Cossu M, Mai R, Gozzo F, Francione S, Tassi L, Lo Russo G, Antiga L, Ferrigno G (2014) Multi-trajectories automatic planner for StereoElectroEncephaloGraphy (SEEG). Int J Comput Assist Radiol Surg 9(6):1087–1097Google Scholar
- 7.Duncan JS (2010) Imaging in the surgical treatment of epilepsy. Na Rev Neurol 6(10):537–550CrossRefGoogle Scholar
- 8.Essert C, Haegelen C, Lalys F, Abadie A, Jannin P (2012) Automatic computation of electrode trajectories for deep brain stimulation: a hybrid symbolic and numerical approach. Int J Comput Assist Radiol Surg 7(4):517–532CrossRefPubMedGoogle Scholar
- 9.Fischl B, Dale AM (2000) Measuring the thickness of the human cerebral cortex from magnetic resonance images. Proc Natl Acad Sci USA 97(20):11,050–11,055CrossRefGoogle Scholar
- 10.Fujii T, Emoto H, Sugou N, Mito T, Shibata I (2003) Neuropath planner-automatic path searching for neurosurgery. Int Congr Ser 1256:587–596CrossRefGoogle Scholar
- 11.Herghelegiu PC, Manta V, Perin R, Bruckner S, Gröller E (2012) Biopsy planner-visual analysis for needle pathway planning in deep seated brain tumor biopsy. Comput Gr Forum 31(3pt2):1085–1094Google Scholar
- 12.Karras T (2012) Maximizing parallelism in the construction of BVHs, octrees, and k-d trees. In: Proceedings of the 4th ACM SIGGRAPH/Eurographics conference on high-performance graphics, Eurographics Association, EGGH-HPG 2012:33–37Google Scholar
- 13.Kwan P, Brodie MJ (2004) Drug treatment of epilepsy: When does it fail and how to optimize its use? CNS Spectr 9(2):110–119CrossRefPubMedGoogle Scholar
- 14.Liu Y, Konrad PE, Neimat JS, Tatter SB, Yu H, Datteri RD, Landman BA, Noble JH, Pallavaram S, Dawant BM, D’Haese PF (2014) Multisurgeon, multisite validation of a trajectory planning algorithm for deep brain stimulation procedures. IEEE Trans Biomed Eng 61(9):2479–2487CrossRefPubMedPubMedCentralGoogle Scholar
- 15.Morton GM (1966) A computer oriented geodetic data base and a new technique in file sequencing. International Business Machines Company, New YorkGoogle Scholar
- 16.Navkar NV, Tsekos NV, Stafford JR, Weinberg JS, Deng Z (2010) Visualization and planning of neurosurgical interventions with straight access. IPCAI 2010, vol 6135, Lecture Notes in Computer ScienceSpringer, Berlin Heidelberg, pp 1–11Google Scholar
- 17.Nowell M, Rodionov R, Zombori G, Sparks R, Baio G, Gianluca T, Tisdall M, Diehl B, Wehner T, Miserocchi A, McEvoy AW, Ourselin S, Duncan (2016) Comparison of computer-assisted planning and manual planning for depth electrode implantations in epilepsy. J Neurosurg 10(10):1–9, doi: 10.3171/2015.6.JNS15487
- 18.Nowell M, Rodionov R, Diehl B, Wehner T, Zombori G, Kinghorn J, Ourselin S, Duncan J, Miserocchi A, McEvoy A (2014) A novel method for implementation of frameless StereoEEG in epilepsy surgery. Neurosurgery 10(4):525–534CrossRefPubMedPubMedCentralGoogle Scholar
- 19.Nowell M, Rodionov R, Zombori G, Sparks R, Winston G, Kinghorn J, Diehl B, Wehner T, Miserocchi A, McEvoy AW, Ourselin S, Duncan J (2015) Utility of 3D multimodality imaging in the implantation of intracranial electrodes in epilepsy. Epilepsia 56(3):403–413CrossRefPubMedPubMedCentralGoogle Scholar
- 20.Rincon-Nigro M, Navkar NV, Tsekos NV, Deng Z (2014) GPU-accelerated interactive visualization and planning of neurosurgical interventions. IEEE Comput Gr 34(1):22–31CrossRefGoogle Scholar
- 21.Rodionov R, Vollmar C, Nowell M, Miserocchi A, Wehner T, Micallef C, Zombori G, Ourselin S, Diehl B, McEvoy AW, Duncan JS (2013) Feasibility of multimodal 3D neuroimaging to guide implantation of intracranial (EEG) electrodes. Epilepsy Res 107(1–2):91–100CrossRefPubMedPubMedCentralGoogle Scholar
- 22.Shamir RR, Tamir I, Dabool E, Joskowicz L, Shoshan Y (2010) A method for planning safe trajectories in image-guided keyhole neurosurgery. MICCAI 2010, vol 6363, Lecture Notes in Computer ScienceSpringer, Berlin Heidelberg, pp 457–464Google Scholar
- 23.Shamir RR, Joskowicz L, Tamir I, Dabool E, Pertman L, Ben-Ami A, Shoshan Y (2012) Reduced risk trajectory planning in image-guided keyhole neurosurgery. Med Phys 39(5):2885–2895CrossRefPubMedGoogle Scholar
- 24.Trope M, Shamir RR, Joskowicz L, Medress Z, Rosenthal G, Mayer A, Levin N, Bick A, Shoshan Y (2015) The role of automatic computer-aided surgical trajectory planning in improving the expected safety of stereotactic neurosurgery. Int J Comput Assist Radiol Surg 10(7):1127–1140CrossRefPubMedGoogle Scholar
- 25.Vaillant M, Davatzikos C, Taylor RH, Bryan RN (1997) A path-planning algorithm for image-guided neurosurgery. CVRMed-MRCAS 1997, vol 1205, Lecture Notes in Computer ScienceSpringer, Berlin Heidelberg, pp 467–476Google Scholar
- 26.Zelmann R, Bèriault S, Mok K, Haegelen C, Hall J, Pike GB, Olivier A, Collins DL (2014) Automatic optimization of depth electrode trajectory planning. In: Clinical Image-Based Procedures. Translational Research in Medical Imaging, Lecture Notes in Computer Science, Springer International Publishing, pp 99–107Google Scholar
- 27.Zelmann R, Beriault S, Marinho MM, Mok K, Hall JA, Guizard N, Haegelen C, Olivier A, Pike GB, Collins DL (2015) Improving recorded volume in mesial temporal lobe by optimizing stereotactic intracranial electrode implantation planning. Int J Comput Assist Radiol Surg (IJCARS) 10(10):1599–1615CrossRefGoogle Scholar
- 28.Zhang Z (1994) Iterative point matching for registration of free-form curves and surfaces. Int J Comput Vision 13(2):119–152CrossRefGoogle Scholar
- 29.Zombori G, Rodionov R, Nowell M, Zuluaga MA, Clarkson MJ, Micallef C, Diehl B, Wehner T, Miserochi A, McEvoy AW, Duncan JS, Ourselin S (2014) A computer assisted planning system for the placement of sEEG electrodes in the treatment of epilepsy. IPCAI 8498: 118–127Google Scholar
- 30.Zuluaga MA, Rodionov R, Nowell M, Achhala S, Zombori G, Cardoso MJ, Miserocchi A, McEvoy AW, Duncan J, Ourselin S (2014) SEEG trajectory planning: Combining stability, structure and scale in vessel extraction. In: MICCAI 2014, Lecture Notes in Computer Science, vol 8674, Springer International Publishing, pp 651–658Google Scholar

## Copyright information

**Open Access**This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.