Class FindCommonVoxelType
Object
org.anchoranalysis.image.voxel.datatype.FindCommonVoxelType
public class FindCommonVoxelType extends Object
Finds a common voxel-data type to represent two types.
This usually either the class themselves or a type that is minimally larger, and can represent both types without loss of precision.
An exception is the float-type that takes precedence over all others, and this may lead to loss of precision.
- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static Optional<VoxelDataType>commonType(Stream<VoxelDataType> stream)Finds a common type to represent (ideally without loss of precision} of a stream of types.static VoxelDataTypecommonType(VoxelDataType first, VoxelDataType second)Finds a common type to represent (ideally without loss of precision} bothfirstandsecond.
-
Method Details
-
commonType
Finds a common type to represent (ideally without loss of precision} of a stream of types.- Parameters:
stream- a stream of types to find a common representation for.- Returns:
- a type that can represent all types (think of it as a minimal superset of all types),
or
Optional.empty()if the stream has no elements.
-
commonType
Finds a common type to represent (ideally without loss of precision} bothfirstandsecond.- Parameters:
first- the first-type that must be represented in the common typesecond- the second-type that must be represented in the common type- Returns:
- a type that can represent both (think of it as a minimal superset of both types).
-