Zohaib Amjad Khan
email: zohaib.amjad@seecs.nust.edu.pk

Nabeel Kamal
email: nabeel.kamal@seecs.nust.edu.pk

Asad Hameed
email: asad.hameed@seecs.nust.edu.pk

Amama Mahmood
email: amama.mahmood@seecs.nust.edu.pk

Rida Zainab
email: rida.zainab@seecs.nust.edu.pk

Bushra Sadia
email: bushra.sadia@seecs.nust.edu.pk

Shamyl Bin Mansoor

Ph.D Osman Hasan
email: osman.hasan@seecs.nust.edu.pk

Shamyl Bin Mansoor
email: shamyl.mansoor@seecs.nust.edu.pk

SmartSIM -a virtual reality simulator for laparoscopy training using a generic physics engine

Keywords:

Introduction

Laparoscopy is a type of Minimally Invasive Surgery (MIS) in which a surgeon inserts an endoscope and other instruments into the body through small holes and operates upon the patient using the on-screen output from the endoscope. The need of training in such procedures arises due to non-traditional skill requirements, like hand-eye coordination, depth perception, ability to work within a confined space and ability to control non-intuitive pivoted motion of instruments, such as the fulcrum effect that causes the tool endpoints to move in the opposite direction to the surgeon's hands due to the pivot point.

Fulcrum effect has detrimental effect on the skill acquisition in endoscopy [START_REF] Gallagher | An ergonomic analysis of the fulcrum effect in the acquisition of endoscopic skills[END_REF]. Studies have revealed that Laparoscopic training systems provide a more effective training of novices by using inverted simulation about y-axis, to correct for fulcrum effect, compared to actual Laparoscopic footage. Gallagher and Crothers [START_REF] Crother | Experienced Laparoscopic Surgeons are Automated to the Fulcrum Effect: An Ergonomic Demonstration[END_REF] deduced that the experienced surgeons get adapted to the inverted conditions rapidly and thus the inversion of images about y-axis is also very beneficial for experts.

Traditionally, the training for laparoscopy was usually carried out using box trainers along with physical patient models. However, these methods suffer from lack of objective assessment of skills especially without supervision, inefficient method of training as used material has to be constantly replaced, and lack of a realistic environment closer to actual surgery. Although such training methodologies still persist, yet with considerable enhancement in computing performance, these are being gradually replaced with virtual reality (VR) based training simulators. The surgeons' concerns about effectiveness of VR simulators have also now been subsided to a great extent due to various validation studies that have been carried out over the last few years on existing systems [START_REF] Ahlberg | Does training in a virtual reality simulator improve surgical performance? Surgical Endoscopy And Other Interventional Techniques[END_REF] [4] [START_REF] Aggarwal | Proving the effectiveness of virtual reality simulation for training in laparoscopic surgery[END_REF].

Some of the commercially available laparoscopic VR simulators include LapSim [6],

ProMIS [START_REF] Lacey | Mixed-Reality Simulation of Minimally Invasive Surgeries[END_REF], MIST-VR [START_REF] Wilson | MIST VR: a virtual reality trainer for laparoscopic surgery assesses performance[END_REF], Lap Mentor [9], LapVR [10], SIMENDO [11] and VSOne [START_REF] Cakmak | VSOne, a virtual reality simulator for laparoscopic surgery[END_REF]. Some other prominent non-commercial simulators include VBLaST [START_REF] Maciel | Development of the VBLaST: a virtual basic laparoscopic skill trainer[END_REF], GeRTiSS [START_REF] Monserrat | GeRTiSS: A Generic Multi-model Surgery Simulator[END_REF] and VESTA [START_REF] Tendick | A Virtual Environment Testbed for Training Laparoscopic Surgical Skills[END_REF]. Most of these systems have been developed based on close collaboration between specialists in various fields, like computer science, electrical engineering, mechanical engineering, physics, mathematics and surgery. However, either due to the commercial nature of these projects or the usage of a custom physics engine for developing the simulators, all the effort done is very specific to the particular project and thus cannot be reused. In order to overcome these issues, and to broaden the scope of VR surgical simulator development research, many initiatives, such as SPRING [START_REF] Montgomery | Spring: A General Framework for Collaborative, Real-time Surgical Simulation[END_REF], GiPSi [START_REF] Cavusoglu | GiPSi: A Framework for Open Source/Open Architecture Software Development for Organ-Level Surgical Simulation[END_REF], MVL [START_REF] Kuroda | Design and implementation of MVL: medical VR simulation library[END_REF], SSTML [START_REF] Bacon | The Surgical Simulation and Training Based Language for Medical Simulation[END_REF], CyberMed [START_REF] Machado | A framework for development of virtual reality-based training simulators[END_REF] and SOFA [START_REF] Allard | SOFA an Open Source Framework for Medical Simulation[END_REF], have emerged that provide generic open-source libraries for developing medical simulators. These simulation architectures provide very flexible options for simulator design. For instance, SOFA provides different implementations of Finite Element Methods (FEM), like tetrahedral, hexahedral and triangular. Thus, in SOFA, and the other similar generic engines, a flexible choice of algorithms is available for modelling different behaviors, like the soft tissue deformations, and for solving system equations (CG Solver, BTD Solver etc) and for the simulation of surgical practices, like cutting and cauterization of tissue. However, to the best of our knowledge most of these open source simulation frameworks have not been used to develop a complete high-fidelity lapraoscopic simulator that is able to cover all the requirements of a surgical simulator system. For example, in case of laparoscopic simulation, SOFA, which is one of the most flexible and modular simulation frameworks, has only been used to develop a part of cholecystectomy procedure [START_REF] Kim | Development of a Laparoscopic Surgical Training System with Simulation Open Framework Architecture (SOFA)[END_REF] without any performance evaluation while SmartSIM has a number of exercises for basic training, general surgery and gynecology in which skill development of user is continuously monitored through a performance evaluation metrics.

