Resources and extra documentation for the manuscript "Needle Placement for Robot-assisted 3D Ultrasound-guided Breast Biopsy: A Preliminary Study" published in IEEE Latin America Transactions. The code is organized by the type of programming language used in the project in the following order Python -> Matlab -> R
. The project hierarchy and folders description is as follows
- PYTHON\BreastDimension: For a geometrical model of woman breast and basic dimensions for a breast holder device
- MATLAB\Models:
getRootDirectory.m
. Script for loading current working directory.startup.m
. Script for adding all folder paths to Matlab.- CAD_models:
- Breast. Breast models for A, B, and C-cup sizes.
- Devices. Needle devices for core and fine needle biopsies.
- Matlab_models. Scripts for robot modeling (forward and inverse kinematics), breast modeling, trajectory generation, a collision-free path algorithm and multiple simulation.
- Data: Trajectory data for joint trajectory testing.
- RoboticsToolbox:
- ForApp. Function scripts for implementing the GUI application.
- ForMatlab. Function scripts for all Matlab-based simulations.
- ForSimulink. Functions script for all Simulink-based simulations.
- ModernRobotics. Based on Modern robotics toolbox by Kevin Lynch and Frank Park.
- rvctools. Robotics Toolbox for MATLAB or RVC by Peter Corke.
- Test
- Simulink_models. For implementing a robot-assisted biopsy environment based on Simscape and Stateflow-Flowcharts. Simulation settings: Ode23t Solver.
- Data.
.mat
files for the GUI application, target biopsy points, breast holder models, Finite element breast models, breast dimensions, robot dimensions, robot kinematics, end effector waypoints and Simulink model workspace. - Extra. Figures for GUI application.
- GUI. For designing a Graphical User Interface (GUI) for setting the basic configurations of a robot-assisted needle placement before a complete simulation (
.mlapp
). - Results. Outputs for multiple simulation (
.xls
files) and target biopsy points for each breast-cup size (.mat
) - Scripts. For computing multiple simulations (
.m
) and biopsy targets samplings (.m
) based on factorial-method design. - SIM. Simulation models (
.slx
) for GUI application and multiple simulation.
- Data.
- work. For simulation cache in Simulink.
- R\SimulationAnalysis. For a statistical analysis and curves plotting.
- ProjectImages. Some manuscript images, figures and animation for the
README.m
file.
- Matlab 2020b or later. All additional packages (only needed codes) were uploaded in this repository.
- Robotics Toolbox for MATLAB or RVC from Robotics, Vision and Control Fundamental algorithms in MATLAB: Second Edition by Peter Corke.
- Modern robotics toolbox from Modern Robotics: Mechanics, Planning, and Control (Kevin Lynch and Frank Park, Cambridge University Press 2017 and 2019).
- Python 9.6
- R 2.1 or later
- Optional. Solidworks 2019 for CAD modeling and exporting files into Matlab
-
Run
startup.m
to add all paths to Matlab and run without problems -
Go to
Simulink_models\GUI\
and runbiopsyControl.mlapp
to open the application. -
The GUI lets you select randoms biopsy targets, define needle insertion avoiding collisions, generate robot trajectory and save all data in order to simulate a particular biopsy case in Simulink.
The application use is interactively easy to follow. The bottoms were sequentially ordered according to: Get biopsy target, define needle insertion, set needle device, generate robot trajectory for the preplacement stage, save data, reload model Simulink variables, simulate and get errors report.
-
This robot environment in Simulink can be opened in the option
Open Model
inside the third tab (Postplacement stage
) or directly by going toSimulink_models\SIM\breastBiopsyApp.slx
. Then, playing the optionSimulate
to initialize and showing a visual simulation window (based on Simscape multibody toolbox).NOTE When opening the
breastBiopsyApp.slx
directly without running the application before, there will be a warning message about a failed load of model workspace variables. To avoid this, run all the application steps to create the correct filesimulinkWorkSpace.mat
and reload all needed model variables. Finally, go toModel Explorer -> Model Hierarchy -> breastBiopsyApp -> Model Workspcae -> Workspace data
in Simulink, browse for thesimulinkWorkSpace.mat
file and save the model. This will eliminate the warning message, and thebreastBiopsyApp.slx
model can also be able to run with the previous loaded variables any time.
- Open the
multiplesSIM.mat
and run. - The results will be saved in
Simulink_models\Results\
in Excel files (i.e.simulationA_FNA
was created by simulating a breast holder of A-size cup and a fine needle).The Simulink file associated to
multiplesSIM.mat
isbreastBiopsyMulti.slx
and always run in second plane. Therefore, there will be not a visual simulation. However, this could be modified.
The same repository can be found on GitLab.