A new surgical path planning framework for neurosurgery

Despite using a variety of path‐finding algorithms that use tracts, the most significant advancement in this study is considering the values of all brain areas by doing atlas‐based segmentation for a more precise search. Our motivation comes from the literature’s shortcomings in designing and implementing path‐planning methods. Since planning paths with curvatures is a complex problem that requires considering many surgical and physiological constraints, most path‐planning strategies focus on straight paths. There is also a lack of studies that focus on the complete structure of the brain with the tracks, veins, and segmented areas. Instrument dependence is another inadequacy of the methods proposed in the literature.


| INTRODUCTION
Finding the optimal surgical path (best possible) for each surgery can be challenging for even the most skilled surgeon due to the complex surgical environment and the differences in anatomical structures between patients. 1The complex environment that the neurosurgeon operates in is surrounded by cisternal, vascular, and parenchymal anatomical structures which are essential to understand while designing a surgical plan.Any neurosurgical intervention must prioritise minimising neurological deficits. 2imarily for the treatment of tumours and vascular lesions, a surgical approach to the cranium is essential.An intricate threedimensional network of white matter fibres and vital anatomical structures must be navigated by the neurosurgeon during surgery to remove the lesion.The challenge for the neurosurgery world is to find the optimal pathway to deeply seated lesions in the cranium in that complex environment.Abundant removal of healthy tissue or inadequate removal of tumour tissue and the retention of tumour cell tissues are two main undesirable outcomes that may occur when searching for a minimally invasive approach to tumour removal procedures.
The removal of healthy tissue carries serious risks that might lead to the permanent loss of the motor and sensory abilities of the affected brain regions as well as lifelong disabilities. 3The success of any surgical procedure depends on the ability of the neurosurgeon to accurately identify the location and size of the tumour.This is necessary to create an individualised treatment plan for each patient.
The ultimate goal of any surgical intervention is to remove as much tumour tissue as possible while preserving as much of the surrounding healthy tissue as possible.There is a delicate balance between removing sufficient tumour tissue to minimise the recurrence of cancer and leaving enough normal tissue to minimise the risk of damaging the surrounding motor and sensory functions of the brain.
Tumours located deep within the brain pose a significant challenge to the neurosurgeon because they require a longer operating time due to the limited manoeuverability of the surgical instruments within the restricted space of the cranial cavity.Surgical navigation provides greater accuracy during surgical procedures by accurately depicting the internal structures of the cranium. 4nctional surgery, stereotactic radiosurgery, and the resection of deep-seated lesions are a few of the neurosurgical applications where surgical navigation is becoming an indispensable instrument.
There are currently two types of surgical navigation systems used in neurosurgery.Computer-assisted surgery and image-guided surgery are examples.Computer-assisted surgery employs electronic threedimensional visualisation technology to precisely visualise the internal structures of the brain and guide the surgeon to the exact location of the tumour, whereas image-guided surgery employs an external tracking device that is connected to the patient's head during surgery to provide real-time visual information of the location and surrounding anatomical structures of the brain. 5Both systems provide valuable intraoperative information that can be utilised to optimise the surgical procedure's outcome and minimise the risk of tissue damage.In the future, advancements in these technologies may result in the creation of a new generation of surgical navigation systems with significantly enhanced capabilities.However, both techniques have limitations that are addressed through the use of preoperative brain imaging.
Arteries, veins, fibre bundles, tracts, and functional structures are important for planning the cranial surgical strategy. 6In addition to the previously mentioned structures, neurosurgeons also consider the location of the tumour or lesion, the patient's overall health and medical history, and any potential risks or complications that may arise during surgery.In addition to aiding in the planning and execution of the surgical strategy, proper labelling of the involved anatomy and structures can be of assistance.In addition, neurosurgeons may use imaging techniques like Magnetic Resonance Imaging (MRI) or Computerised Tomography (CT) scans to gain a comprehensive understanding of the cisternal anatomy and any potential abnormalities or problems.This facilitates precise surgical planning and execution.To successfully execute a surgical plan on a patient, neurosurgeons must take into account every environmental variable.To address this problem, it is clear that surgical pathplanning tools may facilitate solving environmental variable problems during cranial surgery.

| Related works
Numerous automatic surgical path planning methods have been proposed to optimise the surgical path by keeping the path away from risky areas while meeting the requirements of the surgery.These methods were proposed to plan the surgical path of rigid instruments like puncture needles, flexible instruments like flexible needles and catheters, or medical robots.There are studies for several different applications on different organs where biopsy surgeries, resection of tumours, and deep brain stimulation (DBS) are some of them.

