Skip to main content

ScatterMaskWidget

Struct ScatterMaskWidget 

Source
pub struct ScatterMaskWidget {
    pub mask: Vec<u8>,
    pub level: u8,
    /* private fields */
}
Expand description

A multi-level mask over scatter points, selected by point index.

Mirrors silx ScatterMask: a 1D uint8 array the same length as the scatter data, where 0 means unmasked and 1..=255 are the (up to 254) non-overlapping mask levels.

Fields§

§mask: Vec<u8>

Per-point mask level: 0 is unmasked, 1..=255 is a mask level. The length equals the number of scatter points.

§level: u8

Current mask level edited by the tools (silx levelSpinBox, range 1..=255).

Implementations§

Source§

impl ScatterMaskWidget

Source

pub fn new(npoints: usize) -> Self

Create a scatter mask for npoints points, all initially unmasked.

Source

pub fn len(&self) -> usize

Number of points covered by the mask.

Source

pub fn is_empty(&self) -> bool

Whether the mask covers zero points.

Source

pub fn reset_len(&mut self, npoints: usize)

Reset the mask to npoints points and clear it.

Mirrors silx reset(shape): a length change resets the undo history.

Source

pub fn clear(&mut self)

Set all points of the current level back to 0.

Mirrors silx BaseMask.clear(level).

Source

pub fn clear_all(&mut self)

Clear every mask level (reset the whole mask to 0).

Mirrors silx resetSelectionMask.

Source

pub fn invert(&mut self)

Invert the current mask level over all points.

0 points become the current level and current-level points become 0; points at other levels are untouched. Mirrors silx BaseMask.invert(level).

Source

pub fn commit(&mut self)

Commit the current mask to the undo history.

Mirrors silx BaseMask.commit.

Source

pub fn undo(&mut self) -> bool

Restore the previous mask snapshot, if any. Returns true if applied.

Mirrors silx BaseMask.undo.

Source

pub fn redo(&mut self) -> bool

Restore the most recently undone snapshot, if any. Returns true if applied.

Mirrors silx BaseMask.redo.

Source

pub fn reset_history(&mut self)

Reset the undo history to the current mask as the only baseline.

Mirrors silx BaseMask.resetHistory.

Source

pub fn can_undo(&self) -> bool

Whether an undo is currently possible (silx sigUndoable).

Source

pub fn can_redo(&self) -> bool

Whether a redo is currently possible (silx sigRedoable).

Source

pub fn update_points(&mut self, level: u8, indices: &[usize], mask: bool)

Mask or unmask the points at the given indices at level.

Mirrors silx ScatterMask.updatePoints (ScatterMaskToolsWidget.py:89): when mask is true the points are set to level; otherwise only points already at level and in indices are cleared. Indices outside the buffer are ignored.

Source

pub fn update_stencil(&mut self, level: u8, stencil: &[bool], mask: bool)

Mask or unmask points selected by a per-point boolean stencil at level.

Mirrors silx BaseMask.updateStencil (_BaseMaskToolsWidget.py:249): when mask is true the stencil-true points are set to level, otherwise only points already at level and stencil-true are cleared. stencil must be the same length as the mask.

Source

pub fn update_disk( &mut self, level: u8, center: (f32, f32), radius: f32, x: &[f32], y: &[f32], )

Mask points inside a disk of the given radius centered at center = (cx, cy).

Mirrors silx ScatterMask.updateDisk (ScatterMaskToolsWidget.py:137): the stencil is (y - cy)^2 + (x - cx)^2 < radius^2 (strict). x and y are the point coordinate arrays (same length as the mask).

Source

pub fn update_disk_with_mask( &mut self, level: u8, center: (f32, f32), radius: f32, x: &[f32], y: &[f32], mask: bool, )

update_disk with an explicit mask/unmask flag. center = (cx, cy).

Source

pub fn update_polygon( &mut self, level: u8, vertices: &[(f32, f32)], x: &[f32], y: &[f32], mask: bool, )

Mask or unmask points inside a polygon at level.

Mirrors silx ScatterMask.updatePolygon (ScatterMaskToolsWidget.py:107): a Polygon.is_inside(y, x) test per point. vertices are (y, x) corners (matching the silx call site, which passes plot (y, x)); x and y are the point coordinate arrays.

Source

pub fn update_rectangle( &mut self, level: u8, anchor: (f32, f32), size: (f32, f32), px: &[f32], py: &[f32], mask: bool, )

Mask or unmask points inside a rectangle at level.

Mirrors silx ScatterMask.updateRectangle (ScatterMaskToolsWidget.py:124): the rectangle is built as the 4-vertex polygon [(y, x), (y+height, x), (y+height, x+width), (y, x+width)] then the polygon test is applied. anchor = (y, x) is the bottom-left corner and size = (height, width); px/py are the point coordinate arrays.

Source

pub fn update_below_threshold( &mut self, level: u8, values: &[f32], threshold: f32, mask: bool, )

Mask or unmask points whose value is below threshold at level.

Mirrors silx BaseMask.updateBelowThreshold over the scatter value array (values < threshold).

Source

pub fn update_between_thresholds( &mut self, level: u8, values: &[f32], min: f32, max: f32, mask: bool, )

Mask or unmask points whose value is within [min, max] at level.

Mirrors silx BaseMask.updateBetweenThresholds (min <= value <= max, inclusive).

Source

pub fn update_above_threshold( &mut self, level: u8, values: &[f32], threshold: f32, mask: bool, )

Mask or unmask points whose value is above threshold at level.

Mirrors silx BaseMask.updateAboveThreshold (value > threshold).

Source

pub fn mask_not_finite(&mut self, values: &[f32])

Mask every point whose value is not finite (NaN or +/-infinity) at the current level.

Mirrors silx _BaseMaskToolsWidget.updateNotFinite over the scatter value array (~numpy.isfinite(values)).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,