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 Details

    • IfVoxelZero

      public IfVoxelZero()
  • Method Details

    • createFromChannel

      public Channel createFromChannel(Channel channel) throws ProvisionFailedException
      Description copied from class: ChannelProviderUnary
      Creates a Channel given the entity provided by the delegate.
      Specified by:
      createFromChannel in class ChannelProviderUnary
      Parameters:
      channel - the entity provided by the delegate.
      Returns:
      the created Channel that is returned by the provider.
      Throws:
      ProvisionFailedException - if the provider cannot complete successfully.
    • 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