Example program to receive OpenIGTLink POLYDATA message and extract points
This is a simple program that demonstrates how to receive a POLYDATA message from a server program and extract the coordinates of the point. It will output the coordinates as comma-separated values on the standard output.
The program is written using CMake. Run CMake to generate a Makefile (Linux/Mac) or project file (Windows), and build. On Linux/Mac:
cd <working directory>
git clone https://github.com/tokjun/IGTLPolyToPointExample
mkdir IGTLPolyToPointExample-build
cd IGTLPolyToPointExample-build
cmake -DOpenIGTLink_DIR:STRING=<OpenIGTLink binary directory> ../IGTLPolyToPointExample
make
First, set up 3D Slicer:
- Start 3D Slicer, and load a surface model (VTK or STL file).
- Open the "OpenIGTLink IF" module
- In the "OpenIGTLink IF" module, create a connector and configure as a server.
- Make sure the port number is 18944.
- Start the OpenIGTLink server by clicking the "Active" button. The status should become "WAIT".
Then, open the terminal and star the example:
- Move to the folder that contains the executive file for the example program.
- Run the example program with the following command: "IGTLPolyToPointExample localhost 18944"
- Confirm that the status on the 3D Slicer OpenIGTLink IF module becomes "ON".
Push the surface model from 3D Slicer to the example program:
- In the OpenIGTLink IF module, scroll down to the "I/O Configuration" section. There is a tree list.
- Under IGTLConnector in the tree list, click 'OUT'
- Select the name of the surface model from the selector below the tree list interface.
- Click '+' button next to the selector. The surface model shows up under 'OUT'. (It may be hidden. If you see '+' next to 'OUT', please click it to expand.)
- Click the surface model in the tree list.
- Click the 'Send' button below the tree list (on the right).
- The example program will start receiving a POLYDATA message and putting the coordinates to the standard output (console).