| Previous surgical path planning methods
Optimisation-based methods where the global or the local solution to finding the optimal path is obtained by solving a function's minimum or maximum were widely used in the literature.However, these methods also have disadvantages.They have long computation time and a slow convergence speed.The initialisation of the technique also affects the results.Alterovitz et.al. 7 modelled soft tissues combining numerical optimisation to create a path plan in 2D that prevents tissue deformations and avoids obstacles locally, while minimising needle insertion distance.The method formulates the problem as a constrained non-linear optimisation problem.Markov Decision Process (MDP) is used in path planning studies to create the trajectory by evaluating the current state after each step.Considering that the flexible needle control is probabilistic, MDP was used in. 8to generate an obstacle avoidance path planning algorithm in 2D.The method used the maximum probability that the needle would reach the target point to obtain the optimisation result.Partially Observable MDP (POMDP) was also used 9 to approximate belief states (which define a probability distribution over a state space) as Gaussian.A locally optimal trajectory is then computed, and a cost function is minimised in the belief space that considers parameters like avoiding obstacles.
Planning a multiple-target trajectory is another problem of path planning, and 10 solved this by minimising tissue damage while reaching the targets.They minimised tissue damage by minimising the trajectory length with a cost function.
The Pareto optimisation method was used to find the optimal path based on multiple constraints and clinical criteria.Bao et al. 11 proposed surgical constraints after segmenting important organs of the chest to determine different paths.The final path for lung biopsy was determined based on the Pareto optimisation of several sub-objectives.Zhong et al. 12 similarly proposed a method of Pareto optimisation based on multidimensional spatial constraints of distance, length, and angle combined with a weighting algorithm.
The strategy of search-based methods is to find all possible paths using random sampling or artificial intelligence.A bidirectional continuous tree search was proposed by Huang et.al. 13 which handles POMDPs in the continuous state with the intent of improvement in the calculation efficiency.To obtain a smoother trajectory, they also applied a radial basis function neural network.
The Rapidly Exploring Random Tree (RRT) algorithm is one of the random sampling methods that efficiently searches non-convex, highdimensional spaces.Xu et al. 14 used the RRT algorithm to investigate the configuration space to plan possible paths for multiple targets.
Given anatomical obstacles and a clinical target, 15 17 with the combination of neural networks and long short-term memory networks.In this way, the spatial features obtained from medical images and the temporal features obtained from the historical path were fused as conditional information.They obtained a real-time strategy that outputs the local future path, getting the surgical state information as inputs.

| Previous surgical path planning methods for neurosurgery
Several methods have been proposed in recent years for neurosurgical pathway planning.Here, the main purpose is to find the safest routes to the tumour or region of interest without damaging important, sensitive structures of the brain.
It has been seen that there are some path-planning studies for steerable needles in neurosurgery.In 2020, Segato et al. 18 proposed an automatic path planning for brain surgeries by using GA3C reinforcement learning algorithm, and A* and RRT* path-finding algorithms.Here, the catheters were placed as electrical stimuli to reach targets deep in the brain through keyholes, then the vessels and corticospinal tracts obtained from MRI images were determined as obstacles.The most suitable ways to reach the target in 2D and 3D were found by paying attention to the needle kinematics without touching these obstacles from the determined entrance area.In 2022, Sagato et al. 19 proposed to combine deductive techniques that select the preferred paths with inductive techniques that produce path candidates.An inductive learning model is specifically trained KURT PEHLIVANOĞLU ET AL.
using specialist demonstrations and rules converted into a reward function when logic programming is employed to select the starting point following recommendations from some domain experts.They describe how steerable needles used in neurosurgery are planned in 3-D.Briefly, they present a novel automatic path planning approach, that combines Inverse Reinforcement Learning (ILDR), for a moving agent in complicated 3-D environments.
In the field of neurosurgery, computer-aided path planning studies for DBS have been used relatively frequently.A 3D path planning technique is presented to direct flexible needles along curved trajectories in 2019, by Hong et al. 20 They use an RRT-based planning method that takes into account flexible and anatomical needle restrictions.When exploring the tree and choosing the optimum path from a list of viable paths and entry points, a specialised cost function takes the measure of the path and the distance to obstacles into account.Their approach is tested in a simulation setting utilising anatomical impediments taken from a computeraided design model of the human brain, and results demonstrate its capacity to identify various curved pathways from a set of specified plausible entrance points to the target region.In 2022, Cai et al. 21oposed a novel preoperative path planning approach for DBS that uses a coarse-to-fine segmentation algorithm to automatically and precisely determine the ideal electrode-implant trajectory.Here, they retained the high-resolution representation of 3D volumetric data in the refined segmentation step by transforming the 2D HRNet technique to 3D for the tiny organ segmentation problem.In their method, they automatically choose a puncture path that closely resembles the path used by skilled surgeons for preoperative path planning, after that among potential puncture paths, the safest trajectory is selected.
There are some literature studies on optimal path planning to reach tumours or specific brain areas.A heuristic-based search technique for locating the best ablation path for brain tumours is introduced in 2019 by Wankhede et al. 22 This approach can be utilised both before and during surgery.In order to maximise the safety ablation area using a single path ablation, they developed an algorithm.Their suggestion, computes all feasible entrance points on the skull given the tumour position, the locations of good tissue, random starting point on the skull from medical images.The optimum path is then found by looking for several ablation paths that cross over the tumour while avoiding important structures.They implemented their recommended heuristic-based algorithms, such as Breadth First Search, and Dijkstra, into implementation.In 2022, Peikert et al. 23 presented an algorithm for automatic path planning for neurosurgery lesions using patient-specific images.Here, linear and non-linear path plans are automatically generated taking into account parameters such as total path cost and proximity to risk areas, as well as mechanical properties of the surgical instrument such as path problem, curvature, or maximum working length.In 2022, Sauerteig et al. 24 presented a numerical solution using concentric tube robots for the stereotactic neurosurgery pathplanning problem.The basic objective is to go as quickly as possible while avoiding certain sensitive brain regions to reach a certain region of interest inside the brain, such as a tumour, starting from a feasible place on the skull.They use a mechanical model for continuum robotics that is already in existence to characterise the form of the entire cannula from the entrance point to the point of interest.They demonstrate mathematically how this method allows the surgeon to access parts of the brain that a straight cannula, the present state of the art, would not allow.In 2022, Dundar et al. 25 introduced a heuristic-based surgical path planning algorithm integrated with Q-learning, a popular AI paradigm for reinforcement learning, to discover the right skull entrance points, nonlinear and optimal linear pathways to assure minimally invasive tumour excision.

