Class ViewTransforms


  • public class ViewTransforms
    extends java.lang.Object
    Utility methods to create transformation for the common operations that are provided in Views.

    Warning: The transformations used in Views are always inverse to the operations that are performed by the views.

    • Constructor Detail

      • ViewTransforms

        public ViewTransforms()
    • Method Detail

      • permute

        public static Mixed permute​(int numDimensions,
                                    int fromAxis,
                                    int toAxis)
        Returns the transformation that is used by Views.permute(RandomAccessible, int, int).

        Warning: The transformations used in Views are always inverse to the operations that are performed by the views. But that's not important for this type of permutation. As the permutation stays the same when inverted.

      • hyperSlice

        public static MixedTransform hyperSlice​(int numDimensions,
                                                int d,
                                                long pos)
        Returns the transformation that is used by Views.hyperSlice(RandomAccessible, int, long).

        Warning: The transformations used in Views are always inverse to the operations that are performed by the views.

        Parameters:
        numDimensions - Number of dimensions including that dimension that is sliced / inserted.
        d - Index of that dimension that is sliced / inserted.
        pos - Position of the slice / value of the coordinate that's inserted.
        Returns:
        Transformation that inserts a coordinate at the given index.
      • translate

        public static MixedTransform translate​(long... translation)
        Returns the transformation that is used by Views.translate(RandomAccessible, long...).

        Warning: The transformation used by a view in Views is always inverse to the operation that is performed by the View.

        Therefore this method actually returns the inverse translation.

      • translateInverse

        public static MixedTransform translateInverse​(long... translation)
        Returns the transformation that is used by Views.translateInverse(RandomAccessible, long...).

        Warning: The transformation used by a view in Views is always inverse to the operation that is performed by the View.

        Therefore this method actually returns the (not inverse) translation.

      • addDimension

        public static MixedTransform addDimension​(int numDimensions)
        Returns the transformation that is used by Views.addDimension(RandomAccessible).

        Warning: The transformation used by a view in Views is always inverse to the operation that is performed by the View.

        Parameters:
        numDimensions - Number of dimensions without the coordinate that's added/removed.
        Returns:
        A transformation that removes the last coordinate.
      • invertAxis

        public static MixedTransform invertAxis​(int numDimensions,
                                                int d)
        Returns the transformation that is used by Views.invertAxis(RandomAccessible, int).

        Warning: The transformation used by a view in Views is always inverse to the operation that is performed by the View. But that's not relevant here, because inverse of an axis inversion is the axis inversion itself.

        Parameters:
        numDimensions - Number of dimensions of the coordinate space.
        d - Index of the coordinate that's inverted.
        Returns:
        Transformation that inverts the specified coordinate.