Skip to main content

ImagePreview

Struct ImagePreview 

Source
pub struct ImagePreview {
Show 27 fields pub image: u32, pub level: u32, pub source_width: u32, pub source_height: u32, pub region: Option<Region>, pub downsample: f64, pub c: Vec<u32>, pub z: Vec<u32>, pub t: Vec<u32>, pub projection: Option<String>, pub composite: bool, pub rgb: bool, pub contrast: String, pub lut: String, pub channels: Vec<PreviewChannel>, pub axes: bool, pub grid: bool, pub plot_area: Region, pub source_origin: SourcePoint, pub source_per_pixel: f64, pub source_per_pixel_y: f64, pub full_res_region: Region, pub fft_inset: Option<Region>, pub scale_bar: Option<ScaleBar>, pub view: Option<String>, pub crosshair: Option<[u32; 3]>, pub view_slices: Option<u32>,
}
Expand description

Details of an image preview.

PNG pixel (px, py) inside plot_area shows full-resolution source pixel x = source_origin.x + (px - plot_area.x) * source_per_pixel, y = source_origin.y + (py - plot_area.y) * source_per_pixel_y (left/top edges of the PNG pixel), whatever pyramid level, downsample or region was drawn; the ruler labels use the same numbers, so a region read off them can be passed straight back.

Fields§

§image: u32

Image index.

§level: u32

Pyramid level read (0 = full resolution).

§source_width: u32

Plane size at that level.

§source_height: u32

Plane height at that level.

§region: Option<Region>

The rectangle drawn, in the pixel coordinates of level, when a region was asked for.

§downsample: f64

Pixels of the plane at level per drawn pixel, horizontally: above 1 when the plane was made smaller (an area average), below 1 when it was enlarged (each source pixel drawn as a square), 1 when drawn as is.

§c: Vec<u32>

Channels, z-planes and time points used.

§z: Vec<u32>

Z indices used.

§t: Vec<u32>

Time indices used.

§projection: Option<String>

max-z or max-t for a maximum-intensity projection, sum-z or sum-t for a sum.

§composite: bool

True when channels were blended into one colour image.

§rgb: bool

True when the planes are RGB (samples_per_pixel 3).

§contrast: String

Contrast rule applied (auto resolved to what it did, e.g. percentile:0.1,99.9).

§lut: String

gray, inverted, channel-color or rgb.

§channels: Vec<PreviewChannel>

One entry per channel drawn.

§axes: bool

True when the picture is framed by coordinate rulers (labelled in full-resolution pixels), with a scale bar when the pixel size is known.

§grid: bool

True when grid lines were drawn over the data at the ruler ticks.

§plot_area: Region

The data’s rectangle inside the PNG, in PNG pixels (the whole PNG without rulers).

§source_origin: SourcePoint

Full-resolution source coordinate of the plot area’s top-left corner.

§source_per_pixel: f64

Full-resolution source pixels per PNG pixel, horizontally (pyramid level scale × downsample).

§source_per_pixel_y: f64

Full-resolution source pixels per PNG pixel, vertically (equal to source_per_pixel up to the rounding of pyramid level sizes).

§full_res_region: Region

The full-resolution (level 0) rectangle the plot area shows: pass it, or a part of it, back as region to zoom.

§fft_inset: Option<Region>

Where the power-spectrum inset is drawn (fft), in PNG pixels.

§scale_bar: Option<ScaleBar>

The scale bar drawn, when the physical pixel size is known.

§view: Option<String>

The plane of the volume shown, when it is not the stored planes: axial, coronal, sagittal, orthogonal, xz or yz. Rulers, regions and annotations then count the pixels of that view.

§crosshair: Option<[u32; 3]>

Orthogonal views: the voxel (x, y, z of the stored planes) the three planes cross at.

§view_slices: Option<u32>

With a view: how many slices it has (the range of z).

Implementations§

Source§

impl ImagePreview

Source

pub fn pixel_mapping(&self) -> String

How to turn a pixel of a picture without rulers into full-resolution coordinates, for a region: its pixels are not source pixels once the plane is scaled or framed.

Trait Implementations§

Source§

impl Clone for ImagePreview

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImagePreview

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImagePreview

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ImagePreview

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for ImagePreview

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for ImagePreview

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.