ptolemy.domains.sdf.lib.vq
Class ImageSequence
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
ptolemy.domains.sdf.lib.vq.ImageSequence
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class ImageSequence
- extends Source
Load a sequence of binary images from files, and create a sequence of
IntMatrixTokens from them. The data is assumed to row scanned, starting
at the top row. Each byte of the binary file is assumed to be the
greyscale intensity of a single pixel in the image.
The files to be loaded are specified as relative URLs from the base URL path.
Usually the base path should be set to the root ptolemy classpath.
The file names are created by replacing *'s in the filename with consecutive
integers (using zero padding). For example, specifying a URLtemplate of
"missa***.qcf" and a starting frame of
zero, will create the names:
- missa000.qcf
- missa001.qcf
- missa002.qcf
- ...
The name manufacturing algorithm is not especially robust, so
debug listeners attached to this actor will receive a list of the file names.
This actor could be greatly expanded to use the Java Advanced Imaging API
for loading images.
- Since:
- Ptolemy II 0.2
- Version:
- $Id: ImageSequence.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Steve Neuendorffer
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Method Summary |
private int |
_fullRead(java.io.InputStream s,
byte[] b)
|
void |
fire()
Fire this actor. |
void |
initialize()
Initialize this actor. |
Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup |
Methods inherited from class ptolemy.kernel.ComponentEntity |
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
imageURLTemplate
public Parameter imageURLTemplate
- The image filename templates.
imageColumns
public Parameter imageColumns
- The number of columns in each image.
imageRows
public Parameter imageRows
- The number of rows in each image.
startFrame
public Parameter startFrame
- The starting frame number.
endFrame
public Parameter endFrame
- The ending frame number.
_frameCount
private int _frameCount
_images
private IntMatrixToken[] _images
_frameBytes
private byte[] _frameBytes
_frameInts
private int[][] _frameInts
_imageColumns
private int _imageColumns
_imageRows
private int _imageRows
_startFrame
private int _startFrame
_endFrame
private int _endFrame
_frameNumber
private int _frameNumber
ImageSequence
public ImageSequence(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an actor with the given container and name.
- Parameters:
container
- The container.name
- The name of this actor.
- Throws:
IllegalActionException
- If the actor cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.
initialize
public void initialize()
throws IllegalActionException
- Initialize this actor.
Read in the image files.
- Specified by:
initialize
in interface Initializable
- Overrides:
initialize
in class AtomicActor
- Throws:
IllegalActionException
- If any of the input files could not
be read.
fire
public void fire()
throws IllegalActionException
- Fire this actor.
Output the next image in the sequence. If the sequence has no more
images, then loop back to the first image in the sequence.
- Specified by:
fire
in interface Executable
- Overrides:
fire
in class Source
- Throws:
IllegalActionException
- Not thrown in this base class.
_fullRead
private int _fullRead(java.io.InputStream s,
byte[] b)
throws java.io.IOException
- Throws:
java.io.IOException