| Motivation
Despite using a variety of path-finding algorithms that use tracts, the most significant advancement we have made is taking into account the values of all brain areas by doing atlas-based segmentation for a more precise search.Our motivation comes from the literature's shortcomings in designing and implementing path-planning methods.
Since planning paths with curvatures is a complex problem that requires considering many surgical and physiological constraints, most path-planning strategies focus on straight paths.There is also a lack of studies that focus on the complete structure of the brain with the tracks, veins, and segmented areas.Instrument dependence is another inadequacy of the methods proposed in the literature.We aim to fill the gap in the literature with our study, which plans the surgical path independently of the instrument, considers the entire structure of the brain, and allows curvilinear paths.

| Contributions
To provide a solution to the limitations identified in the current literature for finding the optimal surgical paths for neurosurgery, we propose a new framework that includes different surgical path planning algorithms using combined tracts and atlas-based segmentation in MRI of the human brain.The main contributions of this paper are as follows: � To the best of our knowledge, this is the first paper to handle tracts and atlas-based segmentation of the human brain altogether under a framework for surgical path planning.
� The framework has a dynamic structure that gives the flexibility to add different path-finding algorithms and generate different widths of surgical pathways.Moreover, surgeons can update the score table to guarantee minimally invasive surgery.
� The output file format of all the extracted surgical paths is Nearly Raw Raster Data (NRRD), so it can be easily visualised, analysed, or processed over the third part software tools (e.g., 3D Slicer 26 ).Two balanced diffusion gradients centred on a 180°radiofrequency pulse were used to sensitise diffusion.To prevent Foucault's current effects, the diffusion gradients were divided into four gradient lobes having equal gradient amplitude and alternate gradient sign.Effective b-values of 1000 s/mm2 were employed for each of the 30 diffusion-encoding directions.We conducted a further experiment without diffusion weighting (b = 0 s/mm2).A total of 36 consecutive axial sections measuring 3 mm in thickness were obtained, spanning from the caudal medulla to the vertex.In order to optimise the ratio of signal to noise, each diffusion tensor was obtained a total of six times.
We produced isotropic apparent diffusion coefficient (ADC), fractional anisotropy (FA), and diffusion-weighted maps using postprocessing tools (FuncTool; GE Healthcare).It was determined to use a technique known as ADC mapping, in which calculations were carried out on a pixel-by-pixel basis utilising a monoexponential fit method at two points: b = 0 and b = 1000 s/mm2.The primary 3D orientation of each significant eigenvector was colour-coded for clarity using the tried-and-true colour scheme of red, green, and blue for each individual voxel.The major orientations of the anisotropic diffusion component within each voxel were represented by the colours red, green, and blue.Red signified a dominant left-right (x-element) orientation, green indicated a prominent anteroposterior (y-element) orientation, and blue suggested a dom-inant superior-inferior (z-element) orientation.Within the framework of the colour-coding system that was applied, the intensity of the colours was directly related to the FA value that was determined.In order to carry out the procedure known as fibre tractography (FT), the DTI data set has to be moved from its original location to a personal computer.In-house methods were utilised for FT, employing commercially available image display software (Advanced Workstation (AW) Server 3.2 console; General Electric (GE) Healthcare).
Three-dimensional inverted prepared fast spoiled gradient-echo imaging (3DFSPGR) was used for the anatomic MRI, with isotropic voxels having a resolution of 1 mm and being primarily collected in a sagittal orientation for the majority of the scan (about 8 minutes).
The DTI data allowed for the targeted analysis of association fibres while the 3D gradient-echo data were included as anatomic correlates for image fusion in the Brainlab software programme.
Image fusion was accomplished by combining both sets of data.Using the AW Server 3.2 console (software; GE Healthcare) of the DTI task card software suite, tractography post-processing was completed.
Using colour maps, the optimal region of interest (ROI) for the subsequent tractography process was determined.Following the data sets from the DTI that were post-processed, the console was used to reconstitute the ADC and colour-coded FA maps.
Free software was used for diffusion tensor analysis and fibre tracking to analyse the DTI data sets and the 3D MR pictures.The Filter Tracing approach involves a three-dimensional reconstruction of white matter pathways with a FA threshold of 0.17 and an angle of >¿55°between successive vector lines.An area of interest (ROI) was created in the coronal plane along the cranial boundary of the corpus callosum splenium, lateral to the CST, for fibre tracking.The results of the tractography were written down and stored in a file that included the x, y, and z coordinates for each fibre.The b = 0 diffusion images and these data were both inputs into the navigation programme.After assuring that there were no discrepancies in the data at the tumour location that were greater than 3 mm in size, the white matter traces were able to be viewed as conventional anatomical photographs.This was accomplished by registering the b = 0 photos with the anatomical volumetric pack.
The fibre boundaries were then divided into segments so that they could be shown intraoperatively as objects in the navigation system.The seed region was positioned on the cerebral peduncle, which is the location where it is known that the CST runs, and the colour-encoded fibre orientation map was recorded in order to show the motor tracts.Cortical target regions were meticulously located in the portion of the brain that was thought to be the principal motor area.We used an approach that focuses on two different regions of interest to demonstrate the descending fibres between the primary motor area and the cerebral peduncle (regions serving as the target and seed).

