edu.stanford.rsl.konrad.utils
Class ImageUtil

java.lang.Object
  extended by edu.stanford.rsl.konrad.utils.ImageUtil

public abstract class ImageUtil
extends java.lang.Object


Constructor Summary
ImageUtil()
           
 
Method Summary
static void addImagePlusValues(ij.ImagePlus image, ij.ImagePlus image2)
          Adds the pixel values of all pixels in the ImagePlus by the second Image
static void addProcessors(ij.process.ImageProcessor left, ij.process.ImageProcessor right)
          Adds two image processors.
static void addToImagePlusValues(ij.ImagePlus image, double value)
          Increases the pixel values of all pixels in the ImagePlus by addition of value
static double[] computeMeanAndStandardDeviation(ij.process.ImageProcessor imp)
          Normalizes an ImageProcessor to mean 0 and standard deviation 1
static ij.process.FloatProcessor divideImages(ij.ImagePlus nominator, ij.ImagePlus denominator)
           
static ij.process.FloatProcessor divideImages(ij.ImagePlus nominator, ij.ImagePlus denominator, int n)
          Divides two image processors in the two given ImagePlus.
static ij.process.FloatProcessor divideImages(ij.process.ImageProcessor nominator, ij.process.ImageProcessor denominator)
           
static float[] estimateConvolutionKernel(ij.process.FloatProcessor before, ij.process.FloatProcessor after, int kernelSize, int number)
           
static java.util.ArrayList<ij.ImagePlus> getAvailableImagePlus()
           
static ij.ImagePlus[] getAvailableImagePlusAsArray()
           
static java.awt.image.IndexColorModel getDefaultColorModel()
           
static ij.ImagePlus getImagePlusFromString(java.lang.String name, ij.ImagePlus[] images)
          Returns the matching image given it's String representation
static java.lang.String[] getStringArrayRepresentation(ij.ImagePlus[] images)
          Creates a unigue String representation of an array of ImagePlus
static double[] minAndMaxOfImageProcessor(ij.ImagePlus image)
          returns the minimal and the maxiaml value of a given ImageProcessor
static double[] minAndMaxOfImageProcessor(ij.process.ImageProcessor imp)
          returns the minimal and the maxiaml value of a given ImageProcessor
static double minOfImagePlusValues(ij.ImagePlus image)
          Determines the minimal value of a given ImagePlus.
static double minOfImageProcessor(ij.process.ImageProcessor imp)
          returns the minimal value of a given ImageProcessor
static void multiplyImagePlusValues(ij.ImagePlus image, double value)
          Multiplies the pixel values of all pixels in the ImagePlus by value
static ij.process.FloatProcessor multiplyImages(ij.ImagePlus nominator, ij.ImagePlus denominator, int n)
           
static ij.process.FloatProcessor multiplyImages(ij.process.ImageProcessor nominator, ij.process.ImageProcessor denominator)
           
static double[] normalizeImagePlus(ij.ImagePlus image)
          Normalizes all pixel values of an ImagePlus to mean 0 and standard deviation 1.
static double[] normalizeImagePlusCutOff(ij.ImagePlus image, int numStandardDeviations)
          Normalizes all pixel values of an ImagePlus to mean 0 and standard deviation 1.
static double[] normalizeImagePlusMinMax(ij.ImagePlus image)
          Normalizes all pixel values of an ImagePlus to minimum 0 and maximum 1.
static double[] normalizeImageProcessor(ij.process.ImageProcessor imp)
          Normalizes an ImageProcessor to mean 0 and standard deviation 1
static double[] normalizeImageProcessorCutOff(ij.process.ImageProcessor imp, int numStandardDeviations)
          Normalizes an ImageProcessor to mean 0 and standard deviation 1.
static double[] normalizeImageProcessorMinMax(ij.process.ImageProcessor imp)
          Normalizes an ImageProcessor to minimum 0 and maximum 1
static void subtractProcessors(ij.process.ImageProcessor left, ij.process.ImageProcessor right)
          Subtracts two image processors.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtil

public ImageUtil()
Method Detail

getDefaultColorModel

public static java.awt.image.IndexColorModel getDefaultColorModel()

estimateConvolutionKernel

public static float[] estimateConvolutionKernel(ij.process.FloatProcessor before,
                                                ij.process.FloatProcessor after,
                                                int kernelSize,
                                                int number)

getAvailableImagePlus

public static java.util.ArrayList<ij.ImagePlus> getAvailableImagePlus()

getAvailableImagePlusAsArray

public static ij.ImagePlus[] getAvailableImagePlusAsArray()

minOfImagePlusValues

public static double minOfImagePlusValues(ij.ImagePlus image)
Determines the minimal value of a given ImagePlus.

Parameters:
image - the ImagePlus
Returns:
the minimal value

minOfImageProcessor

public static double minOfImageProcessor(ij.process.ImageProcessor imp)
returns the minimal value of a given ImageProcessor

Parameters:
imp - the ImageProcessor
Returns:
the minimal value

minAndMaxOfImageProcessor

public static double[] minAndMaxOfImageProcessor(ij.process.ImageProcessor imp)
returns the minimal and the maxiaml value of a given ImageProcessor

Parameters:
imp - the ImageProcessor
Returns:
the minimal and the maximal value as double array

minAndMaxOfImageProcessor