In order to demonstrate the capabilities and assess the strengths of the above-mentioned generic open-source libraries for developing medical simulators, we describe the complete system design perspective of a new high-fidelity virtual reality laparoscopy trainer: SmartSIM, which is based on the generic physics engine, SOFA. The mechanical interface for SmartSIM is a custom-built module that is extremely simple in design and structure.

The whole system has been developed with a modular approach, which allows it to be very flexible in terms of extension. Furthermore, we have also introduced a new type of intelligent metrics in SmartSIM that successfully implements the idea of independent learning via simulators without the need of supervision from expert surgeons.

SmartSIM comes with an edge over the existing systems in the sense that it does not necessarily require specific proprietary hardware interface to be connected to it for work.

Instead we have developed our very own low-cost mechanical interface that is very simple in structure and use and serves as an example of how a custom-built interface can be easily integrated into our system. Moreover, SmartSIM also retains the flexibility of SOFA, resulting in a software architecture that can support all commercial devices and a software that is easily modifiable with gradual improvements in algorithms related to different simulation aspects. SOFA provides the capability of adding plug-ins within the system SmartSIM.

The SmartSIM system uses encoders, installed on the joints of the Mechanical Interface, to gauge the mechanical movements. These movements are then recorded by a microcontroller and transferred to the computer via a full duplex communication protocol using the USB interface. These features are handled by the Controller Circuit module of the system.

The Software Application module receives the data corresponding to the mechanical movements and translates it into motions of the simulated instrument. Besides that, it also presents the user with a graphical interface to interact with. This GUI includes various options like selecting exercises, using web resources and viewing past performance. A local database runs at the backend to maintain users records. However, the main function of this module is to run real-time simulations for training the users. These simulations are developed using SOFA as the underlying physics engine, which constitutes the core of this entire module. The basic function of the Mechanical Interface is to track the movements made by a user's hand and to transfer this data to the virtual environment. It utilizes optical encoders for this purpose. Optical incremental encoders are selected because of their compact size and high accuracy. Rotary optical incremental encoder is an electromechanical position/speed sensing device, which primarily consist of an LED, light detectors, coded disc, and signal conditioner circuit board as depicted in the Figures 3a and3b. Incremental encoder normally generates two square waves, each corresponding to an increment of disc rotation.

Typically, the LED beam passes through a diaphragm type lens, which splits it into two beams of 90 apart. Light beam passes from channels A and B through opaque and The pitch and yaw motions are attained by using two orthogonal revolute joints such that their axis of rotation are coplanar and intersecting, hence satisfying the pivot point constraint that is present in actual laparoscopic instruments. The translation motion is achieved by utilizing a rack and pinion mechanism, whereas the roll motion is obtained by using a simple gear train. The Mechanical Interface is designed to provide 5 decoupled DoFs, as shown in Figure 4.

In our Mechanical Interface design, we have tried to use straightforward mechanisms to achieve the required DoFs which, to the best of our knowledge, is not the case for the existing simulator systems. To achieve pitch and yaw motions, the interfaces for some of the existing simulators, like those by Mentice [23], use the spherical mechanism, which is complex and requires specialized machining for its manufacturing. Other systems, like

VBLaST [START_REF] Maciel | Development of the VBLaST: a virtual basic laparoscopic skill trainer[END_REF], modify existing interface devices, like PHANTOM Omni, to use them as interfaces. The VSOne [START_REF] Cakmak | VSOne, a virtual reality simulator for laparoscopic surgery[END_REF] system uses the double parallelogram mechanism in their interface. The use of the parallelogram mechanism increases the number of mechanical links, which adds to the complexity of the apparatus.

For the Mechanical Interface design of SmartSIM, the workspace requirements are derived from the database of the Blue Dragon metering system [START_REF] Rosen | The BlueDRAGON -a system for measuring the kinematics and dynamics of minimally invasive surgical tools in-vivo[END_REF]. Blue Dragon is a passive device equipped with force torque and position center, which calculates the torques and position in-vivo, respectively. Acquiring this data involves 30 surgeons performing 7 MIS procedures on a pig. The required dexterous workspace (DWS) is defined as the region in which 95% of the tool motions are contained. The extended dexterous workspace (EDWS) is defined as the entire abdominal cavity reachable by a MIS tool. The DWS is defined by a circular cone with a vertex angle of 60 • and the EDWS is defined by a cone with an elliptical cross section by two orthogonal vertex angles of 60 • and 90 • [START_REF] Lum | The RAVEN: Design and Validation of a Telesurgery System[END_REF]. Thus, the pitch and yaw of our Mechanical Interface is +-45 • and its instrument translation is 200 mm with

an unlimited instrument roll.

Besides taking the above-mentioned motions into account, the Mechanical Interface also includes three homing buttons and two pedals. The homing buttons are used to declare a fixed starting position for the instruments and to indicate start of an exercise. The two pedals are used in the same context as in real laparoscopic surgery, i.e., for dissection or coagulation. In addition, a clamping mechanism is also added to the base of the stand, so that it can be easily clamped to the edge of a table. The stand also has a passive translational Dof, which can be used to adjust the height of the Mechanical Interface.