| Data preparation
In this work, we used T2-weighted and DTI data in the dataset.T2weighted and DTI data all with the same angle and the number of slices.It is aimed to extract the general brain structure from the data in the T2 sequence.Hence, the data in the T2-weighted sequence is segmented by using BrainSuite atlases given in the open-source BrainSuite software tool. 27BrainSuite is an open-source software package for the processing, analysis, and visualisation of neuroimaging data and it uses atlases to describe human brain anatomy and automatically segments MRI of the human brain.This process consists of two basic steps: atlas matching, and segmentation.In the atlas matching step, BrainSuite saves images to the atlas spatial coordinate system.Atlas is a reference template that describes the anatomical positions and sizes of different structures of the human brain.After the saved images are matched with the atlas, it automatically segments the regions of the atlas corresponding to the different structures in the segmentation step.BrainSuite includes various atlases, we use USCBrain Atlas in this paper.It almost contains 159 major regions, and these regions provide functional division and classification of different anatomical structures in the brain 28 It took approximately one and a half hours for automatic brain segmentation, as a result, the brain was divided into 159 areas, and each segmentation region was identified with a different ID.The output file is an NRRD file.Moreover, we extracted the region name corresponding to each ID from the BrainSuite software as an Excel file.After that, experts (surgeons) scored all the segmented areas, here the score range was "0-10".In this scoring, the experts took into damage condition consideration, the most important areas were scored "10", and the least possible affected areas were scored "0".In addition to segmentation, we handled tracts of the human brain, and the score of tracts was assessed "10".As a result, we created a score table containing the names, IDs, and corresponding score values of each field (the table encompasses a total of 295 unique IDs).The score table is used while calculating the total scores of surgical paths.

