Class DistanceTransform3D

Object
AnchorBean<ChannelProvider>
InitializableBean<ChannelProvider, ImageInitialization>
ImageBean<ChannelProvider>
BeanProviderAsStackBase<ChannelProvider, Channel>
ChannelProvider
FromMaskBase
DistanceTransform3D
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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Voxels<UnsignedByteBuffer>
    createDistanceMapForVoxels(BinaryVoxels<UnsignedByteBuffer> voxels, Optional<Resolution> resolution, float multiplyByZRes)
    Creates a distance map for binary voxels.
    protected Channel
    createFromMask(Mask mask)
     
    float
    A factor to multiply the distance values by.
    boolean
    If true, multiplies the values by the x-resolution, if it exists.
    boolean
    If true, creates a short (16-bit) output instead of byte (8-bit).
    boolean
    If true and the z-resolution is undefined, the z dimension is ignored.
    boolean
    If true, suppresses the z-dimension in distance calculations.
    void
    setApplyResolution(boolean applyResolution)
    If true, multiplies the values by the x-resolution, if it exists.
    void
    setCreateShort(boolean createShort)
    If true, creates a short (16-bit) output instead of byte (8-bit).
    void
    setIgnoreZIfNaN(boolean ignoreZIfNaN)
    If true and the z-resolution is undefined, the z dimension is ignored.
    void
    setMultiplyBy(float multiplyBy)
    A factor to multiply the distance values by.
    void
    setSuppressZ(boolean suppressZ)
    If true, suppresses the z-dimension in distance calculations.

    Methods inherited from class org.anchoranalysis.plugin.image.bean.channel.provider.mask.FromMaskBase

    get, getMask, setMask

    Methods inherited from class org.anchoranalysis.image.bean.provider.ChannelProvider

    getAsStack

    Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean

    getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitialization

    Methods inherited from class org.anchoranalysis.bean.AnchorBean

    checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DistanceTransform3D

      public DistanceTransform3D()
  • Method Details

    • createFromMask

      protected Channel createFromMask(Mask mask) throws ProvisionFailedException
      Specified by:
      createFromMask in class FromMaskBase
      Throws:
      ProvisionFailedException
    • 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.