All Implemented Interfaces:
Provider<Channel>, ProviderAsStack

public class DistanceTransform3D extends FromMaskBase
Euclidian Distance Transform from ImageJ that works on 2D as well as 3D z-stacks.

See Distance transform on Wikipedia.

A new channel is always created i.e. the input channel is unchanged.

The plugin uses aspect ratio (relative distance between z and xy slices) in its distance calculations.

As a simplification, when resolution is used, the XY plane is multipled by the average of the x and y dimensions.

Author:
Owen Feehan
  • Constructor Details

    • DistanceTransform3D

      public DistanceTransform3D()
  • Method Details

    • createFromMask

      protected Channel createFromMask(Mask mask) throws ProvisionFailedException
      Description copied from class: FromMaskBase
      Creates a Channel from the provided Mask.
      Specified by:
      createFromMask in class FromMaskBase
      Parameters:
      mask - the Mask to create the channel from
      Returns:
      the created Channel
      Throws:
      ProvisionFailedException - if the channel creation fails
    • createDistanceMapForVoxels

      public Voxels<UnsignedByteBuffer> createDistanceMapForVoxels(BinaryVoxels<UnsignedByteBuffer> voxels, Optional<Resolution> resolution, float multiplyByZRes) throws ProvisionFailedException
      Creates a distance map for binary voxels.
      Parameters:
      voxels - the binary voxels to create a distance map for
      resolution - the optional resolution of the voxels
      multiplyByZRes - a factor to multiply the z-resolution by
      Returns:
      the distance map as Voxels of UnsignedByteBuffer
      Throws:
      ProvisionFailedException - if the distance map creation fails
    • isSuppressZ

      public boolean isSuppressZ()
      If true, suppresses the z-dimension in distance calculations.
    • setSuppressZ

      public void setSuppressZ(boolean suppressZ)
      If true, suppresses the z-dimension in distance calculations.
    • getMultiplyBy

      public float getMultiplyBy()
      A factor to multiply the distance values by.
    • setMultiplyBy

      public void setMultiplyBy(float multiplyBy)
      A factor to multiply the distance values by.
    • isCreateShort

      public boolean isCreateShort()
      If true, creates a short (16-bit) output instead of byte (8-bit).
    • setCreateShort

      public void setCreateShort(boolean createShort)
      If true, creates a short (16-bit) output instead of byte (8-bit).
    • isApplyResolution

      public boolean isApplyResolution()
      If true, multiplies the values by the x-resolution, if it exists.
    • setApplyResolution

      public void setApplyResolution(boolean applyResolution)
      If true, multiplies the values by the x-resolution, if it exists.
    • isIgnoreZIfNaN

      public boolean isIgnoreZIfNaN()
      If true and the z-resolution is undefined, the z dimension is ignored.
    • setIgnoreZIfNaN

      public void setIgnoreZIfNaN(boolean ignoreZIfNaN)
      If true and the z-resolution is undefined, the z dimension is ignored.