ImageScience 3.0.0

imagescience.random
Class Randomizer

java.lang.Object
  extended by imagescience.random.Randomizer

public class Randomizer
extends java.lang.Object

Randomizes images.


Field Summary
static int ADDITIVE
          Additive insertion of random numbers.
 Messenger messenger
          The object used for message displaying.
static int MODULATORY
          Modulatory insertion of random numbers.
static int MULTIPLICATIVE
          Multiplicative insertion of random numbers.
 Progressor progressor
          The object used for progress displaying.
 
Constructor Summary
Randomizer()
          Default constructor.
 
Method Summary
 Image binomial(Image image, int trials, double probability, int insertion, boolean newimage)
          Randomizes images using a binomial random variable.
 Image exponential(Image image, double lambda, int insertion, boolean newimage)
          Randomizes images using an exponential random variable.
 Image gamma(Image image, int order, int insertion, boolean newimage)
          Randomizes images using a gamma random variable.
 Image gaussian(Image image, double mean, double stdev, int insertion, boolean newimage)
          Randomizes images using a Gaussian random variable.
 Image poisson(Image image, double mean, int insertion, boolean newimage)
          Randomizes images using a Poisson random variable.
 Image uniform(Image image, double min, double max, int insertion, boolean newimage)
          Randomizes images using a uniform random variable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADDITIVE

public static final int ADDITIVE
Additive insertion of random numbers. For each image element, a random number is generated from the selected distribution and is added to the original value.

See Also:
Constant Field Values

MULTIPLICATIVE

public static final int MULTIPLICATIVE
Multiplicative insertion of random numbers. For each image element, a random number is generated from the selected distribution which multiplies the original value.

See Also:
Constant Field Values

MODULATORY

public static final int MODULATORY
Modulatory insertion of random numbers. For each image element, a random number is generated from the selected distribution (currently this works only for Poisson) with the original value being a parameter value, which replaces the original value.

See Also:
Constant Field Values

messenger

public final Messenger messenger
The object used for message displaying.


progressor

public final Progressor progressor
The object used for progress displaying.

Constructor Detail

Randomizer

public Randomizer()
Default constructor.

Method Detail

gaussian

public Image gaussian(Image image,
                      double mean,
                      double stdev,
                      int insertion,
                      boolean newimage)
Randomizes images using a Gaussian random variable.

Parameters:
image - The input image to be randomized.
mean - The mean of the Gaussian distribution.
stdev - The standard deviation of the Gaussian distribution. Must be larger than or equal to 0.
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE or MULTIPLICATIVE.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If stdev is less than 0, or if insertion is invalid.
java.lang.NullPointerException - If image is null.

binomial

public Image binomial(Image image,
                      int trials,
                      double probability,
                      int insertion,
                      boolean newimage)
Randomizes images using a binomial random variable.

Parameters:
image - The input image to be randomized.
trials - The number of trials of the binomial distribution. Must be larger than or equal to 0.
probability - The probability for each trial of the binomial distribution. Must be in the range [0,1].
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE or MULTIPLICATIVE.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If trials is less than 0, if probability is outside the range [0,1], or if insertion is invalid.
java.lang.NullPointerException - If image is null.

gamma

public Image gamma(Image image,
                   int order,
                   int insertion,
                   boolean newimage)
Randomizes images using a gamma random variable.

Parameters:
image - The input image to be randomized.
order - The integer order of the gamma distribution. Must be larger than 0.
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE or MULTIPLICATIVE.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If order is less than or equal to 0, or if insertion is invalid.
java.lang.NullPointerException - If image is null.

uniform

public Image uniform(Image image,
                     double min,
                     double max,
                     int insertion,
                     boolean newimage)
Randomizes images using a uniform random variable.

Parameters:
image - The input image to be randomized.
min - max - The interval parameters of the uniform distribution. Random numbers are generated in the open interval (min,max).
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE or MULTIPLICATIVE.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If min is larger than or equal to max, or if insertion is invalid.
java.lang.NullPointerException - If image is null.

exponential

public Image exponential(Image image,
                         double lambda,
                         int insertion,
                         boolean newimage)
Randomizes images using an exponential random variable.

Parameters:
image - The input image to be randomized.
lambda - The lambda parameter of the exponential distribution. Must be larger than 0.
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE or MULTIPLICATIVE.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If lambda is less than or equal to 0, or if insertion is invalid.
java.lang.NullPointerException - If image is null.

poisson

public Image poisson(Image image,
                     double mean,
                     int insertion,
                     boolean newimage)
Randomizes images using a Poisson random variable.

Parameters:
image - The input image to be randomized.
mean - The mean of the Poisson distribution. Must be larger than or equal to 0.
insertion - Determines how the random numbers generated from the distribution are inserted into the image. Must be one of ADDITIVE, MULTIPLICATIVE, or MODULATORY.
newimage - Indicates whether the randomized image should be returned as a new image. If this parameter is true, the result is returned as a new Image object (of the same type as the input image) and the input image is left unaltered; if it is false, the input image itself is randomized and returned, thereby saving memory.
Returns:
A randomized version of the input image. Be aware of the value conversion and insertion rules for the different types of images: random numbers may have been clipped and rounded.
Throws:
java.lang.IllegalArgumentException - If mean is less than 0, or if insertion is invalid.
java.lang.NullPointerException - If image is null.

ImageScience 3.0.0

Copyright (C) Erik Meijering. Permission to use this software and corresponding documentation for educational, research, and not-for-profit purposes, without a fee and without a signed licensing agreement, is granted, subject to the following terms and conditions.

IT IS NOT ALLOWED TO REDISTRIBUTE, SELL, OR LEASE THIS SOFTWARE, OR DERIVATIVE WORKS THEREOF, WITHOUT PERMISSION IN WRITING FROM THE COPYRIGHT HOLDER. THE COPYRIGHT HOLDER IS FREE TO MAKE VERSIONS OF THE SOFTWARE AVAILABLE FOR A FEE OR COMMERCIALLY ONLY.

IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND CORRESPONDING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.