Our foremost goals while designing the Mechanical Interface of SmartSIM were to ensure simplicity of mechanism, ease of manufacturing and assembly. Each subassembly has been designed in a manner that it can easily be machined on either manual lathe or manual milling. However, Computerized Numerical Control (CNC) machines will definitely result in more accurate models with fine finish and texture. A considerable amount of attention is also given to ensure a simple assembling procedure of all the sub-assemblies so that even the end user can easily replace the worn-out part. This has been attained by using common fastening techniques.

4 Controller Circuit The homing buttons and two paddles are based on mechanical contact switches. Such a switch typically results in multiple signals against a single push, an effect known as the switch de-bouncing effect. In order to avoid any false readings, a low pass filter circuit is placed in between the controller unit and the switches to filter out the unwanted and false signals.

Sensing Circuit

Power supply filtration is also used to stabilize the interface and filter the unwanted high frequency spikes in the input power line of 5 Volts that comes from the USB connector.

Decoupling capacitors are incorporated to isolate the circuitry from noise and provide a stable input to the circuit.

Control Algorithm

An event based, interrupt driven algorithm is developed in order to ensure real-time operation, reduce the controller computation effort and eliminate any possibility of missing encoders' critical signals. The microcontroller runs at a maximum frequency of 16 MHz to ensure error free encoders readings. Every encoder is attached directly to the dedicated quadrature decoding chips. Since the human hand movements fall in the range of a few Hz [START_REF] Riviere | Characteristics of hand motion of eye surgeons[END_REF], therefore real-time requirements are met with a control loop running at 1 kHz. We The Database (DB) Handler sub-module exposes database to two higher modules of the software. In simple terms, all the functionality related to connection with the database and storing or retrieving information from the database is implemented here. The user interface module can use DB Handler methods to store, update, retrieve and delete account related information in the database. Similarly, the reporting module can use this sub-module to store and retrieve evaluation results for the logged in user. Some modules, like the database and the logging module, communicate with different layers of the architecture.

The database module, as the name suggests, keeps the record of users whereas the logging module maintains logs to track system performance. The application's entry point in the software architecture of SmartSIM is the user interface module. The reporting module and the user interface module lie at the higher levels of hierarchy with the reporting module being responsible for recording and displaying performance of a user. The simulation core of SmartSIM is based on an open-source framework for medical applications, SOFA, which is prefered to other such applications, like VRASS [START_REF] Kawasaki | VRASS (Virtual Reality Aided Simulation[END_REF], SPRING [START_REF] Montgomery | Spring: A General Framework for Collaborative, Real-time Surgical Simulation[END_REF] and GiPSi [START_REF] Cavusoglu | GiPSi: A Framework for Open Source/Open Architecture Software Development for Organ-Level Surgical Simulation[END_REF].

Comparison of these open-source simulation softwares is given in Table 1.

SOFA is a scene graph based library that allows developing simulation scenarios using hierarchical graphs [START_REF] Faure | SOFA: A Multi-Model Framework for Interactive Physical Simulation[END_REF]. A particular scene graph contains different components with each component handling one specific aspect of simulation independently. For instance, mass, topology, deformable model, integration scheme and constraints are all represented by different components. This provides a considerable amount of flexibility in the modeling process of simulation since one implementation of a component can be replaced by another without modifying any of the other components in the scene graph. SOFA also provides further modularity by allowing modeling of collision, behavioral and rendering aspects of simulation using different topologies. To maintain consistency between these different topologies, SOFA provides the mechanism of mappings, as shown in Figure 7.

However, the generic physics of SOFA comes with its own set of challenges. One major challenge is to intelligently categorize and model each simulation object in a scene. With the scene graph architecture, it becomes necessary to choose only the required components for a simulation object for avoiding unnecessary computational load. Furthermore it is also essential to identify the right combination of parameters for all the components for a particular simulation object. Examples of these parameters are number of iterations for a linear solver and spring stiffness for a mass-spring model. While some of the parameters may be derived from literature, others need to be adjusted according to simulation Another major drawback of using SOFA is that it only provides algorithms for simulating instrument functionalities without integrating them within the simulated instruments. For instance, algorithms for topological changes, like those required in cutting and dissection, are included in SOFA, but all these interactions can only be carried out using a mouse cursor. To make these algorithms useful for laparoscopic training in SmartSIM, they are tweaked in such a way that they synchronize with the movements of instruments during simulation and gives a realistic view to the user.

Features SPRING GiPSi SOFA VRASS Visual Modeling Y DirectionalLight Y OglShadowShader Y SlicedVolumetricModel Y ClipPlane Y Collision Models Y Spheres Y TriangularMeshes Y DistanceFields Y Collision Detection Y Y Y Y Proximity Y Continuous Y Deformation Models Y Y Y Y Mass-Springs Y Y Y LinearFEM Y Y Y Y Co-rotationalFEM Y Fluid Simulation Y Y Y SPH Y Eulerian Y Collision Response Y Y Y Penalities Y LCP-based Constraints Y Mapping Y Mechanical Integration Y Y Y Euler Explicit Y RK2 Y Y RK4 Y Y Static Y Y Y Implicit
Besides these challenges, another requirement of a VR simulator is to provide features like performance evaluation and visual effects to alert a user when he or she touches a forbidden object. All these features are strictly dependent upon the simulation scene.

