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§
Sourcefn backend(&self) -> ComputeBackend
fn backend(&self) -> ComputeBackend
Get the backend type
Sourcefn can_handle(&self, volume_memory_mb: usize) -> bool
fn can_handle(&self, volume_memory_mb: usize) -> bool
Check if this executor can handle the given volume
Sourcefn extract_slice(
&self,
volume_data: &[i16],
dimensions: [usize; 3],
params: &ExtractParams,
) -> Result<Array2<i16>, MprError>
fn extract_slice( &self, volume_data: &[i16], dimensions: [usize; 3], params: &ExtractParams, ) -> Result<Array2<i16>, MprError>
Extract a slice at integer index
Sourcefn extract_interpolated(
&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>
Extract a slice with interpolation
Sourcefn apply_window_level(
&self,
slice: &Array2<i16>,
params: WindowLevelParams,
) -> Result<Vec<u8>, MprError>
fn apply_window_level( &self, slice: &Array2<i16>, params: WindowLevelParams, ) -> Result<Vec<u8>, MprError>
Apply window/level to a slice
Provided Methods§
Sourcefn extract_and_window_level(
&self,
volume_data: &[i16],
dimensions: [usize; 3],
extract_params: &ExtractParams,
wl_params: WindowLevelParams,
) -> Result<MprResult, MprError>
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)