Class IfVoxelZero

Object
AnchorBean<ChannelProvider>
InitializableBean<ChannelProvider, ImageInitialization>
ImageBean<ChannelProvider>
BeanProviderAsStackBase<ChannelProvider, Channel>
ChannelProvider
ChannelProviderUnary
IfVoxelZero
All Implemented Interfaces:
Provider<Channel>, ProviderAsStack

public class IfVoxelZero extends ChannelProviderUnary
Creates a new channel which is a merged version of two input channels according to rules.
  • If the voxel in channel is non-zero, then the corresponding output is channel.
  • If the voxel in channel is zero, then the corresponding output is channelIfVoxelZero.

The two channels must be the same size.

Neither channel's input is changed. The operation is immutable.

Author:
Owen Feehan
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Channel
    createFromChannel(Channel channel)
     
    ChannelProvider
    If a pixel is zero in the input-channel, the output is formed from the corresponding pixel in this channel instead
    static Channel
    mergeViaZeroCheck(Channel channel, Channel channelIfPixelZero, VoxelDataType combinedType, double multiplierIfNonZero)
    Creates a new channel which is a merged version of two input channels according to rules.
    void
    setChannelIfVoxelZero(ChannelProvider channelIfVoxelZero)
    If a pixel is zero in the input-channel, the output is formed from the corresponding pixel in this channel instead

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

    get, getChannel, setChannel

    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

    • IfVoxelZero

      public IfVoxelZero()
  • Method Details

    • createFromChannel

      public Channel createFromChannel(Channel channel) throws ProvisionFailedException
      Specified by:
      createFromChannel in class ChannelProviderUnary
      Throws:
      ProvisionFailedException
    • mergeViaZeroCheck

      public static Channel mergeViaZeroCheck(Channel channel, Channel channelIfPixelZero, VoxelDataType combinedType, double multiplierIfNonZero)
      Creates a new channel which is a merged version of two input channels according to rules.
      • If the pixel in channel is non-zero, then the corresponding output is channel * multFactorIfNonZero
      • If the pixel in channel is zero, then the corresponding output is channelIfPixelZero

      Assumes the two channels are of the same size, but does not check.

      Neither channel's input is changed. The operation is immutable.

      Parameters:
      channel - the channel that is checked to be zero/non-zero, and whose pixels form the output (maybe multipled) if non-zero.
      channelIfPixelZero - the channel that forms the output if channel is zero.
      combinedType - the type to use for the newly created channel.
      multiplierIfNonZero - the multiplier to apply on non-zero pixels.
      Returns:
      a newly created merged channel according to the above rules.
    • getChannelIfVoxelZero

      public ChannelProvider getChannelIfVoxelZero()
      If a pixel is zero in the input-channel, the output is formed from the corresponding pixel in this channel instead
    • setChannelIfVoxelZero

      public void setChannelIfVoxelZero(ChannelProvider channelIfVoxelZero)
      If a pixel is zero in the input-channel, the output is formed from the corresponding pixel in this channel instead