Doesn't copy the subspaces, rather provides HyperstackUtils.Subspace objects, which
contain a RandomAccessibleInterval that can be used to traverse a
certain subspace. Each HyperstackUtils.Subspace also contains metadata, which locates
the subspace in the hyperspace.
The code works for now, but a refactor is in place if/when ImgPlus
API changes or is replaced by another metadata rich class.
If you want to split a hyperspace into {X, Y, T} subspaces, and the hyperspace has more than one time dimension, *all* of the time dimensions will be lumped into {X, Y, T1, T2, .. Tn} subspaces. That is, instead of {X, Y, T1}, {X, Y, T2}, .. {X, Y, Tn}.
- Author:
- Richard Domander
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHyperstackUtils.Subspace<T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>>A class which stores a subspace interval of an n-dimensional hyperspace, and metadata -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>>
Stream<HyperstackUtils.Subspace<T>> split3DSubspaces(net.imagej.ImgPlus<T> hyperStack) Splits the hyperstack into {X, Y, Z} subspaces.static <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>>
Stream<HyperstackUtils.Subspace<T>> splitSubspaces(net.imagej.ImgPlus<T> hyperStack, Collection<net.imagej.axis.AxisType> subspaceTypes) Splits the hyperstack into subspaces defined by the given axes.
-
Method Details
-
split3DSubspaces
public static <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>> Stream<HyperstackUtils.Subspace<T>> split3DSubspaces(net.imagej.ImgPlus<T> hyperStack) Splits the hyperstack into {X, Y, Z} subspaces.- Type Parameters:
T- type of the elements in the image.- Parameters:
hyperStack- an N-dimensional image.- Returns:
- a stream of all the subspaces found.
- See Also:
-
splitSubspaces
public static <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>> Stream<HyperstackUtils.Subspace<T>> splitSubspaces(net.imagej.ImgPlus<T> hyperStack, Collection<net.imagej.axis.AxisType> subspaceTypes) Splits the hyperstack into subspaces defined by the given axes.If all the given axis types are not found in the hyperstack, gives subspaces of the found types. If none of the types are found, returns an empty stream. For example, if you want to split a {X, Y, C, T} hyperstack into {X, Y, Z}, returns all the {X, Y} subspaces.
NB Assumes that the given
ImgPlushas the necessary metadata, i.e. itsCalibratedAxishaveAxisType.- Type Parameters:
T- type of the elements in the image.- Parameters:
hyperStack- an N-dimensional image.subspaceTypes- the types of the axis in the desired subspace.- Returns:
- a stream of all the subspaces found.
-