Class ComponentMappingTransform

java.lang.Object
net.imglib2.transform.integer.AbstractMixedTransform
net.imglib2.transform.integer.ComponentMappingTransform
All Implemented Interfaces:
Concatenable<ComponentMapping>, PreConcatenable<ComponentMapping>, BoundingBoxTransform, ComponentMapping, Mixed, Transform

public class ComponentMappingTransform extends AbstractMixedTransform implements ComponentMapping, Concatenable<ComponentMapping>, PreConcatenable<ComponentMapping>
Map the components of the source vector to obtain the target vector, for instance transform (x,y,z) to (x,z,y).

The intended use of ComponentMapping is as a dimension permutation. The mapping is implemented as a inverse lookup, i.e., every component of the target is read from a source component. Note, that it is not allowed to set this array such that a source component is mapped to several target components!

Author:
Tobias Pietzsch
  • Field Details

    • component

      protected final int[] component
      for each component of the target vector: from which source vector component should it be taken.
  • Constructor Details

    • ComponentMappingTransform

      public ComponentMappingTransform(int targetDim)
    • ComponentMappingTransform

      public ComponentMappingTransform(int[] component)
      Parameters:
      component - array specifying for each component of the target vector from which source vector component should it be taken.
  • Method Details

    • getComponentMapping

      public void getComponentMapping(int[] component)
      Description copied from interface: Mixed
      Get an array indicating for each target dimensions from which source dimension it is taken.

      For instance, if the transform maps 2D (x,y) coordinates to the first two components of a 3D (x,y,z) coordinate, the result will be [0, 1, x]. Here, the value of x is undefined because the third target dimension does not correspond to any source dimension. See Mixed.getComponentZero(boolean[]).

      Specified by:
      getComponentMapping in interface Mixed
      Overrides:
      getComponentMapping in class AbstractMixedTransform
      Parameters:
      component - array of size at least the target dimension to store the result.
    • getComponentMapping

      public int getComponentMapping(int d)
      Description copied from interface: Mixed
      Get the source dimension which is mapped to the d-th target dimension (see Mixed.getComponentMapping(int[])).
      Specified by:
      getComponentMapping in interface Mixed
      Overrides:
      getComponentMapping in class AbstractMixedTransform
    • setComponentMapping

      public void setComponentMapping(int[] component)
      Set for each target dimensions from which source dimension it is taken.

      For instance, if the transform maps 3D (x,y,z) coordinates to 2D (z,x,y) coordinate this will be [2, 0, 1].

      Parameters:
      component - array that says for each component of the target vector from which source vector component it should be taken.
    • getMatrix

      public double[][] getMatrix()
      Description copied from interface: Mixed
      Get the matrix that transforms homogeneous source points to homogeneous target points. For testing purposes.
      Specified by:
      getMatrix in interface Mixed
    • apply

      public void apply(long[] source, long[] target)
      Description copied from interface: Transform
      Apply the Transform to a source vector to obtain a target vector.
      Specified by:
      apply in interface Transform
      Parameters:
      source - source coordinates.
      target - set this to the target coordinates.
    • apply

      public void apply(int[] source, int[] target)
      Description copied from interface: Transform
      Apply the Transform to a source vector to obtain a target vector.
      Specified by:
      apply in interface Transform
      Parameters:
      source - source coordinates.
      target - set this to the target coordinates.
    • apply

      public void apply(Localizable source, Positionable target)
      Description copied from interface: Transform
      Apply the Transform to a source Localizable to obtain a target Positionable.
      Specified by:
      apply in interface Transform
      Parameters:
      source - source coordinates.
      target - set this to the target coordinates.
    • concatenate

      Description copied from interface: Concatenable
      Concatenate this object with a. The result will be an object that can be concatenated with another A. The conventional meaning for concatenating transformations is the following: Let ba = b.concatenate(a). Applying ba to x is equivalent to first applying a to x and then applying b to the result.
      Specified by:
      concatenate in interface Concatenable<ComponentMapping>
    • getConcatenableClass

      public Class<ComponentMapping> getConcatenableClass()
      Specified by:
      getConcatenableClass in interface Concatenable<ComponentMapping>
    • preConcatenate

      public ComponentMappingTransform preConcatenate(ComponentMapping t)
      Description copied from interface: PreConcatenable
      Pre-concatenate this object with a. The result will be an object that can be pre-concatenated with another A. The conventional meaning for concatenating transformations is the following: Let ba = a.preConcatenate(b). Applying ba to x is equivalent to first applying a to x and then applying b to the result.
      Specified by:
      preConcatenate in interface PreConcatenable<ComponentMapping>
    • getPreConcatenableClass

      public Class<ComponentMapping> getPreConcatenableClass()
      Specified by:
      getPreConcatenableClass in interface PreConcatenable<ComponentMapping>