pub enum ComplexMode {
Absolute,
Phase,
Real,
Imaginary,
SquareAmplitude,
Log10Amplitude,
AmplitudePhase,
Log10AmplitudePhase,
}Expand description
Visualization mode for complex data (2D image or 3D field).
Mirrors ComplexMixIn.ComplexMode in silx. Each scalar mode maps a complex
sample (re, im) to a single f32 via ComplexMode::to_scalar;
ComplexMode::AmplitudePhase instead produces an RGBA composite.
silx exposes ABSOLUTE, PHASE, REAL, IMAGINARY, SQUARE_AMPLITUDE,
AMPLITUDE_PHASE, and LOG10_AMPLITUDE_PHASE. The first six are mirrored
directly; Log10Amplitude here is the scalar log10(|z|) map (silx only
uses log10 amplitude inside its RGBA LOG10_AMPLITUDE_PHASE composite).
Variants§
Absolute
|z| — the absolute value (numpy.absolute).
Phase
angle(z) — the phase in [-pi, pi] (numpy.angle).
Real
re(z) — the real part.
Imaginary
im(z) — the imaginary part.
SquareAmplitude
|z|^2 — the square amplitude (numpy.absolute(z) ** 2).
Log10Amplitude
log10(|z|) — the base-10 log of the amplitude.
AmplitudePhase
HSV composite: hue from the phase, value from the linearly normalized
amplitude (silx AMPLITUDE_PHASE).
Log10AmplitudePhase
HSV composite: hue from the phase, value from the log10-normalized
amplitude over a settable displayed range (silx LOG10_AMPLITUDE_PHASE,
see crate::widget::complex_image_view::amplitude_phase_log_rgba).
Implementations§
Source§impl ComplexMode
impl ComplexMode
Sourcepub const ALL: [ComplexMode; 8]
pub const ALL: [ComplexMode; 8]
All modes in the silx menu order, for building a picker.
Sourcepub fn is_rgba(self) -> bool
pub fn is_rgba(self) -> bool
true for modes whose displayed image is an RGBA composite rather than a
colormapped scalar (ComplexMode::AmplitudePhase and
ComplexMode::Log10AmplitudePhase).
Sourcepub fn to_scalar(self, re: f32, im: f32) -> f32
pub fn to_scalar(self, re: f32, im: f32) -> f32
Convert a complex sample (re, im) to the scalar shown by this mode.
Faithful to silx ImageComplexData.__convertComplexData:
Absolute→hypot(re, im)=numpy.absolutePhase→atan2(im, re)=numpy.angleReal→reImaginary→imSquareAmplitude→re^2 + im^2=numpy.absolute(z) ** 2Log10Amplitude→log10(hypot(re, im))
Returns 0.0 for the RGBA composite modes
(ComplexMode::AmplitudePhase / ComplexMode::Log10AmplitudePhase),
which have no scalar representation.
Trait Implementations§
Source§impl Clone for ComplexMode
impl Clone for ComplexMode
Source§fn clone(&self) -> ComplexMode
fn clone(&self) -> ComplexMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ComplexMode
Source§impl Debug for ComplexMode
impl Debug for ComplexMode
impl Eq for ComplexMode
Source§impl PartialEq for ComplexMode
impl PartialEq for ComplexMode
Source§fn eq(&self, other: &ComplexMode) -> bool
fn eq(&self, other: &ComplexMode) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ComplexMode
Auto Trait Implementations§
impl Freeze for ComplexMode
impl RefUnwindSafe for ComplexMode
impl Send for ComplexMode
impl Sync for ComplexMode
impl Unpin for ComplexMode
impl UnsafeUnpin for ComplexMode
impl UnwindSafe for ComplexMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.