Porta Synchronization Signals

From WikiSonix
Jump to: navigation, search

Porta provides access to the synchronization control on the ultrasound system. There are 2 BNC inputs and 2 BNC outputs on the latest platform, and only 1 of each on the older Sonix RP platform. The BNC ports are accessible on the PCI card that provides an interface between the ultrasound electronics and the PC.

Parameter Control[edit]

There are a few parameters that control how the BNC is setup, namely trigger in, trigger out, and trigger out 2. These can be used in various ways.

Input[edit]

When trigger in is set to 0 (default), the Porta function pollBnc() should be implemented in a worker thread that will wait for an interrupt to occur. Typical clinical scenarios would denote this input as a footswitch function, where the software will respond to the interrupt with a programmable command such as freezing the pipeline, or storing an image. When pollBnc() returns true, a call to ackBnc() should be made to tell the ultrasound hardware that the interrupt has been dealt with. Most likely, programs polling for this interrupt will want to post a message to the main thread to process and perform the footswitch function.

When trigger in is set to 1 or 2, then the imaging pipeline will be halted, and the ultrasound hardware will wait for a TTL signal to arrive on the BNC input. With a value of 1, the system will transmit and receive exactly one ultrasound line. So for instance, if a B mode image is made up of 256 scanlines (100% Sector and 256 line density), then the trigger needs to happen 256 times for the entire frame to be collected. In this case, a pulse-repetition frequency (PRF) should be maintained, or perhaps not, depending on the algorithm employed. The collector thread will not actually pick up the new frame after 256 inputs, but 257 are actually needed, as discussed in another Porta documentation page, the thread looks at the frame header of the following frame to signal that the previous frame is ready for processing. With a value of 2, the system will will transmit and receive the entire ultrasound frame at the PRF that would occur based on the parameters that have been set (ie. depth, sector, etc). Again, in this case, the callback for that frame won't happen until the following frame has been triggered.

Please note that the second BNC input has not been implemented as of yet.

Output[edit]

When trigger out or trigger out 2 are set to 0 (default), the Porta function signalBnc() should be implemented to send a pulse out on one of the BNC connectors. Typical clinical scenarios would denote this output as a print function, whereby the activation of a button such as print would send a signal to trigger a photo printer that is connected to the BNC, and the video output to capture a snapshot of the video at the time of the signal.

When trigger out or trigger out 2 are set to 1 or 2, then the BNC ports are used as a highly calibrated synchronization tool for triggering other devices. With a value of 1, the system will send a pulse at the beginning of each ultrasound line. So for instance, if a B mode image is made up of 256 scanlines (100% Sector and 256 line density), then the BNC will output 256 TTL pulses per frame in a consistent manner (maximum jitter of 25ns). With a value of 2, the BNC will send a signal out at the beginning of each frame, and thereby provide a consistent pulse at the exact ultrasound acquisition frame rate.

General Usage[edit]

The following pseudo-code gives an idea of how polling for a signal on the input BNC would work:

void main()
{
  start pollThread()

  while(1)
  {
    // do something
  }
}

void pollThread()
{
  while(1)
  {
    if (porta->pollBnc())
    {
      porta->ackBnc()
      // trigger main thread
    }

    sleep(10ms)
  }
}

The following pseudo-code gives an idea of how sending a signal on an output BNC would work:

void main()
{
  while(1)
  {
    // do something
  }
}

void onSomeKey()
{
  porta->signalBnc()
}