de.unihalle.informatik.MiToBo.math
Class MTBImageArithmetics

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.math.MTBImageArithmetics

public class MTBImageArithmetics
extends java.lang.Object

This class that provides convenience functions for the ImageArithmetics class. Operations with one input image result in images of the same type!! Operations with two input images result in an image of type of the higher input image precision!! If two input images do not have the same size the resulting image is null. Each operation is elementwise.

Author:
gress

Field Summary
private  MTBOperator callingOperator
           
 
Constructor Summary
MTBImageArithmetics()
          Constructor.
MTBImageArithmetics(MTBOperator callingOperator)
          Constructor with calling operator.
 
Method Summary
 MTBImage abs(MTBImage img)
          Absolute values of the image elements.
 MTBImage absDiff(MTBImage img1, MTBImage img2)
          Absolute difference of two images.
 MTBImage add(MTBImage img, double constant)
          Add a constant to each image value
 MTBImage add(MTBImage img1, MTBImage img2)
          Add the elements two images
 MTBImage and(MTBImage img1, MTBImage img2)
          Bitwise logical AND of two images.
 MTBImage div(MTBImage img1, MTBImage img2)
          Divide the elements of two images (img1/img2)
 MTBImage inv(MTBImage img)
          Invert the image.
 MTBImage max(MTBImage img1, MTBImage img2)
          Pixelwise maximum
 MTBImage min(MTBImage img1, MTBImage img2)
          Pixelwise minimum
 MTBImage mult(MTBImage img, double constant)
          Multiply each image value by a constant
 MTBImage mult(MTBImage img1, MTBImage img2)
          Multiply the elements of two images
 MTBImage or(MTBImage img1, MTBImage img2)
          Bitwise logical OR of two images.
 MTBImage pow(MTBImage img, double exponent)
          Raise image values to the power of 'exponent'
private  MTBImage runOperation(MTBOperator callingOperator, ImageArithmetics.ArithOp op, MTBImage img, double constant)
          Run an operation with one input image and one input constant
private  MTBImage runOperation(MTBOperator callingOperator, ImageArithmetics.ArithOp op, MTBImage img1, MTBImage img2)
          Run an operation with two input images
 MTBImage sub(MTBImage img1, MTBImage img2)
          Subtract the elements two images (img1 - img2)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callingOperator

private MTBOperator callingOperator
Constructor Detail

MTBImageArithmetics

public MTBImageArithmetics()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor. (calling operator is null)

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

MTBImageArithmetics

public MTBImageArithmetics(MTBOperator callingOperator)
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor with calling operator. You can specify the MTBOperator that calls the image arithmetic functions. This operator is passed to the internal image arithmetic operator class for history recording

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

abs

public MTBImage abs(MTBImage img)
Absolute values of the image elements.

Parameters:
img - input image
Returns:
result image or null if operation was not successful

absDiff

public MTBImage absDiff(MTBImage img1,
                        MTBImage img2)
Absolute difference of two images.

Parameters:
img1 - First input image.
img2 - Second input image.
Returns:
result image or null if operation was not successful

add

public MTBImage add(MTBImage img,
                    double constant)
Add a constant to each image value

Parameters:
img - input image
constant -
Returns:
result image or null if operation was not successful

add

public MTBImage add(MTBImage img1,
                    MTBImage img2)
Add the elements two images

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful

and

public MTBImage and(MTBImage img1,
                    MTBImage img2)
Bitwise logical AND of two images.

Parameters:
img1 - First input image.
img2 - Second input image.
Returns:
result image or null if operation was not successful

div

public MTBImage div(MTBImage img1,
                    MTBImage img2)
Divide the elements of two images (img1/img2)

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful

inv

public MTBImage inv(MTBImage img)
Invert the image.

Parameters:
img - input image
Returns:
result image or null if operation was not successful

max

public MTBImage max(MTBImage img1,
                    MTBImage img2)
Pixelwise maximum

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful

min

public MTBImage min(MTBImage img1,
                    MTBImage img2)
Pixelwise minimum

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful

mult

public MTBImage mult(MTBImage img,
                     double constant)
Multiply each image value by a constant

Parameters:
img - input image
constant -
Returns:
result image or null if operation was not successful

mult

public MTBImage mult(MTBImage img1,
                     MTBImage img2)
Multiply the elements of two images

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful

or

public MTBImage or(MTBImage img1,
                   MTBImage img2)
Bitwise logical OR of two images.

Parameters:
img1 - First input image.
img2 - Second input image.
Returns:
result image or null if operation was not successful

pow

public MTBImage pow(MTBImage img,
                    double exponent)
Raise image values to the power of 'exponent'

Parameters:
img - input image
exponent -
Returns:
result image or null if operation was not successful

runOperation

private MTBImage runOperation(MTBOperator callingOperator,
                              ImageArithmetics.ArithOp op,
                              MTBImage img,
                              double constant)
Run an operation with one input image and one input constant

Parameters:
op -
img -
constant -
Returns:
result image or null if operation was not successful

runOperation

private MTBImage runOperation(MTBOperator callingOperator,
                              ImageArithmetics.ArithOp op,
                              MTBImage img1,
                              MTBImage img2)
Run an operation with two input images

Parameters:
callingOperator -
op -
img -
constant -
Returns:
result image or null if operation was not successful

sub

public MTBImage sub(MTBImage img1,
                    MTBImage img2)
Subtract the elements two images (img1 - img2)

Parameters:
img1 -
img2 -
Returns:
result image or null if operation was not successful