public static double[] minAndMaxOfImageProcessor(ij.ImagePlus image)
returns the minimal and the maxiaml value of a given ImageProcessor

Parameters:
image - the ImageProcessor
Returns:
the minimal and the maximal value as double array

addToImagePlusValues

public static void addToImagePlusValues(ij.ImagePlus image,
                                        double value)
Increases the pixel values of all pixels in the ImagePlus by addition of value

Parameters:
image - the ImagePlus
value - the value to add

addImagePlusValues

public static void addImagePlusValues(ij.ImagePlus image,
                                      ij.ImagePlus image2)
Adds the pixel values of all pixels in the ImagePlus by the second Image

Parameters:
image - the ImagePlus
image2 - the values to add to

multiplyImagePlusValues

public static void multiplyImagePlusValues(ij.ImagePlus image,
                                           double value)
Multiplies the pixel values of all pixels in the ImagePlus by value

Parameters:
image - the ImagePlus
value - the value to multiply

normalizeImagePlusCutOff

public static double[] normalizeImagePlusCutOff(ij.ImagePlus image,
                                                int numStandardDeviations)
Normalizes all pixel values of an ImagePlus to mean 0 and standard deviation 1.

Parameters:
image - the imagePlus
Returns:
an array with two entries. The first one is the mean of all pixel values. The second one the standard deviation of all pixel values.

normalizeImagePlus

public static double[] normalizeImagePlus(ij.ImagePlus image)
Normalizes all pixel values of an ImagePlus to mean 0 and standard deviation 1.

Parameters:
image - the imagePlus
Returns:
an array with two times stack size entries. The respective first one is the mean of all pixel values. The second one the standard deviation of all pixel values.

normalizeImagePlusMinMax

public static double[] normalizeImagePlusMinMax(ij.ImagePlus image)
Normalizes all pixel values of an ImagePlus to minimum 0 and maximum 1.

Parameters:
image - the imagePlus
Returns:
an array with two entries. The first one is the mean of all pixel values. The second one the standard deviation of all pixel values.

normalizeImageProcessorMinMax

public static double[] normalizeImageProcessorMinMax(ij.process.ImageProcessor imp)
Normalizes an ImageProcessor to minimum 0 and maximum 1

Parameters:
imp - the image processor
Returns:
an double array with two entries. The first one is the mean and the second one is the standard deviation.

normalizeImageProcessor

public static double[] normalizeImageProcessor(ij.process.ImageProcessor imp)
Normalizes an ImageProcessor to mean 0 and standard deviation 1

Parameters:
imp - the image processor
Returns:
an double array with two entries. The first one is the mean and the second one is the standard deviation.

normalizeImageProcessorCutOff

public static double[] normalizeImageProcessorCutOff(ij.process.ImageProcessor imp,
                                                     int numStandardDeviations)
Normalizes an ImageProcessor to mean 0 and standard deviation 1. Cuts off values greater than a certain amount of standard deviations.

Parameters:
imp - the image processor
numStandardDeviations - Number of standard deviations after which the values are cut off
Returns:
an double array with two entries. The first one is the mean and the second one is the standard deviation.

computeMeanAndStandardDeviation

public static double[] computeMeanAndStandardDeviation(ij.process.ImageProcessor imp)
Normalizes an ImageProcessor to mean 0 and standard deviation 1

Parameters:
imp - the image processor
Returns:
an double array with two entries. The first one is the mean and the second one is the standard deviation.

divideImages

public static ij.process.FloatProcessor divideImages(ij.ImagePlus nominator,
                                                     ij.ImagePlus denominator)

divideImages

public static ij.process.FloatProcessor divideImages(ij.process.ImageProcessor nominator,
                                                     ij.process.ImageProcessor denominator)

multiplyImages

public static ij.process.FloatProcessor multiplyImages(ij.ImagePlus nominator,
                                                       ij.ImagePlus denominator,
                                                       int n)

multiplyImages

public static ij.process.FloatProcessor multiplyImages(ij.process.ImageProcessor nominator,
                                                       ij.process.ImageProcessor denominator)

divideImages

public static ij.process.FloatProcessor divideImages(ij.ImagePlus nominator,
                                                     ij.ImagePlus denominator,
                                                     int n)
Divides two image processors in the two given ImagePlus. Will allocate a new FloatProcessor for the result.

Parameters:
nominator - the nominator
denominator - the denominator
n - the index of the stack (starts with 0).
Returns:
the division result.

addProcessors

public static void addProcessors(ij.process.ImageProcessor left,
                                 ij.process.ImageProcessor right)
Adds two image processors. Works in place. First ImageProcessor is modified.

Parameters:
left - the first processor
right - the second processor

subtractProcessors

public static void subtractProcessors(ij.process.ImageProcessor left,
                                      ij.process.ImageProcessor right)
Subtracts two image processors. Works in place. First ImageProcessor is modified.

Parameters:
left - the first processor
right - the second processor

getStringArrayRepresentation

public static java.lang.String[] getStringArrayRepresentation(ij.ImagePlus[] images)
Creates a unigue String representation of an array of ImagePlus

Parameters:
images -
Returns:
the String []

getImagePlusFromString

public static ij.ImagePlus getImagePlusFromString(java.lang.String name,
                                                  ij.ImagePlus[] images)
Returns the matching image given it's String representation

Parameters:
name - the String representation of the image
images - the array of ImagePlus
Returns:
the ImagePlus