| The proposed framework
The proposed framework is separated into three modules, called Data pre-processing (Module 1), Path planning engine (Module 2), and Visualisation (Module 3).The system architecture of the framework is provided in Figure 1, and detailed in the subsections given below.Basically, Module 1 prepares the medical image files into the proper input format to find optimal surgical pathways.Then Module 2 ensures us to apply different path planning algorithms and finally these found pathways are visualised in Module 3.

| Module 1: Data pre-processing
Since our framework allows for multiple images (NRRD files) to be combined and given the arbitrary nature of the medical data.There needs to be some light pre-processing done on the input data to make sure that the integrity of the data is kept the same.For importing images and resampling procedure, Simple Insight Toolkit (SimpleITK) [29][30][31] is used.The algorithm of the entire data preprocessing module is given in Algorithm 1.

F I G U R E 1
System architecture of the proposed framework.

| Resampling
While a brief explanation of the resampling process is given in the paragraph above there are still a few key steps that have to be done in order to achieve successful resampling without damaging or destroying information of the original data.Since the images contain segmentation data, which map each point in the data to a segmentation identifier, any rotation or type conversion done during the resampling stage could alter the segmentation identifiers, therefore, render parts of the data damaged or useless in some cases.To combat this nearest neighbour method is used as an interpolation method from the SimpleITK library.

| Resizing
To finalise the reference image selection process, new spacing therefore size values must be calculated.This is done to ensure spacing between each data direction is to be equal.Which is very important for calculating 3D models from segmentation images.

| Tract image processing
Alongside segmentation images, it is also possible to input images received from DTI. 32 This is done by applying a function over the tensor image witch in returns a scalar image that represents certain values from the segmentation image.This in fact is a segmentation image so in a sense, we apply a function over the tensor image to turn it into a segmentation image.Various methods are used to convert tensor images to scalar images here we deploy fractional anisotropy (FA), 33 relative anisotropy (RA), 34 spherical measure (SM), and linear measure (LM). 35 The scalar image, which is created by using FA, RA, SM, and LM measures, goes through Min-Max normalisation.The given Equation (1) represents Min-Max normalisation: where x min represents minimum value in the measured tensor image and x max the maximum the x scaled becomes a value between 0 and 1.
After the normalisation process, the threshold values are applied to truncate results from both ends.

| Module 2: Path planning engine
This module encompasses all functions related to path planning through the volume.Which include shortest path algorithms and all related functions to calculate precursor data for these shortest path algorithms. of the new vector is Maximum or Minimum between a i and b i for all a i 2 a and b i 2 b.

| Graph representation using the volume
In order to apply shortest path functions to segmentation images, there needs to be a conversion between segmentation images to graph representations.Formally, there are three ways to represent graphs which are adjacency matrix, ıncidence matrix, and adjacency list.These work well with shortest path algorithms however when the kV k and kE k are beyond a certain point.The overhead introduced by this method requires so much memory that calculating the shortest path from these representations became extremely slow or impossible.
Figure 2 represents a cubic graph as a wireframe set of cubes.
Since segmentation data is 3D volume data it contains i * j * k vertices and i * j * k * n edges where n is the number of edges per vertex.
This leads to huge graphs that need to be stored in memory.For example, for an image with dimension size (512, 512, 512) there needs to be kV k = 512 3 = 134, 217, 728 vertices each having 6 edges would make the total edge count kE k = kV k * 6 = 805, 306, 368.
Using traditional methods to store large graphs like this would be impossible using standard hardware, so rather than the traditional methods, we represent our graphs as a multi-dimensional array.This means that each index [i, j, k] represents the vertex (i, j, k) with adjacent indexes representing edges.While it is possible to represent vertex weight using the value at the index [i, j, k] as the vertex weight itself, it is impossible to represent the weight of the edges using this method.It is also worth noting that every graph implemented using this method will be bidirectional since there is no sense of direction when indexing from one vertex to another.
Although there is ongoing research about graph representation using machine learning 36 which aims to reduce the sizes of large graphs.Since our graph representation method fits the entire graph into a multidimensional array with the same size as the segmentation data, there was no need to compress the graph using alternative methods.

| Neighbours
Neighbours are for a vertex v = (i, j, k) and a minimum distance number n all the vertices o that satisfy Manhattan(v, o) < n þ 1.
Figure 3 represents a cube depicting neighbours by drawing lines on wireframe cubes for 6,18, and 24 neighbours.

| Space and subspace
In this context, space is defined as a set of points corresponding to a set of points in the segmentation volume, so a subspace would be a 3D slice of the segmentation volume.For calculating shortest path algorithms, subspaces instead of spaces might be used to increase the efficiency and speed of such algorithms and limit all possible solutions to the shortest path algorithm to a much-confined space in order to limit the reach of the shortest path algorithm, that is, not allowing paths to surpass an imaginary boundary inside the space.