Similarly, blood flow and smoke simulation are too generalized and need to be manipulated according to specific requirements. In the following subsections, we explain our methodologies to overcome these challenges in SmartSIM.

Simulation Object Categorization

Each VR simulation consists of various objects that are either interactive, such as the disks in the peg-transfer exercise in Figure 8a, or non-interactive, such as the floor in the same exercise. In order to facilitate modeling using SOFA in SmartSIM, we classified each simulation object into one of five broad categories, i.e., (i) Visual-only objects (ii)

Stationary mechanical objects (iii) Movable mechanical objects (iv) Topologically modifiable objects and (v) Fluids. Classification of each object into one of these five types helps in efficient modeling and in keeping the scene real-time. Once each object is classified, modeling can be done using templates, i.e., a defined way of modeling each type of object using the required components only.

To achieve the state of suspension of disbelief i.e., when a user is made to think and feel as if he or she is working in a real environment, collision effects must be accurate. As evident from Table 1, SOFA provides the best collision detection and response as compared to other open-source surgical simulation tools because the models used for visualization in SOFA can be different from the models used for simulation. SOFA provides collision effects for rigid as well as deformable objects. Collision detection approaches implemented in SOFA include distance calculation between primitive pairs, distance calculation between colliding meshes with ray-tracing and points in distance fields [START_REF] Faure | SOFA: A Multi-Model Framework for Interactive Physical Simulation[END_REF].For each simulation object, a collision topology is defined that associates a collision geometry to that object.

In SOFA, collision process is divided into different phases which altogether make up a collision pipeline. First the broad phase detection takes place returning pairs of colliding bounding volumes. This is followed by a narrow phase detection process which finds pairs of geometric primitives along with the corresponding contact points. For these contact points, different contact interactions are applied. SOFA supports both penalty-based as well as constraint-based repulsion effects. These repulsive effects are processed with other forces on the object by the solver.

For the purpose of exercise development, one main challenge is to define a suitable topology for collision for each object. A very fine mesh defined for collision makes the collision responses more realistic but it can slow down the simulation. A coarser mesh, on the other hand, might reduce realism of collision but keeps the simulation real-time. In order to keep the simulation real-time, coarser but well-defined collision meshes are used for simulation objects in each exercise without compromising a lot on realism.

Once the collision models are applied to each simulation object, the standard collision pipeline of SOFA takes care of the collision effects. Every time two objects collide, the contact forces are calculated and are used to give a realistic repulsive effect. To provide enhanced visual feedback based on collisions, we have added exercise specific visual cues to highlight user mistakes. So for instance, if a user collides the instrument with a wrong organ in an exercise, the background turns red to warn the user that a mistake has been committed.

Visual-only objects are non-interactive and do not play any significant role in actual performance of an exercise. Their sole purpose is to fill in the empty spaces, such as providing the background surface. We do not enable collisions for these kinds of objects to avoid intersection testing, which may overburden the simulator unnecessarily.

There are certain objects in a simulation that do not change their positions but do contain collision models based on some topology, e.g., the floor object in the peg transfer exercise (Figure 8a). We have classified such objects as stationary mechanical objects. Modeling of such objects in SOFA does not require the use of mappings or solvers.

Movable mechanical objects are interactive and can change their positions during a simulation under the effect of forces. They require both the solvers and the mappers.

Solvers are required to calculate force, velocity and displacement updates for such objects.

Mappers are required to synchronize the visual mesh with mechanical behavior. These types of objects can either be rigid or deformable. In the case of deformable objects, components used to approximate such behavior, like mass-spring models or Finite Element Method (FEM) models, are also required to be added. These methods work on few parameters, like elasticity and spring constant, of the object that must be adjusted to get realistic simulations. In SmartSIM, an example of the deformable movable mechanical object is the cylindrical object in the grasping exercise (Figure 8b).

Topologically modifiable objects, as the name suggests, are those simulation objects that require topological changes. Example of these objects are the capillaries modeled in the fine dissection exercise of SmartSIM (Figure 8c). To model this kind of an object in SOFA, it must contain four more components that are specifically designed to handle topological changes [START_REF] Faure | SOFA: A Multi-Model Framework for Interactive Physical Simulation[END_REF].

The last category of objects that may exist in a VR surgical simulation is fluid. SOFA provides an implementation of the "Smoothed Particle Hydrodynamics (SPH)" method for modeling the fluid behavior. The particles based components of SOFA consist of particle source and particle sink. Particle source emits particles that are removed from the scene by the particle sink. We have modeled both the blood flow and smoke simulation in SmartSIM using these three components.

Instrument Simulation

Simulating instrument motion and its functionalities is one of the most important aspects of any medical simulation tool since it provides the first-level interface between the user and the software and hence is an important deciding factor for the quality of a simulator.

SmartSIM implements grasping, dissection, cutting, clipping and camera navigation functionalities. The simulated instruments are designed and modeled to ensure that each real movement is translated proportionally to the simulated movement with considerable precision.

Grasping

In SOFA, when a mouse cursor is used for grasping an object, a ray is cast from the cursor position to the object. If the ray intersects part of that object, a spring is created between that point and the cursor position. The object can then be moved using that spring simulating the effect of grasping. In SmartSIM, we have modified this method to change the starting position of the ray to the inside of the jaw of a grasper. Also, we have used multiple rays generated from different points of the grasper to ensure a greater probability of intersection with the object, hence creating a more realistic grasping simulation. The grasper is modeled as an articulated object and the movement of its jaws is synchronized to the gripper motion of the Mechanical Interface. Whenever the jaws are closed, these rays are activated and hence can grasp any object in between using springs. When the jaws are opened the springs are removed releasing the object.

