Class ArithmeticWithConstantBase

All Implemented Interfaces:
Provider<Channel>, ProviderAsStack
Direct Known Subclasses:
AddConstant, MultiplyConstant, SubtractFromConstant

public abstract class ArithmeticWithConstantBase extends UnaryWithValueBase
Base-class for operations that perform a binary arithmetic operation with each voxel-value and a constant.
Author:
Owen Feehan
  • Constructor Details

    • ArithmeticWithConstantBase

      public ArithmeticWithConstantBase()
  • Method Details

    • createFromChannelWithConstant

      public Channel createFromChannelWithConstant(Channel channel, double value) throws ProvisionFailedException
      Description copied from class: UnaryWithValueBase
      Creates a new channel from an existing channel and a scalar value.
      Specified by:
      createFromChannelWithConstant in class UnaryWithValueBase
      Parameters:
      channel - the input Channel
      value - the scalar value to be used in channel creation
      Returns:
      a new Channel created from the input channel and scalar value
      Throws:
      ProvisionFailedException - if the channel creation fails
    • performBinaryOperation

      protected abstract int performBinaryOperation(int voxel, int constant)
      The binary arithmetic operation that combines the voxel-value and the constant-value.
      Parameters:
      voxel - the value of the current voxel
      constant - the constant value to be used in the operation
      Returns:
      the result of the binary operation