Method of computing subspace
We define the boundary as B = (Min, Max) where B is the boundary and (Min, Max) represent minimum and maximum points in the subspace with coordinates from the space itself.In order to calculate Min and Max points two vertexes are required.Then Min is the elementwise minimum for each vertex (i, j, k) values and Max is the maximum.
After this, padding is applied to both Min and Max points to cutting out neighbours of the two vertexes.The algorithm for calculating the subspace is given in Algorithm 2.

Algorithm 2 Subspace boundaries calculation
Require: Two vertex v 1 and v 2 that are inside the boundary, Padding value p, variable kSk representing size of the space Ensure: Two vectors (Min, Max)

Coordinate translation between subspace and space
For calculating the shortest path algorithm in the subspace and getting the result from it, there needs to be some coordinate translation between the input and output of the shortest path algorithm for the space and subspace, since (0,0,0) in the subspace doesn't match (0,0,0) in the space.In Figure 4, we give a larger transparent cube representing space S and a different colour cube inside representing subspace M with both min and max points.
This is done by first calculating the subspace boundaries (Min, Max) by using the Algorithm 2, then any coordinates that needs to be converted space to subspace go through element-wise addition with Min vector, and any coordinates that needs to be converted from subspace to space go through element-wise subtraction with the Min vector.

| Block size reduction
In order to translate from segmentation volume data to the graph we need to divide the volume data into cubes.Cubes in this context represent the minimum indivisible geometry that we sample from the volume data to create graphs.These cubes also represent real-world measurements that will change according to the given data.So in order to standardise such block sizes, our method calculates the block size given a real-world measurement such as mm 3 .This is trivial since the spacing vectors in segmentation data also provide the size of each pixel in terms of a real-world unit.

| Shortest path algorithms
After the segmentation data is processed into a graph, shortest path algorithms are applied to the graph to find the lowest-cost routes (optimal surgical pathways) between two points.It is also worth noting that the graph is a weighted graph, so the lowest-cost pathways between two points can be modified to mean different things under different weight values.
In this module, we use Dijkstra, 37 A* 38 and their aggressive variants while finding surgical pathways.Dijkstra is a deterministic algorithm that given a graph returns the shortest path possible.
However, it may be computationally infeasible for large enough graphs, so a more heuristic algorithm might be required.A* is the second algorithm available in our framework.It is similar to Dijkstra; the main difference is that it doesn't check all possible paths like Dijkstra rather it uses a heuristic function to give a good result in a faster way.The aggressive variants for both Dijkstra and A* do optimisation for the dataset by encompassing the space in a subspace as mentioned in Section 2.4.4 "Min" and "Max" became the source and the destination of the Dijkstra and A* algorithms also padding is applied to the subspace defined by the source and destination points to make the path free to move near the source end destination.

Score evaluation
In order to compare surgical paths a score evaluation is required.This is simply done by associating each label with a score and summing these scores at each point.For comparing two different surgical paths with two different block sizes we need to take the sum of the points contained in that block to meaningfully score each path in between different configurations.Equation (2) gives the formula for the total risk score calculation of the surgical path.
where g represents the grid graph array where each index represents the weight of the grid graph at that location, s represents the set of ordered points that describes the found surgical path, and s i denotes the ith point of path s, b represents the block size, γ(x) is a function that maps point values to score values.

| Volume visualisation
After path planning algorithms are applied, the data has to be processed into some format to examine visually.In our method, we chose the marching cube algorithm 39 in order to convert segmentation data which is essentially a 3D array with each index representing the segmentation value.So applying marching cubes is trivial.

| Image reconstruction
To reconstruct images from volumes, an empty image with the same size as the volume is created.Then resampling and interpolation

| Hardware specification
All experiments were performed on a Windows machine that is equipped with an 8-core i7 CPU, 8 GB RAM, and 1 NVIDIA RTX 3050 TI GPU with 4 GB VRAM.

| Results and analysis
As explained in Section 2.3.4,we have to pass our tract data through a measure to convert it from a 3D tensor field to a scalar field.For this purpose, we chose several different tract models, such as FA, RA, SM, and LM, to make our test as inclusive as possible.These models were handpicked in order to ensure the best outcome for path calculation from our data.After applying FA, RA, SM, and LM tract models to a tensor image, a scalar image is formed, and then Min-Max normalisation is used (recall Equation 1).Then we apply thresholding to remove unwanted parts from the scalar image.The threshold filters are defined as (min, max) where min is the minimum allowed value and max is the maximum allowed value with the relation 0 ≤ min < max ≤ 1.
In Figure 5