Dissection

SOFA supports dissection via mouse using ray-casting. We have extended the modeling approach used for grasping in this case as well, i.e., using the casted rays with their origins on the tip of the L-hook instrument. These rays are activated whenever the pedal is pressed. Using the mesh removal algorithm, already implemented in SOFA [START_REF] André | Versatile Design of Changing Mesh Topologies for Surgery Simulation[END_REF], whenever a ray from the tip of L-hook intersects a topologically modifiable structure, the touched mesh elements are removed.

Volumetric Cutting

SOFA does not provide a reliable solution to the problem of volumetric cutting. For cutting of a volumetric object in SmartSIM, we have used the "Topological Change

Processor" component in SOFA that removes the entire mesh within a defined box. In order to apply volumetric cutting using scissors, we first divided the object into virtual symmetric blocks. The position of cutter jaws is noted whenever the jaws are closed. If their position is found to be inside any one of the virtual blocks, the corresponding block is removed using the topological change processor component.

Clipping

To the best of knowledge, SOFA does not support clipping, which requires the constraints to be added to the clipped tissue at the area of contact. In SmartSIM, we have implemented clipping, such that, whenever the clipper jaws are closed a new clip object is added to the scene graph at runtime. The position of the clip is extracted from the position of the jaws. Moreover, if the clipper jaws are closed over the tissue, its points above and below are attached together using a stiff spring. This mimics the compressed tissue behavior.

Camera

Simulation of endoscope functionality was relatively easy to implement in SOFA. For this purpose, we used the camera API, already present in SOFA based on OpenGL, to move the view in correspondence with the movement of the Mechanical Interface. Figure 8d shows the implemented camera functionality in SmartSIM in the camera navigation exercise.

Soft Tissue Modeling

Soft tissue modeling is undoubtedly the most important aspect of surgery simulation.

Despite the enormous increase in processing power of computers, a trade-off needs to be reached between accuracy of the deformable model and simulation time to keep the simulation real-time.

Various models exist in literature that can be used to simulate deformable organs [START_REF] Delingette | Soft Tissue Modeling for Surgery Simulation[END_REF].

Among them Finite Element Method (FEM) and Mass-spring are the most commonly used ones. FEM, being a continuum mechanics approach, gives more realistic simulation but also requires more processing. On the other hand, Mass-spring models represent the object as discrete springs between mass points. This results in a mesh of springs that is relatively less demanding computationally when it comes to its update at every time-step.

Besides these two methods, other hybrid approaches, like Tensor-mass models [START_REF] Cotin | A hybrid elastic model for real-time cutting, deformations, and force feedback for surgery training and simulation[END_REF], also exist. Tensor-mass models discretize an object into tetrahedrons to define a set of corresponding local stiffness tensors. These tensors are stored in tetrahedron edges and their mass is stored in tetrahedron nodes as in lumped mass points.

SOFA provides implementation for all these methods along with different variations of them. The main challenge that we faced regarding the tissue modeling in SmartSIM is the selection of appropriate model for specific tissue along with the identification of correct parameters, like stiffness for mass-spring models, and Young modulus and Poisson's ratio for FEM. For simple deformable objects, like those used in grasping and fine dissection exercises, as well as for more complex objects, like liver, colon and uterus as simulated in procedural exercises, Tensor-mass models were used because of their stability as well as low computational requirements.

Topology Selection

We used Autodesk 3DS Max [START_REF]3DSmax: 3D Modeling, Animation, and Rendering Software[END_REF] and Blender [START_REF] Roosendaal | [END_REF] for creating graphical objects, which are in turn represented by topologies. The right choice of topology is an important factor in keeping a simulation real-time.The collision surfaces, the mass-spring networks and the elements for FEM are all derived from the chosen topology in SOFA. However, being a multi-model framework, SOFA allows selection of different topologies for collision and behaviorial modeling for the same simulation object. The two main types of topology in SOFA are the grid-based topology and the mesh-based topology. In the grid-based topology, an object can be modeled as a grid of equally-spaced points. Whereas, in the mesh-based topology, the points can be in any arrangement, and are read from an input file defining the mesh.

For complex curved shapes, like that of a liver, depicted in Figure 8d, a grid-based topology does not accurately model the surface. For such objects, the mesh-based topology is a better choice. However, to keep the simulation real-time, the mesh to be used for collisions and deformable behavior needs to be coarse. Hence, a mesh-based topology intelligently allows us to achieve a trade-off between accuracy and real-time performance in this case.

On the other hand, collision surface and deformable behavior for simple structures, like the cylindrical object in Figure 8b, can be modeled accurately using a grid-based topology.

Although such objects can also be modeled using a mesh-based topology with a coarse mesh defined in the file, yet the grid implementation in SOFA allows greater flexibility and facilitates achieving the same objective and hence is a better choice in this case. Although SOFA provides various topologies as described in [START_REF] André | Versatile Design of Changing Mesh Topologies for Surgery Simulation[END_REF], yet in SmartSIM, we have only used the tetrahedral topologies. This is due to the selection of Tensor Mass model for deformable objects (as mentioned in soft tissue section), which is designed to work with these topologies. pregnancy from the fallopian tube. A short video of some of these exercises can be viewed at [START_REF] Smart-Surgisol | SmartSIM: A Virtual Reality Simulator for Laparoscopy Training using a Generic Physics Engine[END_REF]. Following are the details of basic and advanced exercises.

