NifTK
16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
|
Macros | |
#define | ndi3D(p, ph, mode) ndiCommand((p),"3D:%02X%d",(ph),(mode)) |
#define | ndiBEEP(p, n) ndiCommand((p),"BEEP:%i",(n)) |
#define | ndiCOMM(p, baud, dps, h) ndiCommand((p),"COMM:%d%03d%d",(baud),(dps),(h)) |
#define | ndiDSTART(p) ndiCommand((p),"DSTART:") |
#define | ndiDSTOP(p) ndiCommand((p),"DSTOP:") |
#define | ndiGX(p, mode) ndiCommand((p),"GX:%04X",(mode)) |
#define | ndiINIT(p) ndiCommand((p),"INIT:") |
#define | ndiIRATE(p, rate) ndiCommand((p),"IRATE:%d",(rate)) |
#define | ndiIRCHK(p, mode) ndiCommand((p),"IRCHK:%04X",(mode)) |
#define | ndiIRED(p, ph, sig) ndiCommand((p),"IRED:%02X%08X",(ph),(sig)) |
#define | ndiIRINIT(p) ndiCommand((p),"IRINIT:") |
#define | ndiLED(p, ph, led, s) ndiCommand((p),"LED:%02X%d%c",(ph),(led),(s)) |
#define | ndiPDIS(p, ph) ndiCommand((p),"PDIS:%02X",(ph)) |
#define | ndiPENA(p, ph, mode) ndiCommand((p),"PENA:%02X%c",(ph),(mode)) |
#define | ndiPFSEL(p, ph, tf) ndiCommand((p),"PFSEL:%02X%02X",(ph),(tf)) |
#define | ndiPHF(p, ph) ndiCommand((p),"PHF:%02X",(ph)) |
#define | ndiPHINF(p, ph, format) ndiCommand((p),"PHINF:%02X%04X",(ph),(format)) |
#define | ndiPHRQ(p, num, sys, tool, port, chan) ndiCommand((p),"PHRQ:%-8.8s%1.1s%1.1s%2.2s%2.2s",(num),(sys),(tool),(port),(chan)) |
#define | ndiPHSR(p, mode) ndiCommand((p),"PHSR:%02X",(mode)) |
#define | ndiPINIT(p, ph) ndiCommand((p),"PINIT:%02X",(ph)) |
#define | ndiPPRD(p, ph, addr) ndiCommand((p),"PPRD:%02X%04X",(ph),(addr)) |
#define | ndiPPWR(p, ph, a, x) ndiCommand((p),"PPWR:%02X%04X%.128s",(ph),(a),(x)) |
#define | ndiPSEL(p, ph, id) ndiCommand((p),"PSEL:%02X%s",(ph),(id)) |
#define | ndiPSOUT(p, ph, a, b, c) ndiCommand((p),"PSOUT:%02X%c%c%c",(ph),(a),(b),(c)) |
#define | ndiPSRCH(p, ph) ndiCommand((p),"PSRCH:%02X",(ph)) |
#define | ndiPSTAT(p, format) ndiCommand((p),"PSTAT:%04X",(format)) |
#define | ndiPURD(p, ph, addr) ndiCommand((p),"PURD:%02X%04X",(ph),(addr)) |
#define | ndiPUWR(p, ph, a, x) ndiCommand((p),"PPWR:%02X%04X%.128s",(ph),(a),(x)) |
#define | ndiPVCLR(p, port) ndiCommand((p),"PVCLR:%c",(port)) |
#define | ndiPVTIP(p, port, tip, np) ndiCommand((p),"PVTIP:%c%d%d",(port),(tip),(np)) |
#define | ndiPVWR(p, ph, a, x) ndiCommand((p),"PVWR:%02X%04X%.128s",(ph),(a),(x)) |
#define | ndiRESET(p) ndiCommand((p),NULL) |
#define | ndiSFLIST(p, mode) ndiCommand((p),"SFLIST:%02X",(mode)) |
#define | ndiSSTAT(p, format) ndiCommand((p),"SSTAT:%04X",(format)) |
#define | ndiTCTST(p, ph) ndiCommand((p),"TCTST:%02X",(ph)) |
#define | ndiTSTART(p) ndiCommand((p),"TSTART:") |
#define | ndiTSTOP(p) ndiCommand((p),"TSTOP:") |
#define | ndiTTCFG(p, ph) ndiCommand((p),"TTCFG:%02X",(ph)) |
#define | ndiTX(p, mode) ndiCommand((p),"TX:%04X",(mode)) |
#define | ndiVER(p, n) ndiCommand((p),"VER:%d",(n)) |
#define | ndiVSEL(p, n) ndiCommand((p),"VSEL:%d",(n)) |
Functions | |
int | ndiPVWRFromFile (ndicapi *pol, int ph, char *filename) |
These are a set of macros that send commands to the device via ndiCommand().
The ndiGetError() function can be used to determine whether an error occurred.
The return value is a terminated string containing the reply from the device with the CRC and final carriage return chopped off.
#define ndi3D | ( | p, | |
ph, | |||
mode | |||
) | ndiCommand((p),"3D:%02X%d",(ph),(mode)) |
Get the 3D position and an error value for a single marker on a tool. The mode should be set to 1 or 3. This command is only available in diagnostic mode.
ph | valid port handle in the range 0x01 to 0xFF |
mode | see NDI documentation |
The IRED command should be used to set up a marker firing signature before this command is called.
#define ndiBEEP | ( | p, | |
n | |||
) | ndiCommand((p),"BEEP:%i",(n)) |
Cause the device to beep.
n | the number of times to beep, an integer between 1 and 9 |
A reply of "0" means that the device is already beeping and cannot service this beep request.
This command can be used in tracking mode.
#define ndiCOMM | ( | p, | |
baud, | |||
dps, | |||
h | |||
) | ndiCommand((p),"COMM:%d%03d%d",(baud),(dps),(h)) |
Change the device communication parameters. The host parameters will automatically be adjusted to match. If the specified baud rate is not supported by the serial port, then the error code will be set to NDI_BAD_COMM and the device will have to be reset before communication can continue. Most modern UNIX systems accept all baud rates except 14400, and Windows systems support all baud rates.
baud | one of NDI_9600, NDI_14400, NDI_19200, NDI_38400, NDI_57600, NDI_115200 |
dps | should usually be NDI_8N1, the most common mode |
h | one of NDI_HANDSHAKE or NDI_NOHANDSHAKE |
#define ndiDSTART | ( | p | ) | ndiCommand((p),"DSTART:") |
Put the device into diagnostic mode. This must be done prior to executing the IRCHK() command. Diagnostic mode is only useful on the POLARIS
#define ndiDSTOP | ( | p | ) | ndiCommand((p),"DSTOP:") |
Take the device out of diagnostic mode.
#define ndiGX | ( | p, | |
mode | |||
) | ndiCommand((p),"GX:%04X",(mode)) |
Request tracking information from the system. This command is only available in tracking mode. Please note that this command has been deprecated in favor of the TX command.
mode | a reply mode containing the following bits:
|
The GX command with the appropriate reply mode is used to update the data that is returned by the following functions:
#define ndiINIT | ( | p | ) | ndiCommand((p),"INIT:") |
Initialize the device. The device must be initialized before any other commands are sent.
#define ndiIRATE | ( | p, | |
rate | |||
) | ndiCommand((p),"IRATE:%d",(rate)) |
Set the POLARIS infrared firing rate to 20 Hz = 0, 30 Hz = 1, 20 Hz = 2
#define ndiIRCHK | ( | p, | |
mode | |||
) | ndiCommand((p),"IRCHK:%04X",(mode)) |
Check for sources of environmental infrared. This command is only valid in diagnostic mode after an IRINIT command.
mode | reply mode bits:
|
The IRCHK command is used to update the information returned by the ndiGetIRCHKDetected() and ndiGetIRCHKSourceXY() functions.
#define ndiIRED | ( | p, | |
ph, | |||
sig | |||
) | ndiCommand((p),"IRED:%02X%08X",(ph),(sig)) |
Set the infrared firing signature for the specified port. This command is only available in diagnostic mode.
ph | valid port handle in the range 0x01 to 0xFF |
sig | a 32-bit integer whose bits specify what IREDS to fire |
#define ndiIRINIT | ( | p | ) | ndiCommand((p),"IRINIT:") |
Initialize the diagnostic environmental infrared checking system. This command must be called prior to using the IRCHK command.
#define ndiLED | ( | p, | |
ph, | |||
led, | |||
s | |||
) | ndiCommand((p),"LED:%02X%d%c",(ph),(led),(s)) |
Set a tool LED to a particular state.
ph | valid port handle in the range 0x01 to 0xFF |
led | an integer between 1 and 3 |
state | desired state: NDI_BLANK 'B', NDI_FLASH 'F' or NDI_SOLID 'S' |
This command can be used in tracking mode.
#define ndiPDIS | ( | p, | |
ph | |||
) | ndiCommand((p),"PDIS:%02X",(ph)) |
Disable transform reporting on the specified port handle.
ph | valid port handle in the range 0x01 to 0xFF |
#define ndiPENA | ( | p, | |
ph, | |||
mode | |||
) | ndiCommand((p),"PENA:%02X%c",(ph),(mode)) |
Enable transform reporting on the specified port handle.
ph | valid port handle in the range 0x01 to 0xFF |
mode | one of NDI_STATIC 'S', NDI_DYNAMIC 'D' or NDI_BUTTON_BOX 'B' |
#define ndiPFSEL | ( | p, | |
ph, | |||
tf | |||
) | ndiCommand((p),"PFSEL:%02X%02X",(ph),(tf)) |
Specify a POLARIS tool faces to use for tracking
ph | valid port handle in the range 0x01 to 0xFF |
tf | tool face mask in the range 0x01 to 0xFF |
#define ndiPHF | ( | p, | |
ph | |||
) | ndiCommand((p),"PHF:%02X",(ph)) |
Free the specified port handle.
ph | valid port handle in the range 0x01 to 0xFF |
#define ndiPHINF | ( | p, | |
ph, | |||
format | |||
) | ndiCommand((p),"PHINF:%02X%04X",(ph),(format)) |
Ask the device for information about a tool handle.
format | a reply format mode composed of the following bits:
|
The use of the PHINF command with the appropriate reply format updates the information returned by the following commands:
This command is not available during tracking mode.
#define ndiPHRQ | ( | p, | |
num, | |||
sys, | |||
tool, | |||
port, | |||
chan | |||
) | ndiCommand((p),"PHRQ:%-8.8s%1.1s%1.1s%2.2s%2.2s",(num),(sys),(tool),(port),(chan)) |
Requeset a port handle given specific tool criteria.
num | 8-digit device number or wildcard "********" |
sys | system type TIU "0" or AURORA SCU "1" or wildcard "*" |
tool | wired "0" or wireless "1" or wildcard "*" |
port | wired "01" to "10", wireless "0A" to "0I" or wildcard "**" |
chan | AURORA tool channel "00" or "01" or wildcard "**" |
The use of the PHRQ command updates the information returned by the following commands:
#define ndiPHSR | ( | p, | |
mode | |||
) | ndiCommand((p),"PHSR:%02X",(mode)) |
List the port handles.
mode | the reply mode:
|
The use of the PHSR command with the appropriate reply format updates the information returned by the following commands:
This command is not available during tracking mode.
#define ndiPINIT | ( | p, | |
ph | |||
) | ndiCommand((p),"PINIT:%02X",(ph)) |
Initialize the tool on the specified port handle.
ph | valid port handle in the range 0x01 to 0xFF |
#define ndiPPRD | ( | p, | |
ph, | |||
addr | |||
) | ndiCommand((p),"PPRD:%02X%04X",(ph),(addr)) |
Read the tool SROM. Use ndiHexDecode() to convert reply to binary.
#define ndiPPWR | ( | p, | |
ph, | |||
a, | |||
x | |||
) | ndiCommand((p),"PPWR:%02X%04X%.128s",(ph),(a),(x)) |
Write the tool SROM. Use ndiHexEncode() to convert data to a hex string.
#define ndiPSEL | ( | p, | |
ph, | |||
id | |||
) | ndiCommand((p),"PSEL:%02X%s",(ph),(id)) |
Select an SROM target by ID.
Set the three GPIO wire states for an AURORA tool. The states available are 'N' (no change), 'S' (solid on), 'P' (pulse) and 'O' (off).
ph | valid port handle in the range 0x01 to 0xFF |
a | GPIO 1 state |
b | GPIO 2 state |
c | GPIO 3 state |
#define ndiPSRCH | ( | p, | |
ph | |||
) | ndiCommand((p),"PSRCH:%02X",(ph)) |
Search for available SROM targets.
#define ndiPSTAT | ( | p, | |
format | |||
) | ndiCommand((p),"PSTAT:%04X",(format)) |
Ask for information about the tool ports. This command has been deprecated in favor of the PHINF command.
format | a reply format mode composed of the following bits:
|
The use of the PSTAT command with the appropriate reply format updates the information returned by the following commands:
This command is not available during tracking mode.
#define ndiPURD | ( | p, | |
ph, | |||
addr | |||
) | ndiCommand((p),"PURD:%02X%04X",(ph),(addr)) |
Read the user part of the tool SROM. Use ndiHexDecode() convert reply.
#define ndiPUWR | ( | p, | |
ph, | |||
a, | |||
x | |||
) | ndiCommand((p),"PPWR:%02X%04X%.128s",(ph),(a),(x)) |
Write the user part of the tool SROM. Use ndiHexEncode() to convert data.
#define ndiPVCLR | ( | p, | |
port | |||
) | ndiCommand((p),"PVCLR:%c",(port)) |
Clear the virtual SROM for the specified port. For a passive tool, this is equivalent to unplugging the tool. This command has been deprecated in favor of PHF.
port | one of '1', '2', '3' or 'A' to 'I' |
#define ndiPVTIP | ( | p, | |
port, | |||
tip, | |||
np | |||
) | ndiCommand((p),"PVTIP:%c%d%d",(port),(tip),(np)) |
Set the virtual TOOL IN PORT and non-POLARIS tool signals for this port. This command has been deprecated in favor of PHRQ.
port | one of '1', '2', '3' or 'A' to 'I' |
tip | one of 0 (no tool in port) or 1 (tool in port) |
type | one of 0 (non-POLARIS tool) or 1 (POLARIS tool) |
#define ndiPVWR | ( | p, | |
ph, | |||
a, | |||
x | |||
) | ndiCommand((p),"PVWR:%02X%04X%.128s",(ph),(a),(x)) |
Write to a virtual SROM address on the specified port handle. The ndiPVWRFromFile() function provides a more convenient means of uploading tool descriptions.
ph | valid port handle in the range 0x01 to 0xFF |
a | an address between 0x0000 and 0x07C0 |
x | 64-byte data array encoded as a 128-character hexidecimal string |
The ndiHexEncode() function can be used to encode the data into hexidecimal.
#define ndiRESET | ( | p | ) | ndiCommand((p),NULL) |
Send a serial break to reset the device. If the reset was not successful, the error code will be set to NDI_RESET_FAIL.
#define ndiSFLIST | ( | p, | |
mode | |||
) | ndiCommand((p),"SFLIST:%02X",(mode)) |
Get a feature list for this device.
mode | the desired reply mode
|
The feature summary bits are defined as follow:
#define ndiSSTAT | ( | p, | |
format | |||
) | ndiCommand((p),"SSTAT:%04X",(format)) |
Request status information from the device.
format | a reply format mode composed of the following bits:
|
The use of the SSTAT command with the appropriate reply format updates the information returned by the following commands:
This command is not available during tracking mode.
#define ndiTCTST | ( | p, | |
ph | |||
) | ndiCommand((p),"TCTST:%02X",(ph)) |
Perform a current test on this port.
#define ndiTSTART | ( | p | ) | ndiCommand((p),"TSTART:") |
Put the device into tracking mode.
#define ndiTSTOP | ( | p | ) | ndiCommand((p),"TSTOP:") |
Take the device out of tracking mode.
#define ndiTTCFG | ( | p, | |
ph | |||
) | ndiCommand((p),"TTCFG:%02X",(ph)) |
Set default tool configuration prior to testing.
#define ndiTX | ( | p, | |
mode | |||
) | ndiCommand((p),"TX:%04X",(mode)) |
Request tracking information from the device. This command is only available in tracking mode.
mode | a reply mode containing the following bits:
|
The TX command with the appropriate reply mode is used to update the data that is returned by the following functions:
#define ndiVER | ( | p, | |
n | |||
) | ndiCommand((p),"VER:%d",(n)) |
Get a string that describes the device firmware version.
n | the processor to get the firmware revision of:
|
#define ndiVSEL | ( | p, | |
n | |||
) | ndiCommand((p),"VSEL:%d",(n)) |
Select from the different calibrated operating volumes available to the device.
n | the volume to select, see ndiSFLIST() |
Write data from a ROM file into the virtual SROM for the specified port.
pol | valid NDI device handle |
ph | valid port handle in the range 0x01 to 0xFF |
filename | file to read the SROM data from |
If the return value is not NDI_OKAY but ndiGetError() returns NDI_OKAY, then the ROM file could not be read and no information was written to the device.
This function uses the PVWR command to write the SROM. The total size of the virtual SROM is 1024 bytes. If the file is shorter than this, then zeros will be written to the remaining space in the SROM.