| CONCLUSION
The surgical pathways may vary depending on the patient's specific condition; therefore, it is crucial to determine the best surgical pathway for each individual case.Surgical path planning methods/ algorithms for neurosurgery are computational tools that assist neurosurgeons in better planning and execution of surgical procedures. In

| Limitations and possible future works
In our paper, the system is not real-time, we could not introduce expansions without damage done during surgery, such as brain retraction or vessel dissection.This has restricted the number of available roads.Designing a new framework that supports real-time operations would be a milestone for neurosurgery.
As can be seen from Figure 6, our framework identified some optimal trajectories (surgical pathways) that may appear challenging to reproduce in real surgical scenarios due to their sharp turns.
However, the latest flexible robotic arms have demonstrated exceptional manoeuverability in multiple directions, thanks to their articulated design.This unique feature enables them to navigate nonlinear paths (including sharp turns) and efficiently reach the surgical target.
The scoring system used in our framework is essential for precisely assessing the quality of trajectories.In future work, The first four surgical pathways (in coronal and axial planes) with minimum risk scores for each block sizes 3 and 4, respectively.
utilised the RRT method to plan and control needle motion.They proposed a new distance metric for incremental growth of the RRT to improve the planner performance and use it in real-time.Several deep learning-based methods have been proposed in recent years to overcome the problems encountered during surgical path planning.Hu et al. 16 constructed a multi-scale 3D model of the organs where multi-agent reinforcement learning was used to select multiple paths based on strong and weak constraints.Parameters were transferred from the smaller-scale to the larger-scale environment by a Double Deep Q-Learning Network (DDQN) trained incrementally.Generative Adversarial Network (GAN) was used by Zhao et.al.

4 of 15 - 1 |
KURT PEHLIVANOĞLU ET AL.1.4| Paper organisationThe remainder part of the paper is structured as follows: A comprehensive explanation of the proposed framework is presented in Section 2. Section 3 gives the experimental results, including a comparison of different surgical path planning algorithms in the proposed framework, and finally, in Section 4, we provide a conclusion to this paper.2| PROPOSED FRAMEWORK2.Dataset generation: Radiologic imaging, MRI technique, and MR tractographyBelow, we have provided a comprehensive explanation of our dataset's MRI methodology and MR tractography technique.MRI was conducted using a 3-T MRI machine (Signa Architect; GE Healthcare, Waukesha, WI, USA) and the TDI 48 Channel Head Coil.Before measuring DTI, standard departmental imaging techniques were used to acquire conventional sagittal and axial T2weighted fast spin-echo (TR/TE, 4000 ms/100 ms; 3-mm sections) imaging sequences.A parallel imaging plane to the anteroposterior commissural line was used to coordinate axial imaging.Using 30 different geometric orientations, a single-shot spin-echo echo-planar sequence was repeated to gather the diffusion tensor.Using the "array spatial sensitivity encoding technique (ASSET)," diffusion tensor MRI was accomplished utilising single-shot spin echo-planar imaging with a repetition time (TR)/echo time (TE) = 9000 ms/100 ms, matrix size of 128 120 mm, and FOV of 256 240 mm.
The top-down (craniocaudal) course of the CST is rep-resented by the blue coding in MR tractography, the transverse course of the corpus callosum and subcortical regions is represented by the red coding, and the anteroposterior frontoparietal tracts are represented by the green coding.In this paper, the dimension of the MRI (T2weighted and DTI) data of a single patient used is 512 � 512 � 264, and the spacing is 0.508 � 0.508 � 0.6 mm.By using this data, we represented a cubic graph model of the brain of the patient, all the details are given in Section 2.2.

1 : 2 : 4 : 5 : 9 :
Reference image ref with properties size and spacing, data reading function R, list of resampled images I, function that counts elements in a list L, resampling function S and image file path p Ensure: Resampled image i Set image ← R(p) Set l ← L(I) 3: if l == 0 then Set ref spacing ← (1, 1, 1) * max(current spacing) Set ref size ← Round(image size * (image spacing / ref spacing)) Configure resampling function S with ref 10: Set image ← S(image) 11: Set I l ← image 2.3.1 | Reference image To keep the alignment and other properties of segmentation images the same a reference image is chosen.The reference image then acts as a standard for every other image which goes through resampling to match the reference image properties.Choosing the reference image is done simply by picking the first segmentation image for any given set of segmentation images.
FA measures the directionality of water diffusion, with lower values indicating disrupted or damaged white matter tracts.Relative anisotropy is similar to FA but less sensitive to noise and better at detecting changes in white matter integrity in certain diseases.SM measures the overall magnitude of water diffusion, indicating tissue density or cellularity.LM measures water diffusion along the principal axis of diffusion, indicating axonal density or myelination in white matter tracts.

