Class Intervals
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FinalIntervaladdDimension(Interval interval, long minOfNewDim, long maxOfNewDim) Create new interval by adding a dimension to the sourceInterval.static final booleanTest whether thecontaininginterval completely contains thecontainedinterval.static booleancontains(Interval containing, Localizable contained) Test whether thecontaininginterval contains thecontainedpoint.static final booleancontains(RealInterval containing, RealInterval contained) Test whether thecontaininginterval completely contains thecontainedinterval.static booleancontains(RealInterval containing, RealLocalizable contained) Test whether thecontaininginterval contains thecontainedpoint.static FinalIntervalcreateMinMax(long... minmax) Create aFinalIntervalfrom a parameter list comprising minimum and maximum coordinates.static FinalRealIntervalcreateMinMaxReal(double... minmax) Create aFinalRealIntervalfrom a parameter list comprising minimum and maximum coordinates.static FinalIntervalcreateMinSize(long... minsize) Create aFinalIntervalfrom a parameter list comprising minimum coordinates and size.static FinalRealIntervalcreateMinSizeReal(double... minsize) Deprecated.static int[]dimensionsAsIntArray(Dimensions dimensions) Create aint[]with the dimensions of anInterval.static long[]dimensionsAsLongArray(Dimensions dimensions) Create along[]with the dimensions of aDimensions.static booleanTests whether twoDimensionshave the same size.static booleanequalDimensions(Interval a, Interval b) Deprecated.static booleanTests whether two intervals are equal in their min / max.static booleanequals(RealInterval a, RealInterval b) Tests whether twoRealIntervals are equal in their min / max.static booleanequals(RealInterval a, RealInterval b, double tolerance) Tests whether twoRealIntervals are equal in their min / max.static FinalIntervalGrow/shrink an interval in all dimensions.static FinalIntervalGrow/shrink an interval in all dimensions.static FinalIntervalGrow/shrink an interval in one dimensions.static FinalIntervalexpand(Interval interval, Dimensions border) Grow/shrink an interval in all dimensions.static FinalIntervalhyperSlice(Interval interval, int d) Take a (n-1)-dimensional slice of a n-dimensional interval, dropping the d axis.static FinalIntervalCompute the intersection of two intervals.static FinalRealIntervalintersect(RealInterval intervalA, RealInterval intervalB) Compute the intersection of two intervals.static FinalIntervalinvertAxis(Interval interval, int d) Invert the bounds on the d-axis of the given intervalstatic booleanCheck whether the given interval is empty, that is, the maximum is smaller than the minimum in some dimension.static booleanisEmpty(RealInterval interval) Check whether the given interval is empty, that is, the maximum is smaller than the minimum in some dimension.static IntervalCompute the largestIntervalthat is contained in the specifiedRealInterval.static double[]maxAsDoubleArray(RealInterval interval) Create adouble[]with the maximum of aRealInterval.static int[]maxAsIntArray(Interval interval) Create aint[]with the maximum of anInterval.static long[]maxAsLongArray(Interval interval) Create along[]with the maximum of anInterval.static double[]minAsDoubleArray(RealInterval interval) Create adouble[]with the minimum of aRealInterval.static int[]minAsIntArray(Interval interval) Create aint[]with the minimum of anInterval.static long[]minAsLongArray(Interval interval) Create along[]with the minimum of anInterval.static FinalIntervalCreate an interval with permuted axes.static longnumElements(int... dimensions) Compute the number of elements contained in an (integer) interval.static longnumElements(long... dimensions) Compute the number of elements contained in an (integer) interval.static longnumElements(Dimensions interval) Compute the number of elements contained in an (integer)Interval.static FinalIntervalpermuteAxes(Interval interval, int fromAxis, int toAxis) Create an interval with permuted axes.static RandomAccessibleInterval<Localizable> Returns an image, where each pixel value is the position of the pixel represented asLocalizable.static FinalIntervalCreate an interval that is rotated by 90 degrees.static RealIntervalscale(RealInterval interval, double scale) Return anRealIntervalthat is scaled by the given factor.static IntervalCompute the smallestIntervalcontaining the specifiedRealInterval.static StringtoString(Dimensions value) Converts theDimensionsinto a string.static StringReturns a string that contains min, max and the dimensions of theInterval.static StringtoString(RealInterval value) Returns a string that contains min and max of theRealInterval.static FinalIntervalTranslate an interval.static FinalIntervalTranslate an interval in one dimension.static FinalIntervaltranslateInverse(Interval interval, long... translation) Translate an interval by-translation.static FinalIntervalCompute the smallest interval that contains both input intervals.static FinalRealIntervalunion(RealInterval intervalA, RealInterval intervalB) Compute the smallest interval that contains both input intervals.static FinalIntervalunionUnsafe(Interval intervalA, Interval intervalB) Compute the smallest interval that contains both input intervals.static FinalRealIntervalunionUnsafe(RealInterval intervalA, RealInterval intervalB) Compute the smallest interval that contains both input intervals.static FinalIntervalReturns anIntervalwith the same dimensions as the given interval, but min is all zero.
-
Constructor Details
-
Intervals
public Intervals()
-
-
Method Details
-
createMinSize
Create aFinalIntervalfrom a parameter list comprising minimum coordinates and size. For example, to create a 2D interval from (10, 10) to (20, 40) use createMinSize( 10, 10, 11, 31 ).- Parameters:
minsize- a list of 2*n parameters to create a n -dimensional interval. The first n parameters specify the minimum of the interval, the next n parameters specify the dimensions of the interval.- Returns:
- interval with the specified boundaries
-
createMinMax
Create aFinalIntervalfrom a parameter list comprising minimum and maximum coordinates. For example, to create a 2D interval from (10, 10) to (20, 40) use createMinMax( 10, 10, 20, 40 ).- Parameters:
minmax- a list of 2*n parameters to create a n -dimensional interval. The first n parameters specify the minimum of the interval, the next n parameters specify the maximum of the interval.- Returns:
- interval with the specified boundaries
-
createMinSizeReal
Deprecated.THIS METHOD WILL BE REMOVED IN A FUTURE RELEASE. It was mistakenly introduced, analogous tocreateMinSize(long...)for integer intervals. Dimension is not defined forRealIntervaland computing the max as min + dim - 1 does not make sense.Create a
FinalRealIntervalfrom a parameter list comprising minimum coordinates and size. For example, to create a 2D interval from (10, 10) to (20, 40) use createMinSize( 10, 10, 11, 31 ).- Parameters:
minsize- a list of 2*n parameters to create a n -dimensional interval. The first n parameters specify the minimum of the interval, the next n parameters specify the dimensions of the interval.- Returns:
- interval with the specified boundaries
-
createMinMaxReal
Create aFinalRealIntervalfrom a parameter list comprising minimum and maximum coordinates. For example, to create a 2D interval from (10, 10) to (20, 40) use createMinMax( 10, 10, 20, 40 ).- Parameters:
minmax- a list of 2*n parameters to create a n -dimensional interval. The first n parameters specify the minimum of the interval, the next n parameters specify the maximum of the interval.- Returns:
- interval with the specified boundaries
-
expand
Grow/shrink an interval in all dimensions. Create aFinalInterval, which is the input interval plus border pixels on every side, in every dimension.- Parameters:
interval- the input intervalborder- how many pixels to add on every side- Returns:
- expanded interval
-
expand
Grow/shrink an interval in all dimensions. Create aFinalInterval, which is the input interval plus border pixels on every side, in every dimension.- Parameters:
interval- the input intervalborder- how many pixels to add on every side- Returns:
- expanded interval
-
expand
Grow/shrink an interval in all dimensions. Create aFinalInterval, which is the input interval plus border pixels on every side, in every dimension.- Parameters:
interval- the input intervalborder- how many pixels to add on every side- Returns:
- expanded interval
-
expand
Grow/shrink an interval in one dimensions. Create aFinalInterval, which is the input interval plus border pixels on every side, in dimension d.- Parameters:
interval- the input intervalborder- how many pixels to add on every sided- in which dimension- Returns:
- expanded interval
-
translate
Translate an interval in one dimension. Create aFinalInterval, which is the input interval shifted by t in dimension d.- Parameters:
interval- the input intervalt- by how many pixels to shift the intervald- in which dimension- Returns:
- translated interval
-
translate
Translate an interval. Create aFinalInterval, which is the input interval shifted bytranslation.- Parameters:
interval- the input intervaltranslation- by how many pixels to shift the interval- Returns:
- translated interval
-
translateInverse
Translate an interval by-translation. Create aFinalInterval, which is the input interval shifted by-translation.- Parameters:
interval- the input intervaltranslation- by how many pixels to inverse-shift the interval- Returns:
- translated interval
-
addDimension
Create new interval by adding a dimension to the sourceInterval. TheIntervalboundaries in the additional dimension are set to the specified values. The additional dimension is the last dimension.- Parameters:
interval- the original intervalminOfNewDim- Interval min in the additional dimension.maxOfNewDim- Interval max in the additional dimension.
-
invertAxis
Invert the bounds on the d-axis of the given interval- Parameters:
interval- the sourced- the axis to invert
-
hyperSlice
Take a (n-1)-dimensional slice of a n-dimensional interval, dropping the d axis. -
moveAxis
Create an interval with permuted axes. ThefromAxisis moved totoAxis, while the order of the other axes is preserved. If fromAxis=2 and toAxis=4, and axis order ofintervalwas XYCZT, then an interval with axis order XYZTC would be created. -
permuteAxes
Create an interval with permuted axes. fromAxis and toAxis are swapped. If fromAxis=0 and toAxis=2, this means that the X-axis of the source interval is mapped to the Z-Axis of the permuted interval and vice versa. For a XYZ source, a ZYX interval would be created. -
rotate
Create an interval that is rotated by 90 degrees. The rotation is specified by the fromAxis and toAxis arguments. If fromAxis=0 and toAxis=1, this means that the X-axis of the source interval is mapped to the Y-Axis of the rotated interval. That is, it corresponds to a 90 degree clock-wise rotation of the source interval in the XY plane. fromAxis=1 and toAxis=0 corresponds to a counter-clock-wise rotation in the XY plane. -
zeroMin
Returns anIntervalwith the same dimensions as the given interval, but min is all zero. -
scale
Return anRealIntervalthat is scaled by the given factor. -
intersect
Compute the intersection of two intervals. Create aFinalInterval, which is the intersection of the input intervals (i.e., the area contained in both input intervals).- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- intersection of input intervals
-
intersect
Compute the intersection of two intervals. Create aRealInterval, which is the intersection of the input intervals (i.e., the area contained in both input intervals).- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- intersection of input intervals
-
unionUnsafe
Compute the smallest interval that contains both input intervals. Create aFinalIntervalthat represents that interval. May produce unexpected results for emptyIntervals. Useunion(Interval, Interval)if either input interval could be empty.- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- union of input intervals
-
union
Compute the smallest interval that contains both input intervals. Create aFinalIntervalthat represents that interval.- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- union of input intervals
-
unionUnsafe
Compute the smallest interval that contains both input intervals. Create aRealIntervalthat represents that interval. May produce unexpected results for emptyRealIntervals. Useunion(RealInterval, RealInterval)if either input interval could be empty.- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- union of input intervals
-
union
Compute the smallest interval that contains both input intervals. Create aRealIntervalthat represents that interval.- Parameters:
intervalA- input intervalintervalB- input interval- Returns:
- union of input intervals
-
smallestContainingInterval
Compute the smallestIntervalcontaining the specifiedRealInterval.- Parameters:
ri- input interval.- Returns:
- the smallest integer interval that completely contains the input interval.
-
largestContainedInterval
Compute the largestIntervalthat is contained in the specifiedRealInterval.- Parameters:
ri- input interval.- Returns:
- the largest integer interval that is completely contained in the input interval.
-
isEmpty
Check whether the given interval is empty, that is, the maximum is smaller than the minimum in some dimension.- Parameters:
interval- interval to check- Returns:
- true when the interval is empty, that is, the maximum is smaller than the minimum in some dimension.
-
isEmpty
Check whether the given interval is empty, that is, the maximum is smaller than the minimum in some dimension.- Parameters:
interval- interval to check- Returns:
- true when the interval is empty, that is, the maximum is smaller than the minimum in some dimension.
-
contains
Test whether thecontaininginterval contains thecontainedpoint. The interval is closed, that is, boundary points are contained.- Returns:
- true, iff
containedis incontaining.
-
contains
Test whether thecontaininginterval contains thecontainedpoint. The interval is closed, that is, boundary points are contained.- Returns:
- true, iff
containedis incontaining.
-
contains
-
contains
Test whether thecontaininginterval completely contains thecontainedinterval. -
numElements
Compute the number of elements contained in an (integer)Interval.- Returns:
- number of elements in
interval.
-
numElements
public static long numElements(int... dimensions) Compute the number of elements contained in an (integer) interval.- Parameters:
dimensions- dimensions of the interval.- Returns:
- number of elements in the interval.
-
numElements
public static long numElements(long... dimensions) Compute the number of elements contained in an (integer) interval.- Parameters:
dimensions- dimensions of the interval.- Returns:
- number of elements in the interval.
-
equals
-
equals
Tests whether twoRealIntervals are equal in their min / max. -
equals
Tests whether twoRealIntervals are equal in their min / max. With respect to the given tolerance. -
equalDimensions
Tests whether twoDimensionshave the same size. -
equalDimensions
Deprecated.Tests whether two intervals have equal dimensions (same size). -
dimensionsAsLongArray
Create along[]with the dimensions of aDimensions.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See
Dimensions.dimensions(long[]).Consider using the more convenient
Dimensions.dimensionsAsLongArray(). This method may be deprecated in a future release.- Parameters:
dimensions- something which has dimensions- Returns:
- dimensions as a new
long[]
-
dimensionsAsIntArray
Create aint[]with the dimensions of anInterval.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly.
- Parameters:
dimensions- something which has dimensions- Returns:
- dimensions as a new
int[]
-
minAsLongArray
Create along[]with the minimum of anInterval.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See
Interval.min(long[]).Consider using the more convenient
Interval.minAsLongArray(). This method may be deprecated in a future release.- Parameters:
interval- something with interval boundaries- Returns:
- minimum as a new
long[]
-
minAsIntArray
-
maxAsLongArray
Create along[]with the maximum of anInterval.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See
Interval.max(long[]).Consider using the more convenient
Interval.maxAsLongArray(). This method may be deprecated in a future release.- Parameters:
interval- something with interval boundaries- Returns:
- maximum as a new
long[]
-
maxAsIntArray
-
maxAsDoubleArray
Create adouble[]with the maximum of aRealInterval.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See
RealInterval.realMax(double[]).Consider using the more convenient
RealInterval.maxAsDoubleArray(). This method may be deprecated in a future release.- Parameters:
interval- something with interval boundaries- Returns:
- maximum as a new double[]
-
minAsDoubleArray
Create adouble[]with the minimum of aRealInterval.Keep in mind that creating arrays wildly is not good practice and consider using the interval directly. See
RealInterval.realMin(double[]).Consider using the more convenient
RealInterval.minAsDoubleArray()This method may be deprecated in a future release.- Parameters:
interval- something with interval boundaries- Returns:
- minimum as a new double[]
-
positions
Returns an image, where each pixel value is the position of the pixel represented asLocalizable.- Parameters:
interval- Interval of the returned image.
-
toString
-
toString
Returns a string that contains min and max of theRealInterval. -
toString
Converts theDimensionsinto a string.
-