What I did
The target was a pneumatic robot with an image-to-robot transform accurate to a millimetre or two, enough to place a needle between vertebrae.
The project followed a complete image-guided intervention pipeline: MRI acquisition, then image processing, then path planning, then coordinate transformation, then robot control.
MRI scans were processed using 3D Slicer software to select optimal slices showing fiducial markers and vertebrae contours clearly. Window-leveling was applied to maximize fiducial contrast for localization and reduce gray noise in vertebrae images for robust boundary detection. Images were exported at 256×256 resolution to match the coordinate conversion factor.
MATLAB scripts performed morphological closing (imclose) followed by boundary detection (bwboundaries) to identify each vertebra. Region properties including centroids, area, and perimeter were computed using regionprops. For each intervertebral space (L1/L2 through L4/L5), the optimal needle path was calculated by averaging Y-values between upper and lower vertebrae boundaries, maximizing distance from bone.
L1_vertebrae_code.m) handled the partially visible top vertebra by extracting only its lower boundaryA pipeline converted coordinates from 3D Slicer image space to real-world robot commands. The conversion factor was empirically measured as 1.20225 (corrected from the Slicer-provided 1.367). The transformation accounted for image orientation without flipping, handling coordinate conversion in the final robot command stage instead.
The conversion factor error of 0.16 (1.367 − 1.20225) caused a 15mm X-offset and 7mm Y-offset at the first vertebral slot. This was the largest single source of positioning error, identified through systematic line-by-line code review during live demonstration debugging.
The 3-stage pneumatic system uses 2D inverse kinematics since height is fixed. Stage 1 controls Y-direction with a 70mm platform (stage_center = 35mm). Stage 2 controls rotation angle theta. Stage 3 controls needle insertion depth affecting both X and Y. Trigonometric calculations determine travel distances, which are then converted to motor steps.
Live demonstration revealed three bugs that were systematically identified through line-by-line code review and resolved:
System validated through resistance force tests on silicone blocks and targeting tests on a 3D printed spine phantom model. The pneumatic robot operated at 25 psi with Stage 3 running at half speed for insertion accuracy.
Post-debugging positioning accuracy achieved within a few millimeters across all 4 vertebral slots.
Needle path coordinates computed in MATLAB image space (256×256), maximizing distance from vertebrae boundaries for safe insertion.
| Vertebral Path | Entry Point (x,y) | Target Point (x,y) |
|---|---|---|
| L1/L2 | (93, 105) | (81, 102.833) |
| L2/L3 | (92, 132) | (80, 128.5) |
| L3/L4 | (90, 157.75) | (79, 159) |
| L4/L5 | (92, 183) | (80, 181.167) |
We found the bugs by testing and calculating. For each move we worked out the value the robot should reach, measured how far off it actually was, and traced the difference back to its source. That's how the coordinate flip, the conversion factor and the angle reference each turned up.
Lab report documenting the complete methodology, results, and analysis.
I developed the inverse kinematics calculations, MATLAB image processing pipeline for vertebrae boundary detection and path planning, and led the systematic debugging effort that identified and resolved three coordinate transformation bugs, achieving <2mm needle positioning accuracy.
Team collaboration with Date and RN (equal contribution). Equipment assistance from Team 5 for testing.
Course: EN.530.666 - Magnetically Actuated and MRI Compatible Robots, Johns Hopkins University - Whiting School of Engineering.