Exercise Development

Basic Exercises

Instrument Navigation

This exercise is designed to teach the skill of handling laparoscopic instruments. The user is presented with different shapes on the floor. The user is required to touch a highlighted pattern by navigating the highlighted instrument till the object is no more coloured(Figure 9a). Performance is evaluated on the basis of time and economy of movement, collision of instrument with floor and errors due to use of instrument other than the highlighted one.

Camera Navigation

The objective of this exercise is to practice the skill of handling an endoscope. The user is presented with an object on the floor. The is required to navigate an endoscope towards the object and focus the camera on it till the object is highlighted(Figure 9b). Performance is evaluated on the basis of time and economy of movement and errors due to collision of endoscope with the floor.

Coordination

Coordination exercise is designed to practice the skill of handling an instrument and an endoscope simultaneously. The user is presented with an object on the floor. The user is required to navigate an endoscope towards the object and focus the camera on it till the object is highlighted and then touch the object with the instrument(Figure 9c). Performance is evaluated on the basis of time and economy of movement and errors due to collision of endoscope with the floor.

Cutting

To practice the skill of cutting an object with laparoscopic scissors, the user is presented with a cylinder-shaped object, which is fixed on its ends close to the floor.

The user is required to grasp the object from one end and cut it from the other end at a specified location(Figure 9d). Performance is evaluated on the basis of time and economy of movement, collision of instruments with floor and errors due to cutting at the wrong location.

Clipping

To practice the skill of clip application, the user is presented with a cylinder-shaped object fixed on its ends close to the floor. The user is require to grasp the object from one end using forceps and apply a clip at a specified location(Figure 9e).

Performance is evaluated on the basis of time and economy of movement, collision of instruments with floor and errors due to misplaced or dropped clips.

Fine Dissection

To teach the skill of safely removing pieces surrounding a vessel structure, the user is presented with a broad tissue-like structure that covers two fine vessels underneath.

The user is required to stretch the center structure and cauterize the fine vessels underneath using L-hook(Figure 8c). Performance is evaluated on the basis of time and economy ot movement, collision of instruments with floor and errors due to burning of center tissue structure.

Grasping

This exercise is designed to practice the skill of grasping an object using laparoscopic forceps. The user is presented with a cylinder-shaped object fixed to the floor and is required to grasp the object and move it to a basket placed nearby(Figure 8b).

Performance is evaluated on the basis of time and economy of movement, collision of instruments with floor and errors due to wrong use of instrument.

Lifting and Grasping

The objective of the exercise is to practice the skill of lifting an object with one instrument and grasping another object with the instrument simultaneously. The

Peg Transfer

To improve the hand-eye coordination, the user is required to move four coloured disks from pegs on the left side to those on the right side and back to those on the left in a specified order of colour(Figure 8a). Performance is evaluated on the basis of time and economy of movement, collision of endoscope with floor and errors due to placing disks in mismatching pegs.

Precision and Speed

To practice the skill of handling laparoscopic instruments timely and precisely, the user is presented with different shaped objects on the floor and is required to touch the highlighted object by navigating the highlighted instrument till the object is no more coloured, in a given amount of time(Figure 9g). Performance is evaluated on the basis of time and economy of movement, collision of instruments with floor and errors due to failing to touch the required shape in time.

General Surgery Exercises

Appendectomy

This exercise teaches the basics of performing the laparoscopic appendectomy procedure. The user is presented with a scene showing a part of the large intestine along with the appendix and is required to remove the tissue around the intestine region, followed by clipping and cutting the appendix at the right region(Figure 10a).

Performance is evaluated on the basis of time and economy of movement and errors due to incomplete burning, wrong clipping and faulty cutting. This exercise teaches the basics of separating the gall-bladder from the liver bed. The user is presented with a scene showing a part of the gall-bladder and liver and is required to remove the tissue attaching the gall-bladder with the liver bed(Figure 10b).

Bladder Separation

Camera Navigatioon of Abdominal Anatomy

This exercise is designed to practice the skill of handling an endoscope and identifying specific anatomical structures in the abdomen. The user is required to focus the camera on certain areas in the upper right quadrant of the body(Figure 8d). Performance is evaluated on the basis of time and economy of movement and errors due to collision of endoscope with floor.

Cholecystectomy

This exercise is designed to learn the basics of performing the laparoscopic cholecystectomy procedure. The user is presented with a scene showing the lower part of the gall-bladder and is required to remove the tissue around the gall-bladder, followed by clipping and cutting the cystic duct and artery at the right regions(Figure 10c). Performance is evaluated on the basis of time and economy of movement and errors due to incomplete burning, wrong clipping and faulty cutting.

Gynaecology Exercises

Camera Navigation of Pelvic Anatomy

The objective of this exercise is to teach the user the skill of handling an endoscope and identifying specific anatomical structures located in the abdomen. The user is required to focus the camera at specified female pelvic region of the body(Figure 11a). Performance is evaluated on the basis of time and economy of movement and errors due to collision of endoscope with floor.

Salpingectomy

This exercise is designed to learn the basics of the laparoscopic salpingectomy procedure. The user is presented with a scene showing one side of the uterus and one fallopian tube and is required to remove the part of the tube with ectopic pregnancy using bipolar forceps(Figure 11b). Performance is evaluated on the basis of time and economy of movement and errors due to burning of wrong areas.

