public final class Resolution extends Object implements Serializable
i.e. what a single voxel represents in physical units (meters) in x, y, z dimensions.
This class is immutable.
Constructor and Description |
---|
Resolution()
Creates with a default resolution with value 1.0 in each dimension.
|
Resolution(double x,
double y,
double z)
Creates with a resolution from three double values for each dimension.
|
Resolution(Tuple3d tuple)
Constructs a resolution from a tuple.
|
Modifier and Type | Method and Description |
---|---|
static Resolution |
createWithXY(double xy)
Creates with only XY resolution, identical in both dimensions.
|
static Resolution |
createWithXYAndZ(double xy,
double z)
Creates with XY resolution and Z resolution.
|
boolean |
equals(Object o) |
int |
hashCode() |
Resolution |
scaleXY(ScaleFactor scaleFactor)
Multiplies the X and Y components of the resolution by a factor.
|
String |
toString() |
double |
unitArea()
Multiplying the X- and Y- resolution values together.
|
UnitConverter |
unitConvert()
Converts voxelized measurements to/from physical units.
|
double |
unitVolume()
Multiplying the X- and Y- and Z- resolution values together.
|
double |
valueByDimension(Axis axis)
A component of the tuple corresponding to a particular axis.
|
double |
valueByDimension(int dimensionIndex)
A component of a resolution corresponding to a particular dimension by index.
|
double |
x()
The resolution in the X-dimension in meters.
|
double |
y()
The resolution in the Y-dimension in meters.
|
double |
z()
The resolution in the Z-dimension in meters.
|
double |
zIfDefined(double fallback)
Returns the z-resolution like
z() if the z-resolution is not Double.NaN . |
double |
zRelative()
Gives the relative resolution of the z-component to the x-component.
|
public Resolution()
public Resolution(double x, double y, double z) throws CreateException
Note all dimensions must have positive (i.e. non-zero) resolution.
X and Y are not allowed have NaN but this is acceptable for the Z-value.
x
- the resolution for the X-dimension.y
- the resolution for the Y-dimension.z
- the resolution for the Z-dimension.CreateException
- if a non-positive value is passed, or a Double.NaN
for the X
or Y components.public Resolution(Tuple3d tuple) throws CreateException
Note all dimensions must have positive (i.e. non-zero) resolution.
X and Y are not allowed have NaN but this is acceptable for the Z-value.
tuple
- the resolution for X, Y and Z.CreateException
- if a non-positive value is passed, or a Double.NaN
for the X
or Y components.public static Resolution createWithXY(double xy)
Z-resolution is considered unknown.
xy
- the resolution in meters for both x and y dimension.public static Resolution createWithXYAndZ(double xy, double z)
The X and Y resolution is considered identical in both dimensions.
xy
- the resolution in meters for both x and y dimension.z
- the resolution in meters for the z dimension.public double x()
public double y()
public double z()
Double.NaN
if it is not defined.public double zIfDefined(double fallback)
z()
if the z-resolution is not Double.NaN
.
Otherwise returns fallback
.
fallback
- the value to return if the z-resolution is Double.NaN
.Double.NaN
) or fallback
.public double unitVolume()
Double.NaN
if the Z-resolution is undefined.public double unitArea()
public Resolution scaleXY(ScaleFactor scaleFactor)
This is an immutable operation.
scaleFactor
- the factor to multiply each dimension by.Resolution
that is the result of the scaling.public UnitConverter unitConvert()
public double zRelative()
public final double valueByDimension(int dimensionIndex)
dimensionIndex
- the index corresponding to an axis, as per AxisConverter
.public final double valueByDimension(Axis axis)
axis
- the axis.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.