org.joone.io
Class ImageOutputSynapse

java.lang.Object
  extended by org.joone.engine.Synapse
      extended by org.joone.io.StreamOutputSynapse
          extended by org.joone.io.ImageOutputSynapse
All Implemented Interfaces:
java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable, PlugInListener

public class ImageOutputSynapse
extends StreamOutputSynapse

This class collects the output from the connected layer and places it into an image file. Images can be produced in GIF, JPG and PNG formats.

Colour Mode In colour mode ImageOutputSynapse expects seperate RGB input values in the range 0 to 1 from the connected layer. So to produce an image of width 10 and height 10 there must be 10x10x3 inputs from the previous layer/s. The red, green and blue components in the final image are set using the individual component values from the input.

Non Colour Mode / Grey Scale Mode In this mode the synapse treats each input value as a grey scale value for each pixel. In this mode only Width*Height values are required. To produce the final image the Red, Green and Blue components are the set to this same value.

Author:
Julien Norman
See Also:
Serialized Form

Field Summary
 int GIF
           
 int JPG
           
 int PNG
           
(package private) static long serialVersionUID
           
 
Fields inherited from class org.joone.io.StreamOutputSynapse
fifo, nextPlugIn
 
Fields inherited from class org.joone.engine.Synapse
array, b_pattern, bitems, bouts, count, enabled, fwdLock, inps, items, learnable, m_batch, m_pattern, myLearner, outs, revLock
 
Constructor Summary
ImageOutputSynapse()
          Creates a new instance of ImageOutputSynapse
 
Method Summary
 java.util.TreeSet check()
          Checks and returns any problems found with the settings of this synapse.
 boolean getColourMode()
          Determines if this synapse is in colour mode.
 int getHeight()
          Gets the desired height of the generated image files.
 int getImageFileType()
          Obtains the image type JPG = 1, GIF = 2, PNG = 3 of the format of the output files.
 java.lang.String getOutputDirectory()
          Gets the directory where Image files will be created.
 int getWidth()
          Gets the desired width of the generated image files.
 void setColourMode(boolean ColourMode)
          Sets the colour mode of this synapse.
 void setHeight(int Height)
          Sets the desired height of the generated image files.
 void setImageFileType(int ImageFileType)
          Sets the image type JPG = 1, GIF = 2, PNG = 3 of the format of the generated image files.
 void setOutputDirectory(java.lang.String OutputDirectory)
          Sets the name of the directory where Image files will be created.
 void setWidth(int Width)
          Sets the desired width of the generated image files.
 void write(Pattern pattern)
          Writes the Neural Network pattern to an Image file, the Image type is specified by the ImageFileType property.
 
Methods inherited from class org.joone.io.StreamOutputSynapse
addPlugIn, backward, dataChanged, forward, fwdPut, getFifo, getPlugIn, getSeparator, isBuffered, removeAllPlugIns, revGet, setArrays, setBuffered, setDimensions, setPlugIn, setSeparator
 
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdGet, fwdPattern_consume, fwdPattern_produce, getCount, getFwdLock, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getRevLock, getSynapseNameSafely, getWeights, init, initLearner, InspectableTitle, Inspections, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, readResolve, reset, revPattern_consume, revPattern_produce, revPut, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setMonitor, setName, setOutputDimension, setOutputFull, setWeights, warnLogger, warnLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

JPG

public final int JPG
See Also:
Constant Field Values

GIF

public final int GIF
See Also:
Constant Field Values

PNG

public final int PNG
See Also:
Constant Field Values
Constructor Detail

ImageOutputSynapse

public ImageOutputSynapse()
Creates a new instance of ImageOutputSynapse

Method Detail

write

public void write(Pattern pattern)
Writes the Neural Network pattern to an Image file, the Image type is specified by the ImageFileType property.

Specified by:
write in class StreamOutputSynapse

getOutputDirectory

public java.lang.String getOutputDirectory()
Gets the directory where Image files will be created.


setOutputDirectory

public void setOutputDirectory(java.lang.String OutputDirectory)
Sets the name of the directory where Image files will be created.

Parameters:
OutputDirectory - The directory used to store generated image files.

getImageFileType

public int getImageFileType()
Obtains the image type JPG = 1, GIF = 2, PNG = 3 of the format of the output files.


setImageFileType

public void setImageFileType(int ImageFileType)
Sets the image type JPG = 1, GIF = 2, PNG = 3 of the format of the generated image files.

Parameters:
ImageFileType - JPG = 1, GIF = 2, PNG = 3.

getWidth

public int getWidth()
Gets the desired width of the generated image files.


setWidth

public void setWidth(int Width)
Sets the desired width of the generated image files.


getHeight

public int getHeight()
Gets the desired height of the generated image files.


setHeight

public void setHeight(int Height)
Sets the desired height of the generated image files.


getColourMode

public boolean getColourMode()
Determines if this synapse is in colour mode. false if in grey scale mode.

Returns:
The ColourMode if this synapse.

setColourMode

public void setColourMode(boolean ColourMode)
Sets the colour mode of this synapse.

Parameters:
ColourMode - true if in colour mode, false if in grey scale mode.

check

public java.util.TreeSet check()
Checks and returns any problems found with the settings of this synapse.

Specified by:
check in interface NeuralElement
Overrides:
check in class StreamOutputSynapse
Returns:
A TreeSet of problems or errors found with this synapse.
See Also:
InputPaternListener, OutputPaternListener


Submit Feedback to pmarrone@users.sourceforge.net