Tubal Ligation

This exercise is designed to teach the basics of laparoscopic tubal ligation. The user is required to focus on the uterus and the tube using the endoscope as the left instrument and clip the tube using the clipper as the right instrument(Figure 11c).

Performance is evaluated on the basis of time and economy of movement and errors due to wrong clipping.

Inclusion of Visual Effects

Another advantage of a VR simulation is that it can display textual instructions and visual cues to guide the trainee. Such features are usually scenario-specific, and hence cannot be a part of a generic engine. In SmartSIM, we have included both of these features by adding specific functionalities in SOFA.

In our system, we have included visual effects like highlighting of the objects that should not be touched by the tool otherwise, such as the floor in the grasping exercise (Figure 8b), and cues like changing of color of the pegs when a disk is potted in the right peg, in the peg transfer exercise (Figure 8a). Inclusion of such features requires extraction of specific collision contacts from among the list of all contacts, maintained by a contact manager in SOFA.

Performance Evaluation

Performance evaluation is an important feature of all VR surgical simulators that distinguishes it from the conventional box trainers. It helps to provide a thorough assessment of a performer's skills that is missing in training through box trainers. Special plug-ins were added in SOFA for evaluating metrics for each exercise in SmartSIM. For instance, Figure 12a shows the performance metric generated after the peg transfer exercise.

There are two types of metrics implemented in SmartSIM. The first type gives an objective assessment. Such metrics include commonly used metrics, such as task completion time, instrument path lengths and errors made while conducting the exercise tasks. The other type gives an assessment in comparison to the skills of the expert surgeons. These novel metrics are introduced so that the simulator can act as an independent learning tool and thus we can remove the requirement of direct supervision from expert surgeons. For such an assessment, there are two options introduced in the simulator to identify whether the exercise is performed by a novice or an expert surgeon. In case of an expert performance, the simulator is said to be in the learning mode. In this mode, the simulator only records the instrument path followed by the expert surgeon and uses it to create a benchmark [START_REF] Ahmad | Benchmarking Expert Surgeons' Path for Evaluating a Trainee Surgeon's Performance[END_REF].

If the exercise is performed by a novice, then the simulator is said to be in the evaluation mode. In this mode, the simulator records the path followed and calculates its deviation from the expert surgeons' paths. To grade the user on the basis of his expertise, the 'Performance Evaluation Results' window, shown in Figure 12a, displays scores of metrics critical in evaluating the performance of the user. The metrics are (i) time taken to complete the exercise, (ii) path length, (iii) angular path length, (iv) number of damages attempts is plotted to evaluate the improvement in particular exercise over time.

Database

SmartSIM maintains a local MySQL based database at the operating computer. The database is very simple with the main task of maintaining record of users and their passwords along with their respective performances for each exercise. SOFA does not offer any default database module and thus integrating the database system with the SOFA is one of the contributions of the reported work.

Conclusions

MIS is gradually replacing traditional surgical methods as it is safer, quicker, with less risk involved and results in quick patient recovery. In order to learn the special psycho motor skills for MIS, virtual reality based simulators are required that enable a surgeon to practice outside the Operation Theater.

The paper mainly shared the system-level perspective of SmartSIM, i.e., a novel virtual reality simulator for basic training in MIS. The distinguishing features of SmartSIM include its modular design approach using a generic physics engine by modifying it to overcome its limitations such as avoiding extra computational loads in Simulation Object Categorization, replacing the mouse cursor with instruments for realistic view in Instrument Simulation for basic and some advanced (general surgery and gynecology procedures) skills of laparoscopy. Moreover, the paper also describes an easy-to-fabricate custom-designed mechanical interface, which acts as the main input device for the simulator. The custom fabrication of mechanical interface of the simulator costed us around $2000. Presently, the system does not support force feedback but we are working on the introduction of a custom-built haptic module in the mechanical interface and development of more basic and advanced exercises such as suturing and knotting. Also, a set of experiments is to be designed to further investigate the construct validity of the system.

We have validated our system by using it in MIS training workshops organized by a team of surgeons at a local hospital. These workshops were based on box trainers, commercial simulators, like LapSim, and SmartSIM. It was found that, in comparison with box trainers and commercial simulators, the SmartSIM renders higher level of usefulness for MIS skills training, greater degree of realism to actual surgical scenarios, better quality of graphics, and improved overall effectiveness of exercises. Further advantages of the SmartSIM include reduced training costs, the ability to practice unusual and rare medical scenarios, objective and quick assessment of laparoscopic surgical skills and ease of mobility of the system.

Figure 1 :

 1 Figure 1: SmartSIM has three main modules: the Mechanical Interface, the Controller Circuit and the Software Application.

Figure 2 :

 2 Figure 2: SmartSIM: A virtual reality simulator

  Coded disc and encoder circuit board

Figure 3 :

 3 Figure 3: Optical Encoder

Figure 4 :

 4 Figure 4: SmartSIM has 5 decoupled DoFs

Figure 5 :

 5 Figure 5: Hand Manipulator (HM) Architecture diagram.

