mosaic.sim.neuron.netinputs
Class ImageInput

java.lang.Object
  |
  +--mosaic.sim.neuron.netinputs.ImageInput

public class ImageInput
extends java.lang.Object

This class reads an image and converts it to either a one-dimensional vector of dimension height*width or a two-dimensional matrix of dimension [height, width]. For inputting a one-dimensional vector to the network, this class uses the interface VectorInput; for inputting a two-dimensional matrix, it uses MatrixInput. Objects implementing these interface have to be given in the constructor when initializing. This class needs the JAI (Java Advanced Imaging) library to do its work.

See Also:
VectorInputCoder, MatrixInputCoder

Field Summary
protected  VectorInputCoder coderOneDim
          This object is used as the coder when using one-dimensional (vector) input.
protected  MatrixInputCoder coderTwoDim
          This object is used as the coder when using two-dimensional (matrix) input.
protected  int dim
          The dimension of the network input.
protected  javax.media.jai.PlanarImage image
          The image.
 
Constructor Summary
ImageInput(java.lang.String filename, int dim)
          This constructor initializes the class for one-dimensional or two-dimensional input.
 
Method Summary
 java.awt.image.ColorModel getColorModel()
          Returns the color model of the loaded image.
 int getHeight()
          Returns the height of the loaded image.
 java.awt.image.SampleModel getSampleModel()
          Returns the sample model of the loaded image.
 int getWidth()
          Returns the width of the loaded image.
 void setCoder(MatrixInputCoder coder)
           
 void setCoder(VectorInputCoder coder)
          Initializes the Spike coder.
 void startInput()
          This method really starts the network input and should only be called after the coder has been initialized with setCoder().
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dim

protected int dim
The dimension of the network input.

coderOneDim

protected VectorInputCoder coderOneDim
This object is used as the coder when using one-dimensional (vector) input.

coderTwoDim

protected MatrixInputCoder coderTwoDim
This object is used as the coder when using two-dimensional (matrix) input.

image

protected javax.media.jai.PlanarImage image
The image.
Constructor Detail

ImageInput

public ImageInput(java.lang.String filename,
                  int dim)
           throws CodingException,
                  java.io.FileNotFoundException
This constructor initializes the class for one-dimensional or two-dimensional input. Note that the input can not be done until the coder has been set to an object that implements the suitable coder class. The network input can be started by calling startInput
Parameters:
filename - The filename of the image file that should be used.
dim - The dimension of the network input (1 or 2)
See Also:
setCoder(mosaic.sim.neuron.netinputs.VectorInputCoder), startInput()
Method Detail

getHeight

public int getHeight()
Returns the height of the loaded image.

getWidth

public int getWidth()
Returns the width of the loaded image.

getColorModel

public java.awt.image.ColorModel getColorModel()
Returns the color model of the loaded image.

getSampleModel

public java.awt.image.SampleModel getSampleModel()
Returns the sample model of the loaded image.

setCoder

public void setCoder(VectorInputCoder coder)
              throws CodingException
Initializes the Spike coder.

setCoder

public void setCoder(MatrixInputCoder coder)
              throws CodingException

startInput

public void startInput()
                throws CodingException
This method really starts the network input and should only be called after the coder has been initialized with setCoder().