Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

LEGO Mindstorms IGT Workshop


This workshop is designed to work with the
LEGO Mindstorms EV3 kit and a standard box of lego bricks.

This is an updated version of the workshop originally developed by the National Alliance for Medical Imaging Computing which used the previous generation LEGO Mindstorms.

The phantom hasn't changed from the previous workshop, so you can use the same inststructions to construct it. Note that the newer box of lego bricks does not have the same bricks as the old one, so substitutions have to be made, and since the automatic registration has not yet been implemented, the towers are optional.

Construct the robot according to the instructions in this repo at Instructions/RobotAssemblyInstructions.pdf. Additionaly connect the robot to the phantom, and wire the motors according the instructions at Instructions/MiscAssemblyInstructions.pdf. Attach a touch sensor and an infrared sensor to any ports.

We are using the 3rd party ev3dev operating system to program the EV3 brick. If you are using a kit that has already been used for this workshop it most likely already has that OS installed. However, if not follow the instructions here.

The brick must be connected to the internet somehow, both to download the script and to communicate with the PC. Since we don't need mobility, there is no reason to set up a wireless connection, and the USB connection should be fine.

To get the script on the EV3 brick you can either clone this repository, or just copy and paste the contents of the file into a new file on the EV3. If you do, make sure to mark the new file as executable.

For the PC, download Slicer. This workshop has been tested with version 4.8.1 but it should work with similar versions.

Basic Tutorial: Image Guided Therapy

Warning about using Slicer for clinical use

Open the Application Settings by clicking Edit->Application Settings:

Edit->Application Settings

Go to the Modules tab:

List of Module Paths

Add a path under Additional Module Paths which points to the folder named LegoWorkshop in this repository:

Choose Directory

Now that directory will be in the list:

List of Module Paths

This will require a reboot of the program to take effect:

Restart Required

To use the module, load it from the Modules menu:

Choosing LEGO Module

Make sure that under LegoWorkshop - Configuration the server address matches the address of your brick, (probably ev3dev.local). If ev3dev.local doesn't work, get the IP of the EV3 from the menu WirelessAndNetowrks->AllNetowrkConnections->[Wired or other]->IPv4. If the module loaded correctly it should look something like the following:

Loaded Module

Download the CT volume of the LEGO phantom and extract it somewhere. Now open that data with File->Add Data and point to the first file in the series:

File->Add Data

Show additional options:

Additional Options

Uncheck the Single File box:

Not Single File

Click OK. Now you should see the CT scan of a LEGO phantom:

Not Single File

Then add a Fiducial to the point you want to target by clicking on the icon with the red dot and blue arrow:

Select Feducial

Then click somewhere you want the robot to probe, and then choose the feducial namespace (F) and that position will displayed on the list:

Feducial List

Then choose which point(s) you want the robot to 'probe' by ticking the box next to them. When you are ready (and assuming you are running, press the Go button:

Send Go Command

This should make the robot move!

Moderate Tutorial: Manual Registration

A calibration of the robot to the phantom was already programmed into the Slicer module, but if you want to move the robot to somewhere else around the phantom, while still having it within range of the injector, you can perform a manual registration. This is done by selecting at least 3 feducials and getting measurements of how those relate to the robot in the real world. Once you have your points ticked, press the Replace Calibration Points button:

Send Go Command

This will bring the points up to the table, but you will notice that the joint values are empty. To fill those we will use another python script that outputs the joint values without running the motors. It is called and should be run through ssh so that you can see the output. Move the robot to point towards the calibration points you chose (keeping in mind that they need to correspond 1:1), and fill in the values.

Note that the inject motor's encoder is spotty, and sometimes doesn't work so it is currently not implemented ( will either show 0 or a huge number) so you have to measure the distance from the orange circle of the upright large motor to your calibration point in millimeters, and that value will be Dst.

robot@ev3dev:~/lego-igt-workshop$ Python/ 
Press the touch sensor to read the motor positions
WARNING! The inject motor does not seem to work, you will have to measure that manually

Dst Azm Elv
-1467 38 44
-1467 38 44

Enter those numbers into the table:

Enter Joint Values

The press the Rerun Calibration button to get a new calibration:

Rerun Calibration

Now you can test out your new calibration!

Note that if you think something is wrong you can set Check_Calibration=True in and if you run Slicer from a terminal you can get the details of the linear algebra, including the RMSE which (if you used more than 3 points) lets you know how well the calibration points agree on a registration.

Advanced Tutorial: Automatic Registration

The robot can be equiped with either an ultrasonic or infrared range sensor, which can be used to sense the phantom and perform a fully automated registration (similar to how registration is done in the OR). However, this has not been implemented in the code, so it is up to you to take on this challenge. Good luck!


No description, website, or topics provided.



No releases published


No packages published