Figure 5

 5 Figure 5 shows a detailed architecture of the sensing circuit of the Controller Circuit module. It comprises of a single high speed Atmega1284p microcontroller, a USB communication circuit, a filtration circuit and encoders interface circuit, which is equipped with dedicated quadrature decoding chips. The algorithms embedded in the microcontroller are able to gauge the gripper, translational, roll, pitch and yaw movements via the optical encoders, attached to each of the five joints of the Mechanical Interface.

  used a data transmission baud rate of 19200 b/s and to transmit one tick through virtual com port requires 11 bits (start bit, data bits, parity bit and stop bit). With this baud rate, about 19200 / 11 = 1745.45 encoder ticks can be transmitted per second. The encoder generates 256 ticks per 360 degrees or one complete revolution with a resolution of 360 degrees / 256 ticks = 1.40625 degrees per tick. Similarly, 1.40625 * 1745.45 = 2454.53 degrees of movement can be transmitted per second. The DoF values, from the encoders, are fed to the control loop running on a specially designed controller board and necessary interface for sensors. The microcontroller converts these values to appropriate signals that can be transmitted via the USB bridge to the computer running the simulator application. The control loop keeps track for every DoF and converts these counts into absolute values, simultaneously.

Figure 6 :

 6 Figure 6: Layered Modular Software Architecture of SmartSIM

Figure 7 :

 7 Figure 7: SOFA: Mapping of different models

  (a) Peg Transfer: hand eye coordination, depth perception. (b) Grasping: specific grasping, instrument handling. (c) Fine Dissection: dissection using L-hook. (d) Camera Navigation of Abdominal Anatomy

Figure 8 :

 8 Figure 8: SmartSIM exercises

  SmartSIM supports ten basic exercises for training various aspects of laparoscopy, four exercises for training of general surgery procedures and three exercises for training of gynecology procedures. Modeling of each object in an exercise requires careful definition of parameters for each component, e.g., Rayleigh damping coefficients for an Euler implicit solver or Poissons ratio and Young modulus for FEM. Once all the objects are modeled, components implementing collision algorithms are introduced in the scene graph to allow for appropriate interaction between objects. The ten exercises included in SmartSIM are: (i) Instrument navigation to train the surgeons on basic handling of instruments in the laparoscopic environment (ii) Camera navigation to train the surgeons to handle the endoscope (iii) Coordination for training of handling an instrument in one hand with the endoscope in the other (iv) Grasping for improving hand-eye coordination and depth perception with the use of forceps (v) Lifting and grasping for training of extracting objects from underneath another object (vi) Fine dissection for dissection of capillary-like structures (vii) Cutting for training use of scissors (viii) Clipping to train the surgeons for using of clippers (ix) Peg transfer for training task-based extended exercises and (x) Speed exercise to teach the surgeons to act precisely within a confined time frame. The four general surgery procedures included in SmartSIM are: (i) Camera anatomy training to train the surgeons in handling the endoscope and identifying different organs of anatomy, (ii) Appendectomy to teach the surgeons the skill of removing appendix from the body, (iii) Cholecystectomy to train the surgeons in the skill of dissecting cystic duct and cystic artery, applying clips and cutting the ducts and artery using the scissor instrument and (iv) Bladder Resection to teach a surgeon the skill of dissecting and removing gallbladder from the liver bed. The three gynecology procedures included in SmartSIM are: (i) Camera anatomy training to teach the surgeons the skill of handling the endoscope and identifying female pelvic anatomy, (ii) Tubal Occlusion to train the surgeon in performing tubal occlusion by cutting the fallopian tubes and (iii) Salpingectomy to teach the surgeons the skill to extract ectopic

  Coordination: simultaneous instrument and endoscope handling.(d) Cutting: object cutting with scissors. (e) Clipping: clip application at specified location. (f) Lifting and Grasping: simultaneously lifting an object and grasping the other one.(g) Precision and Speed: timely and precise handling of instruments.

Figure 9 :

 9 Figure 9: SmartSIM: Basic Exercises

Figure 10 :

 10 Figure 10: SmartSIM: General Surgery Exercises

Figure 11 :

 11 Figure 11: SmartSIM: Gynaecology Exercises

(

  penalties) and (v) maximum amount of damage. Results are displayed separately as well as collectively for the left and right hand instrument to provide better understanding of hand co-ordination. The score blocks are color-coded to differentiate between good, acceptable, and poor performance relative to the benchmark set in the learning mode (construct validity). The green block indicates good performance, yellow block indicates

Figure 12 :

 12 Figure 12: Evaluation metric and performance graph

  and a trade-off between accuracy and real-time simulations in Soft Tissue Modeling and Topology Selection for each exercise. Also, the simulator is flexible and has the potential to be updated. If, for instance, someone wants to interface a new custom device, he would only need to modify the Interface Device Handler component of the system. Similarly, if there is a need to change the database then only the database needs to be updated with a script along with the modifications in DB Handler. The ease with which the simulator can be updated with plug-ins is due to the open source nature of SOFA. Similarly, more efficient algorithms can also be added by compiling the corresponding plug-in with the existing library and use the compiled plug-in in the current system. The plug-in can be added using SOFA's plug-in manager after which the user only needs to change the tag in exercise's xml file with name and attributes of the new plug-in. A new model can also be added in the system by carefully handling these modules individually, giving user the flexibility to add techniques or medical procedures. SmartSIM also includes novel training evaluation metrics that facilitate in supervised as well as unsupervised training of surgeons

Table 1 :

 1 Comparison:Open Source Surgical Simulation Tools

Acknowledgment

The authors wish to thank Dr. Asif Zafar Malik and his team at Holy Family Hospital, Pakistan, for their support in this research. This work was supported by a research grant (number ICTRDF/TR&D/2009/26) by National ICT R&D Fund Pakistan.