Class FindContour

Object
FindContour

public class FindContour extends Object
Finds contour voxels, the pixels forming a continuous path along the boundary of the object or mask.

Specifically, it converts a solid-object (where all voxels inside an object are on) into where only pixels on the contour are on.

A new object/mask is always created, so the existing buffers are not overwritten

The contour is always guaranteed to be inside the existing mask (so always a subset of existing on voxels).

  • Method Details

    • createFromGuess3D

      public static Mask createFromGuess3D(Mask mask, int numberErosions, boolean force2D, boolean atImageBoundary)
      Like createFrom(Mask, int, boolean, boolean), but guesses whether to do this in 2D or 3D.

      The guess depends on whether the mask has 3-dimensions or 2-dimensions.

      Parameters:
      mask - the mask to find a contour for.
      numberErosions - the number of erosions, effectively determining how thick the contour is.
      force2D - if true, 2D will always be used irrespective of the guessing.
      atImageBoundary - if true, contour voxels are shown also for the boundary of the scene. if false, this is not shown.
      Returns:
      a newly-created mask showing only the contour.
    • createFrom

      public static Mask createFrom(Mask mask, int numberErosions, boolean do3D, boolean atImageBoundary)
      Creates an contour from a Mask at the boundary of depth 1 pixel.
      Parameters:
      mask - the mask.
      numberErosions - the number of erosions, effectively determining how thick the contour is.
      do3D - whether to also perform the contour in the third dimension. This is typically unwanted for 2 dimensional images, as every voxel inside the object is treated as on the boundary and a filled in object is produced.
      atImageBoundary - if true, contour voxels are shown also for the boundary of the scene. if false, this is not shown.
      Returns:
      a newly-created mask showing only the contour.
    • createFrom

      public static ObjectMask createFrom(ObjectMask object, int numberErosions, boolean do3D, boolean atImageBoundary)
      Creates an contour from a ObjectMask.

      The parameter nubmerErosions determines the depth of the boundary, with 1 giving a single-voxel depth.

      Parameters:
      object - object to find a contour for.
      numberErosions - the number of erosions, effectively determining how thick the contour is.
      do3D - whether to also perform the contour in the third dimension. This is typically unwanted for 2 dimensional images, as every voxel inside the object is treated as on the boundary and a filled in object is produced.
      atImageBoundary - if true, contour voxels are shown also for the boundary of the scene. if false, this is not shown.
      Returns:
      a newly created ObjectMask describing the contour.