Skip to main content

MprExecutor

Trait MprExecutor 

Source
pub trait MprExecutor: Send + Sync {
    // Required methods
    fn backend(&self) -> ComputeBackend;
    fn can_handle(&self, volume_memory_mb: usize) -> bool;
    fn extract_slice(
        &self,
        volume_data: &[i16],
        dimensions: [usize; 3],
        params: &ExtractParams,
    ) -> Result<Array2<i16>, MprError>;
    fn extract_interpolated(
        &self,
        volume_data: &[i16],
        dimensions: [usize; 3],
        params: &ExtractParams,
    ) -> Result<Array2<i16>, MprError>;
    fn apply_window_level(
        &self,
        slice: &Array2<i16>,
        params: WindowLevelParams,
    ) -> Result<Vec<u8>, MprError>;

    // Provided method
    fn extract_and_window_level(
        &self,
        volume_data: &[i16],
        dimensions: [usize; 3],
        extract_params: &ExtractParams,
        wl_params: WindowLevelParams,
    ) -> Result<MprResult, MprError> { ... }
}
Expand description

Trait for MPR execution backends

Both CPU and GPU backends implement this trait.

Required Methods§

Source

fn backend(&self) -> ComputeBackend

Get the backend type

Source

fn can_handle(&self, volume_memory_mb: usize) -> bool

Check if this executor can handle the given volume

Source

fn extract_slice( &self, volume_data: &[i16], dimensions: [usize; 3], params: &ExtractParams, ) -> Result<Array2<i16>, MprError>

Extract a slice at integer index

Source

fn extract_interpolated( &self, volume_data: &[i16], dimensions: [usize; 3], params: &ExtractParams, ) -> Result<Array2<i16>, MprError>

Extract a slice with interpolation

Source

fn apply_window_level( &self, slice: &Array2<i16>, params: WindowLevelParams, ) -> Result<Vec<u8>, MprError>

Apply window/level to a slice

Provided Methods§

Source

fn extract_and_window_level( &self, volume_data: &[i16], dimensions: [usize; 3], extract_params: &ExtractParams, wl_params: WindowLevelParams, ) -> Result<MprResult, MprError>

Combined extraction and window/level (optimized path)

Implementors§