Module image

Module image 

Source
Expand description

IMAGE message type implementation

The IMAGE message is used to transfer 2D/3D medical image data. This is one of the most commonly used OpenIGTLink message types.

§Use Cases

  • CT/MRI Image Transfer - Sending volumetric medical images from scanner to workstation
  • Ultrasound Streaming - Real-time 2D ultrasound image streaming during procedures
  • X-ray Images - Transferring radiographic images for real-time guidance
  • Image-Guided Surgery - Displaying pre-operative images in surgical navigation systems
  • Multi-Modal Registration - Aligning images from different modalities (CT, MRI, PET)

§Supported Image Types

  • Scalar Types: 8/16/32-bit integers, 32/64-bit floating point
  • Components: 1 (grayscale), 3 (RGB), 4 (RGBA)
  • Dimensions: 2D (single slice) or 3D (volume)
  • Coordinate Systems: RAS (Right-Anterior-Superior), LPS (Left-Posterior-Superior)

§Examples

§Sending a CT Image Slice

use openigtlink_rust::protocol::types::{ImageMessage, ImageScalarType, CoordinateSystem};
use openigtlink_rust::protocol::message::IgtlMessage;
use openigtlink_rust::io::ClientBuilder;

let mut client = ClientBuilder::new()
    .tcp("127.0.0.1:18944")
    .sync()
    .build()?;

// Simulated CT data (512x512 16-bit)
let ct_data: Vec<u8> = vec![0; 512 * 512 * 2];

let image = ImageMessage::new(
    ImageScalarType::Uint16,
    [512, 512, 1],
    ct_data
)?.with_coordinate(CoordinateSystem::LPS);

let msg = IgtlMessage::new(image, "CTScanner")?;
client.send(&msg)?;

§Receiving RGB Ultrasound Image

use openigtlink_rust::io::IgtlServer;
use openigtlink_rust::protocol::types::ImageMessage;

let server = IgtlServer::bind("0.0.0.0:18944")?;
let mut client_conn = server.accept()?;

let message = client_conn.receive::<ImageMessage>()?;

println!("Received image: {}x{}x{}",
         message.content.size[0], message.content.size[1], message.content.size[2]);
println!("Scalar type: {:?}", message.content.scalar_type);
println!("Components: {}", message.content.num_components);

Structs§

ImageMessage
IMAGE message for 2D/3D medical image data

Enums§

CoordinateSystem
Coordinate system type
Endian
Endianness type
ImageScalarType
Image scalar type