pub struct ImageMessage {
pub version: u16,
pub num_components: u8,
pub scalar_type: ImageScalarType,
pub endian: Endian,
pub coordinate: CoordinateSystem,
pub size: [u16; 3],
pub matrix: [[f32; 4]; 3],
pub data: Vec<u8>,
}
Expand description
IMAGE message for 2D/3D medical image data
§OpenIGTLink Specification
- Message type: “IMAGE”
- Header: VERSION (uint16) + NUM_COMPONENTS (uint8) + SCALAR_TYPE (uint8) + ENDIAN (uint8) + COORD (uint8) + SIZE (
uint16[3]
) + MATRIX (float32[12]
) - Header size: 2 + 1 + 1 + 1 + 1 + 6 + 48 = 60 bytes
- Followed by image data
Fields§
§version: u16
Protocol version (should be 1 or 2)
num_components: u8
Number of components (1=scalar, 3=RGB, 4=RGBA)
scalar_type: ImageScalarType
Scalar type
endian: Endian
Endianness of image data
coordinate: CoordinateSystem
Coordinate system
size: [u16; 3]
Image size [columns, rows, slices]
matrix: [[f32; 4]; 3]
4x3 transformation matrix (stored row-major, upper 3x4 of 4x4 matrix)
data: Vec<u8>
Image data (raw bytes)
Implementations§
Source§impl ImageMessage
impl ImageMessage
Sourcepub fn new(
scalar_type: ImageScalarType,
size: [u16; 3],
data: Vec<u8>,
) -> Result<Self>
pub fn new( scalar_type: ImageScalarType, size: [u16; 3], data: Vec<u8>, ) -> Result<Self>
Create a new IMAGE message
Sourcepub fn rgb(
scalar_type: ImageScalarType,
size: [u16; 3],
data: Vec<u8>,
) -> Result<Self>
pub fn rgb( scalar_type: ImageScalarType, size: [u16; 3], data: Vec<u8>, ) -> Result<Self>
Create with RGB components
Sourcepub fn with_matrix(self, matrix: [[f32; 4]; 3]) -> Self
pub fn with_matrix(self, matrix: [[f32; 4]; 3]) -> Self
Set transformation matrix
Sourcepub fn with_coordinate(self, coordinate: CoordinateSystem) -> Self
pub fn with_coordinate(self, coordinate: CoordinateSystem) -> Self
Set coordinate system
Sourcepub fn num_pixels(&self) -> usize
pub fn num_pixels(&self) -> usize
Get total number of pixels
Trait Implementations§
Source§impl Clone for ImageMessage
impl Clone for ImageMessage
Source§fn clone(&self) -> ImageMessage
fn clone(&self) -> ImageMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ImageMessage
impl Debug for ImageMessage
Source§impl Message for ImageMessage
impl Message for ImageMessage
Source§impl PartialEq for ImageMessage
impl PartialEq for ImageMessage
impl StructuralPartialEq for ImageMessage
Auto Trait Implementations§
impl Freeze for ImageMessage
impl RefUnwindSafe for ImageMessage
impl Send for ImageMessage
impl Sync for ImageMessage
impl Unpin for ImageMessage
impl UnwindSafe for ImageMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more