2. 4 . 1 |
Notations Graphs are denoted by the set G = (V, E) where G is a set containing two sets V for vertices and E for edges.Size of a set N is represented by kNk, that is, kGk is always 2. A multi-dimensional array is indexed using the format [i, j, k] where i, j and k represent row, column, and depth respectively.Functions Maximum(a, b) and Minimum(a, b) are element-wise Maximum and Minimum functions where each element KURT PEHLIVANOĞLU ET AL.

F I G U R E 4 Algorithm 3 2 :
Here space S and one of its subspace N can be seen.Points depicted as Min and Max, are defining points of the subspace, used for calculating coordinates between S and N. F I G U R E 3 (A), (B), and (C) showing neighbours 6, 18, and 26, respectively.KURT PEHLIVANOĞLU ET AL. settings are set according to the same rules as in Algorithm 1. Then the images are simply exported using SimpleITK primitives.For the visualisation of found paths, we use the steps given in Algorithm 3. Algorithm for visualising found surgical paths Require: Block size B, List of coordinates C for each point in the path Ensure: 3D Mesh object displaying the calculated path 1: Set S to be an empty image the same size as the original image for C i 2 C do 3: if B == 1 then ←[[0,…,B]for 0…B] ▹ /* Here in order to create a binary block the size of b 3 a 3D array of ones with each dimension the size of b is created and its zero index is set to the zero index of S Ci */ 7: end if 8: end for 3 | EXPERIMENTAL RESULTS , to get the best representation for the tract models, we compared the results of the FA, RA, SM, and LM models for different threshold filters (0.25−0.5), (0.25−0.75), (0.25−1), (0.5 −0.75), (0.5−1), and (0.75−1).As shown in the figure, when we evaluate all sections, the tracts can be seen much more clearly in FA and RA.Others include not only tracts but also different white matter structures, but this is not what we want.As a result, FA and RA models ensured the best tract representation of our data, hence we used these models while calculating surgical pathways.Finally, we found various surgical pathways by choosing different entry points, sizes of blocks, path-finding algorithms, and FA and RA tract models with varying threshold filters.Detailed information on each pathway is provided in Table1.It is clear that increasing the size of the block is expected to result in a higher risk score, as a larger block contains more points.In our experiments, the threshold (0.5−0.75) showed the best tract representation hence that is the reason all pathways have the same filter value in the table.

Figure 6
Figure6displays the first four surgical pathways, presented in both coronal and axial planes, which exhibit the lowest risk scores for block sizes 3 and 4, correspondingly.Intracranial surgical procedure is described step by step.The steps that the neurosurgeon will follow in the surgery are predetermined.These steps are determined by the existing neural and vascular structures.These are called neurosurgical approaches and have been systematically developed for nearly 150 years.Combinations or modified versions of these are currently used.These approaches, applied under the surgical microscope, are generally linear.The reason why the microscope perspective is linear.In our study, access to the mediobasal region of the right temporal lobe from the anterior and lateral sides was calculated.As a result of this calculation, some of the pathways that the proposed framework found and scored well overlap with the standard pathways 40 used by neurosurgery.For instance, anterior transsylvian (Path12), trans sulcal (Path6), transgyral (Path4), sub-temporal (Path8), procedures.Even if the reminder pathways found by the proposed framework that cannot be defined in our surgical standards cannot be done with current surgical procedures, the flexible endoscopic-robotic systems (endorobotic systems) that follow this path can safely reach the target area without retraction of neural tissue and vessels.The chosen approach size (block size) is important.In our study, we had it calculated with two sizes, 3 � 3 and 4 � 4. Brain tissue is formed by the intertwining of complex neurovascular structures.Increasing this size causes damage to adjacent neurovascular tissues and increases the risk score.
this paper, we propose a new framework that generates the surgical pathways with the lowest risk scores.It can simulate the surgical procedure and help identify potential areas of concern.According to our knowledge, it is the first framework that handles tracts and atlas-based segmentation of the human brain together while evaluating surgical pathways.Our experimental results also show our framework can identify surgical pathways that can use in real-world surgery.Moreover, our framework fully supports the idea of determining the surgical pathway for each patient individually.The experts can upload NRRD files (including brain segmentation) and DTI data to the framework and generate all possible surgical pathways.