motris.data
Class GrayImage

java.lang.Object
  extended bymotris.data.MotrisImage
      extended bymotris.data.GrayImage
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageConsumer

public class GrayImage
extends MotrisImage
implements java.awt.image.ImageConsumer

An image with grayvalues from 0 to 255

Author:
ottlik

Field Summary
(package private)  byte[][] data
           
 int imageComplete
           
 boolean isStillInterlaced
           
(package private)  byte[] linearData
           
 
Fields inherited from class motris.data.MotrisImage
Clipping, COLOR, DERIVATION, frameNr, GRAY, OF, type
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
GrayImage(java.awt.image.ImageProducer producer)
          Lazy constructor.
GrayImage(int _w, int _h, byte[] _data)
           
GrayImage(com.sun.jimi.core.raster.JimiRasterImage rasterImage)
           
 
Method Summary
private  void copyLinearDataToData()
          Create data[][] from linearData[].
 void create2DArrayIfNecessary()
           
 GrayImage fillEvenWithOdd(boolean createAdditionalImage)
          Fill all even image lines (first Line=0) with the value of the following odd line
 GrayImage fillOddWithEven(boolean createAdditionalImage)
          Fill all odd image lines (first Line=0) with the value of the next even line
 byte[][] getData()
           
 double[] getExpDeltaIToTheBeta(double beta, int maxD)
          Helper function to compute \lambda used in EM Contour Algorith
 double[][] getGrayValueDifferenceDistribution(int maxD)
           
 int[] getIntDataArray()
           
 byte[] getLinearData()
           
 double getValueAt(double x, double y)
          Get the Gray Value at a floating point Position (x,y) by bilinear interpolation
 int getValueAt(int x, int y)
          Get the Gray Value at a specific point (x,y).
 void imageComplete(int status)
           
 void setColorModel(java.awt.image.ColorModel model)
           
 void setDimensions(int width, int height)
           
 void setHints(int hintflags)
           
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int off, int scansize)
           
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int off, int scansize)
           
 void setProperties(java.util.Hashtable props)
           
 void takeOnlyEven()
           
 void takeOnlyOdd()
           
 void waitUntilImageReceived()
           
 
Methods inherited from class motris.data.MotrisImage
getClipping, getDoubleDataArray, getFrameNr, getHeight, getType, getWidth, getX, getY, setFrameNr, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

byte[][] data

linearData

byte[] linearData

imageComplete

public int imageComplete

isStillInterlaced

public boolean isStillInterlaced
Constructor Detail

GrayImage

public GrayImage(int _w,
                 int _h,
                 byte[] _data)

GrayImage

public GrayImage(com.sun.jimi.core.raster.JimiRasterImage rasterImage)

GrayImage

public GrayImage(java.awt.image.ImageProducer producer)
Lazy constructor. Data is supplied as ImageConsumer

Method Detail

copyLinearDataToData

private void copyLinearDataToData()
Create data[][] from linearData[]. Moved here from constructor to allow lazy init for speedup if image is used for viewing only


create2DArrayIfNecessary

public void create2DArrayIfNecessary()

getData

public byte[][] getData()

getLinearData

public byte[] getLinearData()

getValueAt

public int getValueAt(int x,
                      int y)
Get the Gray Value at a specific point (x,y). Warning: needs to be

Parameters:
x -
y -
Returns:
grey level (0..255)

getValueAt

public double getValueAt(double x,
                         double y)
Get the Gray Value at a floating point Position (x,y) by bilinear interpolation

Parameters:
x -
y -
Returns:
grey level (0..255) interpolated

getIntDataArray

public int[] getIntDataArray()
Overrides:
getIntDataArray in class MotrisImage

imageComplete

public void imageComplete(int status)
Specified by:
imageComplete in interface java.awt.image.ImageConsumer

setHints

public void setHints(int hintflags)
Specified by:
setHints in interface java.awt.image.ImageConsumer

setDimensions

public void setDimensions(int width,
                          int height)
Specified by:
setDimensions in interface java.awt.image.ImageConsumer

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      byte[] pixels,
                      int off,
                      int scansize)
Specified by:
setPixels in interface java.awt.image.ImageConsumer

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      int[] pixels,
                      int off,
                      int scansize)
Specified by:
setPixels in interface java.awt.image.ImageConsumer

setColorModel

public void setColorModel(java.awt.image.ColorModel model)
Specified by:
setColorModel in interface java.awt.image.ImageConsumer

setProperties

public void setProperties(java.util.Hashtable props)
Specified by:
setProperties in interface java.awt.image.ImageConsumer

getExpDeltaIToTheBeta

public double[] getExpDeltaIToTheBeta(double beta,
                                      int maxD)
Helper function to compute \lambda used in EM Contour Algorith

Parameters:
beta - for Exp { |Delta I|^beta }
maxD - all lambdas for pixel distances from 1 to maxD are computed
Returns:
array with Exp { |Delta I|^beta } for different distances used in computation of delta I

getGrayValueDifferenceDistribution

public double[][] getGrayValueDifferenceDistribution(int maxD)

fillEvenWithOdd

public GrayImage fillEvenWithOdd(boolean createAdditionalImage)
Fill all even image lines (first Line=0) with the value of the following odd line


fillOddWithEven

public GrayImage fillOddWithEven(boolean createAdditionalImage)
Fill all odd image lines (first Line=0) with the value of the next even line


takeOnlyEven

public void takeOnlyEven()

takeOnlyOdd

public void takeOnlyOdd()

waitUntilImageReceived

public void waitUntilImageReceived()