Interface VoxelsAssigner


public interface VoxelsAssigner
Assigns values to some or all voxels.

The co-ordinates of the bounding-box, object-mask etc. are always relative to a particular coordinate frame.

Throughout the code-base, usually this interface is only exposed expecting global coordinates (i.e. not relative to anything else) for bounding-boxes etc.

Author:
Owen Feehan
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Assigns to all the voxels
    void
    Assigns to only voxels inside a bounding-box
    void
    toEitherTwoObjects(ObjectMask object1, ObjectMask object2, BoundingBox restrictTo)
    Sets voxels to a value if the position is on in either of two masks
    void
    Sets voxels in a box to a particular value if they match an object-mask
    void
    toObject(ObjectMask object, BoundingBox restrictTo)
    Sets voxels in a box to a particular value if they match a object-mask (but only a part of the object-mask)
    void
    toObjectIf(ObjectMask object, IntPredicate voxelPredicate)
    Sets voxels in a box to a particular value if they match an object-mask and a voxel matches a predicate
    boolean
    toObjectWhile(ObjectMask object, IntPredicate voxelPredicate)
    Sets voxels in a box to a particular value if they match an object-mask and each voxel matches a predicate
    void
    toVoxel(int x, int y, int z)
    Assigns one particular voxel
    default void
    Assigns one particular voxel
  • Method Details

    • toVoxel

      default void toVoxel(Point3i point)
      Assigns one particular voxel
      Parameters:
      point - point to assign to
    • toVoxel

      void toVoxel(int x, int y, int z)
      Assigns one particular voxel
      Parameters:
      x - coordinate in x dimension
      y - coordinate in y dimension
      z - coordinate in z dimension (slice index)
    • toBox

      void toBox(BoundingBox box)
      Assigns to only voxels inside a bounding-box
      Parameters:
      box - the bounding-box
    • toAll

      void toAll()
      Assigns to all the voxels
    • toObject

      void toObject(ObjectMask object)
      Sets voxels in a box to a particular value if they match an object-mask
      Parameters:
      object - the object-mask to restrict which values in the buffer are written to
    • toObjectIf

      void toObjectIf(ObjectMask object, IntPredicate voxelPredicate)
      Sets voxels in a box to a particular value if they match an object-mask and a voxel matches a predicate

      Unlike toObjectWhile(ObjectMask, IntPredicate) this operation will not abort if a voxel fails to match a predicate, but rather keep on iterating through all voxels.

      Parameters:
      object - the object-mask to restrict which values in the buffer are assigned
      voxelPredicate - the existing value of any voxel to be written must match this predicate
    • toObjectWhile

      boolean toObjectWhile(ObjectMask object, IntPredicate voxelPredicate)
      Sets voxels in a box to a particular value if they match an object-mask and each voxel matches a predicate

      If any one of the voxels in the object doesn't match the predicate, the operation is aborted, and nothing is written at all. This behaviour is different to toObjectIf(org.anchoranalysis.image.voxel.object.ObjectMask, java.util.function.IntPredicate) which will keep on iterating.

      Parameters:
      object - the object-mask to restrict which values in the buffer are assigned
      voxelPredicate - the existing value of every voxel to be written must match this predicate, otherwise no voxels are set at all
      Returns:
      if at least one voxel was set
    • toObject

      void toObject(ObjectMask object, BoundingBox restrictTo)
      Sets voxels in a box to a particular value if they match a object-mask (but only a part of the object-mask)

      Pixels are unchanged if they do not match the mask, or outside the part of the mask that is considered.

      Parameters:
      object - the object-mask to restrict where voxels are set
      restrictTo - a restriction on where to process in the object-mask (expressed in the same coordinates as object).
    • toEitherTwoObjects

      void toEitherTwoObjects(ObjectMask object1, ObjectMask object2, BoundingBox restrictTo)
      Sets voxels to a value if the position is on in either of two masks
      Parameters:
      object1 - first-object
      object2 - second-object
      restrictTo - only process this region (which is sensibly part or all of the intersection of the two objects bounding-boxes)