PetaVision  Alpha
 All Data Structures Namespaces Functions Variables
PV::ImageFromMemoryBuffer Class Reference
Inheritance diagram for PV::ImageFromMemoryBuffer:
PV::BaseInput PV::HyPerLayer PV::BaseLayer PV::BaseObject

BaseInput Parameters

List of parameters needed from the BaseInput class

virtual int ioParam_offsets (enum ParamsIOFlag ioFlag)
 offsetX: offset in X direction
offsetY: offset in Y direction More...
 
virtual void ioParam_offsetAnchor (enum ParamsIOFlag ioFlag)
 offsetAnchor: Defines where the anchor point is for the offsets. More...
 
virtual void ioParam_writeImages (enum ParamsIOFlag ioFlag)
 writeImages: A boolean flag that specifies if the Image class should output the images.
 
virtual void ioParam_writeImagesExtension (enum ParamsIOFlag ioFlag)
 writeImageExtension: If writeImages is set, specifies the extention of the image output. More...
 
virtual void ioParam_autoResizeFlag (enum ParamsIOFlag ioFlag)
 autoResizeFlag: resize image before cropping to the layer More...
 
virtual void ioParam_aspectRatioAdjustment (enum ParamsIOFlag ioFlag)
 aspectRatioAdjustment: either "crop" or "pad" More...
 
virtual void ioParam_interpolationMethod (enum ParamsIOFlag ioFlag)
 interpolationMethod: either "bicubic" or "nearestNeighbor".
 
virtual void ioParam_inverseFlag (enum ParamsIOFlag ioFlag)
 inverseFlag: If set to true, inverts the image
 
virtual void ioParam_normalizeLuminanceFlag (enum ParamsIOFlag ioFlag)
 normalizeLuminanceFlag: If set to true, will normalize the image. The normalization method is determined by the normalizeStdDev parameter.
 
virtual void ioParam_normalizeStdDev (enum ParamsIOFlag ioFlag)
 normalizeStdDev: This flag is used if normalizeLuminanceFlag is true. If normalizeStdDev is set to true, the image will normalize with a mean of 0 and std of 1 If normalizeStdDev is set to false, the image will normalize with a min of 0 and a max of 1
 
virtual void ioParam_jitterFlag (enum ParamsIOFlag ioFlag)
 jitterFlag: If set to true, will move the image around by specified pixels
 
virtual void ioParam_jitterType (enum ParamsIOFlag ioFlag)
 jitterType: If jitter flag is set, specifies the type of jitter. 0 for random walk, 1 for random jump More...
 
virtual void ioParam_jitterRefractoryPeriod (enum ParamsIOFlag ioFlag)
 jitterRefactoryPeriod: If jitter flag is set, specifies the minimum amount of time until next jitter
 
virtual void ioParam_stepSize (enum ParamsIOFlag ioFlag)
 stepSize: If jitter flag is set, sets the step size
 
virtual void ioParam_persistenceProb (enum ParamsIOFlag ioFlag)
 persistenceProb: If jitter flag is set, sets the probability that offset stays the same
 
virtual void ioParam_recurrenceProb (enum ParamsIOFlag ioFlag)
 recurrenceProb: If jitter flag is set, sets the probability that the offset returns to bias position
 
virtual void ioParam_padValue (enum ParamsIOFlag ioFlag)
 padValue: If the image is being padded (image smaller than layer), the value to use for padding
 
virtual void ioParam_biasChangeTime (enum ParamsIOFlag ioFlag)
 biasChangeTime: If jitter flag is set, sets the time period for recalculating bias position
 
virtual void ioParam_biasConstraintMethod (enum ParamsIOFlag ioFlag)
 biasConstraintMethod: If jitter flag is set, defines the method to coerce into bounding box More...
 
virtual void ioParam_offsetConstraintMethod (enum ParamsIOFlag ioFlag)
 offsetConstraintMethod: If jitter flag is set, defines the method to coerce into bounding box More...
 
virtual void ioParam_writePosition (enum ParamsIOFlag ioFlag)
 writePosition: If jitter flag is set, writes position to input/image-pos.txt
 
virtual void ioParam_InitVType (enum ParamsIOFlag ioFlag)
 initVType: Image does not have a V, do not set
 
virtual void ioParam_triggerLayerName (enum ParamsIOFlag ioFlag)
 triggerLayerName: BaseInput and derived classes do not use triggering, and always set triggerLayerName to NULL.
 
virtual void ioParam_useImageBCflag (enum ParamsIOFlag ioFlag)
 useImageBCFlag: Specifies if the Image layer should use the image to fill margins
 

HyPerLayer Parameters

List of parameters needed from the HyPerLayer class

virtual void ioParam_dataType (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_updateGpu (enum ParamsIOFlag ioFlag)
 updateGpu: When compiled using CUDA or OpenCL GPU acceleration, this flag tells whether this layer's updateState method should use the GPU. If PetaVision was compiled without GPU acceleration, it is an error to set this flag to true.
 
virtual void ioParam_nxScale (enum ParamsIOFlag ioFlag)
 nxScale: Defines the relationship between the x column size and the layer size. More...
 
virtual void ioParam_nyScale (enum ParamsIOFlag ioFlag)
 nyScale: Defines the relationship between the y column size and the layer size. More...
 
virtual void ioParam_nf (enum ParamsIOFlag ioFlag)
 nf: Defines how many features this layer has
 
virtual void ioParam_phase (enum ParamsIOFlag ioFlag)
 phase: Defines the ordering in which each layer is updated
 
virtual void ioParam_mirrorBCflag (enum ParamsIOFlag ioFlag)
 mirrorBCflag: If set to true, the margin will mirror the data
 
virtual void ioParam_valueBC (enum ParamsIOFlag ioFlag)
 valueBC: If mirrorBC is set to true, Uses the specified value for the margin area
 
virtual void ioParam_initializeFromCheckpointFlag (enum ParamsIOFlag ioFlag)
 initializeFromCheckpointFlag: If set to true, initialize using checkpoint direcgtory set in HyPerCol. More...
 
virtual void ioParam_triggerFlag (enum ParamsIOFlag ioFlag)
 triggerFlag: (Deprecated) Specifies if this layer is being triggered More...
 
virtual void ioParam_triggerOffset (enum ParamsIOFlag ioFlag)
 triggerOffset: If triggerLayer is set, triggers <triggerOffset> timesteps before target trigger More...
 
virtual void ioParam_triggerBehavior (enum ParamsIOFlag ioFlag)
 triggerBehavior: If triggerLayerName is set, this parameter specifies how the trigger is handled. More...
 
virtual void ioParam_triggerResetLayerName (enum ParamsIOFlag ioFlag)
 triggerResetLayerName: If triggerLayerName is set, this parameter specifies the layer to use for updating the state when the trigger happens. If set to NULL or the empty string, use triggerLayerName.
 
virtual void ioParam_writeStep (enum ParamsIOFlag ioFlag)
 writeStep: Specifies how often to output a pvp file for this layer More...
 
virtual void ioParam_initialWriteTime (enum ParamsIOFlag ioFlag)
 initialWriteTime: Specifies the first timestep to start outputing pvp files
 
virtual void ioParam_sparseLayer (enum ParamsIOFlag ioFlag)
 sparseLayer: Specifies if the layer should be considered sparese for optimization and output
 
virtual void ioParam_writeSparseValues (enum ParamsIOFlag ioFlag)
 writeSparseValues: If sparseLayer is set, specifies if the pvp file should write sparse value file
 

Image Parameters

List of parameters needed from the ImageFromMemoryBuffer class

bool hasNewImageFlag
 
virtual void ioParam_inputPath (enum ParamsIOFlag ioFlag)
 inputPath: Not used by ImageFromMemoryBuffer. More...
 
virtual int initializeActivity (double time, double dt)
 
int retrieveData (double timef, double dt, int batchIndex)
 
int initialize_base ()
 
template<typename pixeltype >
pvadata_t pixelTypeConvert (pixeltype q, pixeltype zeroval, pixeltype oneval)
 

Public Member Functions

 ImageFromMemoryBuffer (char const *name, HyPerCol *hc)
 
virtual bool activityIsSpiking ()
 
virtual float addGpuTimers ()
 
virtual int allocateDataStructures ()
 
virtual double calcTimeScale (int batchIdx)
 
virtual int checkpointRead (const char *cpDir, double *timeptr)
 
virtual int checkpointWrite (const char *cpDir)
 
virtual int communicateInitInfo ()
 
void copyAllActivityFromDevice ()
 
void copyAllGSynFromDevice ()
 
void copyAllGSynToDevice ()
 
void copyAllVFromDevice ()
 
int exchange ()
 
int flushOutputStateStream ()
 
pvdata_t * getActivity ()
 
const int * getBiases ()
 
int getBiasX ()
 
int getBiasY ()
 
pvdata_t * getChannel (ChannelType ch)
 
virtual float getChannelTimeConst (enum ChannelType channel_type)
 
PVLayergetCLayer ()
 
int getDataHeight ()
 
int getDataLeft ()
 
bool getDataStructuresAllocatedFlag ()
 
int getDataTop ()
 
PVDataType getDataType ()
 
int getDataWidth ()
 
virtual double getDeltaTriggerTime ()
 
virtual double getDeltaUpdateTime ()
 
PVCuda::CudaBuffer * getDeviceActiveIndices ()
 
PVCuda::CudaBuffer * getDeviceActivity ()
 
PVCuda::CudaBuffer * getDeviceDatastore ()
 
PVCuda::CudaBuffer * getDeviceGSyn ()
 
PVCuda::CudaBuffer * getDeviceNumActive ()
 
PVCuda::CudaBuffer * getDeviceV ()
 
int getImageLeft ()
 
virtual PVLayerLoc getImageLoc ()
 
int getImageStartX ()
 
int getImageStartY ()
 
int getImageTop ()
 
bool getInitialValuesSetFlag ()
 
bool getInitInfoCommunicatedFlag ()
 
char * getInputPath ()
 
char const * getKeyword () const
 
double getLastUpdateTime ()
 
const pvdata_t * getLayerData (int delay=0)
 
int getLayerId ()
 
const PVLayerLocgetLayerLoc ()
 
float getMaxRate ()
 
char const * getName () const
 
double getNextUpdateTime ()
 
int getNumChannels ()
 
int getNumDelayLevels ()
 
int getNumExtended ()
 
int getNumExtendedAllBatches ()
 
int getNumGlobalExtended ()
 
int getNumGlobalNeurons ()
 
int getNumNeurons ()
 
int getNumNeuronsAllBatches ()
 
int getNumProbes ()
 
int getOffsetX (const char *offsetAnchor, int offsetX)
 
int getOffsetY (const char *offsetAnchor, int offsetY)
 
char const * getOutputStatePath ()
 
HyPerColgetParent () const
 
int getPhase ()
 
LayerProbegetProbe (int n)
 
bool getRecvGpu ()
 
bool getSparseFlag ()
 
virtual double getTimeScale (int batchIdx)
 
bool getUpdatedDeviceActivityFlag ()
 
bool getUpdatedDeviceDatastoreFlag ()
 
bool getUpdatedDeviceGSynFlag ()
 
bool getUpdateGpu ()
 
pvdata_t * getV ()
 
pvdata_t getValueBC ()
 
int getXScale ()
 
int getYScale ()
 
int increaseDelayLevels (int neededDelay)
 
int initializeState ()
 
virtual int insertProbe (LayerProbe *probe)
 
int ioParams (enum ParamsIOFlag ioFlag)
 
bool isExtended ()
 
int mirrorInteriorToBorder (int whichBorder, PVLayerCube *cube, PVLayerCube *borderCube)
 
int mirrorInteriorToBorder (PVLayerCube *cube, PVLayerCube *borderCube)
 
virtual int mirrorToEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorth (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorthEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorthWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouth (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouthEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouthWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual bool needUpdate (double time, double dt)
 
int outputProbeParams ()
 
virtual int outputState (double time, bool last=false)
 
virtual int publish (InterColComm *comm, double time)
 
virtual int recvAllSynapticInput ()
 
virtual int requireChannel (int channelNeeded, int *numChannelsResult)
 
virtual int requireMarginWidth (int marginWidthNeeded, int *marginWidthResult, char axis)
 
int resetBuffer (pvdata_t *buf, int numItems)
 
virtual int resetGSynBuffers (double timef, double dt)
 
void setAllocDeviceActiveIndices ()
 
void setAllocDeviceActivity ()
 
void setAllocDeviceDatastore ()
 
void setAllocDeviceGSyn ()
 
void setAllocDeviceV ()
 
void setDataStructuresAllocatedFlag ()
 
void setInitialValuesSetFlag ()
 
void setInitInfoCommunicatedFlag ()
 
void setLayerId (int id)
 
template<typename pixeltype >
int setMemoryBuffer (pixeltype const *externalBuffer, int height, int width, int numbands, int xstride, int ystride, int bandstride, pixeltype zeroval, pixeltype oneval)
 
template<typename pixeltype >
int setMemoryBuffer (pixeltype const *externalBuffer, int height, int width, int numbands, int xstride, int ystride, int bandstride, pixeltype zeroval, pixeltype oneval, int offsetX, int offsetY, char const *offsetAnchor)
 
virtual void setNextUpdateTime (double in)
 
void setUpdatedDeviceActivityFlag (bool in)
 
void setUpdatedDeviceDatastoreFlag (bool in)
 
void setUpdatedDeviceGSynFlag (bool in)
 
virtual void syncGpu ()
 
void synchronizeMarginWidth (HyPerLayer *layer)
 
virtual int updateActiveIndices ()
 
virtual int updateAllActiveIndices ()
 
virtual int updateBorder (double time, double dt)
 
virtual int updateNextTriggerTime ()
 
virtual int updateNextUpdateTime ()
 
virtual int updateState (double time, double dt)
 
virtual int updateStateGpu (double time, double dt)
 
virtual int updateStateWrapper (double time, double dt)
 
bool useMirrorBCs ()
 
virtual int waitOnPublish (InterColComm *comm)
 
virtual int writeActivity (double timed)
 
virtual int writeActivitySparse (double timed, bool includeValues)
 
int writeImage (const char *filename, int batchIdx)
 
virtual int writeTimers (std::ostream &stream)
 

Static Public Member Functions

static bool localDimensionsEqual (PVLayerLoc const *loc1, PVLayerLoc const *loc2)
 
template<typename T >
static int readBufferFile (const char *filename, InterColComm *comm, double *timed, T **buffers, int numbands, bool extended, const PVLayerLoc *loc)
 
template<typename T >
static int writeBufferFile (const char *filename, InterColComm *comm, double dtime, T **buffers, int numbands, bool extended, const PVLayerLoc *loc)
 

Data Fields

PVLayerclayer
 

Protected Member Functions

virtual int allocateActivity ()
 
template<typename T >
int allocateBuffer (T **buf, int bufsize, const char *bufname)
 
virtual int allocateBuffers ()
 
virtual int allocateClayerBuffers ()
 
int allocateCube ()
 
virtual int allocateDeviceBuffers ()
 
int allocateExtendedBuffer (pvdata_t **buf, const char *bufname)
 
virtual int allocateGSyn ()
 
virtual int allocatePrevActivity ()
 
int allocateRestrictedBuffer (pvdata_t **buf, const char *bufname)
 
virtual int allocateUpdateKernel ()
 
virtual int allocateV ()
 
int bicubicInterp (pvadata_t const *bufferIn, int widthIn, int heightIn, int numBands, int xStrideIn, int yStrideIn, int bandStdrideIn, pvadata_t *bufferOut, int widthOut, int heightOut)
 
virtual int calcBias (int current_bias, int step, int sizeLength)
 
virtual int calcBiasedOffset (int bias, int current_offset, int step, int sizeLength)
 
int calcLocalBox (int rank, int *dataLeft, int *dataTop, int *imageLeft, int *imageTop, int *width, int *height)
 
virtual int calcNewBiases (int stepSize)
 
virtual bool calcNewOffsets (int stepSize)
 
void calcNumExtended ()
 
virtual int callUpdateState (double timed, double dt)
 
int checkValidAnchorString ()
 
virtual bool constrainBiases ()
 
virtual bool constrainOffsets ()
 
int copyFromInteriorBuffer (float *buf, int batchIdx, float fac)
 
virtual int copyInitialStateToGPU ()
 
int copyToInteriorBuffer (unsigned char *buf, int batchIdx, float fac)
 
virtual int doUpdateState (double timef, double dt, const PVLayerLoc *loc, pvdata_t *A, pvdata_t *V, int num_channels, pvdata_t *GSynHead)
 
virtual int doUpdateStateGpu (double timef, double dt, const PVLayerLoc *loc, pvdata_t *A, pvdata_t *V, int num_channels, pvdata_t *GSynHead)
 
template<typename T >
int freeBuffer (T **buf)
 
void freeChannels ()
 
int freeClayer ()
 
int freeExtendedBuffer (pvdata_t **buf)
 
int freeRestrictedBuffer (pvdata_t **buf)
 
virtual int getFrame (double timef, double dt)
 
int incrementNBands (int *numCalls)
 
virtual int initClayer ()
 
int initialize (char const *name, HyPerCol *hc)
 
virtual int initializeActivity ()
 
virtual int initializeV ()
 
int initRandState ()
 
virtual int ioParamsFillGroup (enum ParamsIOFlag ioFlag)
 
virtual bool jitter ()
 
int nearestNeighborInterp (pvadata_t const *bufferIn, int widthIn, int heightIn, int numBands, int xStrideIn, int yStrideIn, int bandStdrideIn, pvadata_t *bufferOut, int widthOut, int heightOut)
 
virtual bool needReset (double timed, double dt)
 
int openOutputStateFile ()
 
char * pathInCheckpoint (const char *cpDir, const char *suffix)
 
virtual int postProcess (double timef, double dt)
 
virtual int readActivityFromCheckpoint (const char *cpDir, double *timeptr)
 
int readDataStoreFromFile (const char *filename, InterColComm *comm, double *timed)
 
virtual int readDelaysFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int readStateFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int readVFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int resetStateOnTrigger ()
 
virtual int resizeInput ()
 
virtual int runUpdateKernel ()
 
virtual int scatterInput (int batchIndex)
 
virtual int setActivity ()
 
virtual int setInitialValues ()
 
int setLayerLoc (PVLayerLoc *layerLoc, float nxScale, float nyScale, int nf, int numBatches)
 
int setName (char const *name)
 
int setParent (HyPerCol *hc)
 
int writeDataStoreToFile (const char *filename, InterColComm *comm, double dtime)
 

Static Protected Member Functions

static pvadata_t bicubic (pvadata_t x)
 
static int calcBandWeights (int numBands, float *bandweights, InputColorType colorType)
 
static bool constrainPoint (int *point, int min_x, int max_x, int min_y, int max_y, int method)
 
static int convertGrayScaleToMultiBand (float **buffer, int nx, int ny, int numBands)
 
static int convertToGrayScale (float **buffer, int nx, int ny, int numBands, InputColorType colorType)
 
static void equalBandWeights (int numBands, float *bandweights)
 
static int equalizeMargins (HyPerLayer *layer1, HyPerLayer *layer2)
 

Protected Attributes

bool allocDeviceActiveIndices
 
bool allocDeviceActivity
 
bool allocDeviceDatastore
 
bool allocDeviceGSyn
 
bool allocDeviceV
 
char * aspectRatioAdjustment
 
bool autoResizeFlag
 
double biasChangeTime
 
int biasConstraintMethod
 
int biases [2]
 
PVCuda::CudaBuffer * d_ActiveIndices
 
PVCuda::CudaBuffer * d_Activity
 
PVCuda::CudaBuffer * d_Datastore
 
PVCuda::CudaBuffer * d_GSyn
 
PVCuda::CudaBuffer * d_numActive
 
PVCuda::CudaBuffer * d_V
 
pvdata_t * data
 
int dataHeight
 
int dataLeft
 
bool dataStructuresAllocatedFlag
 
int dataTop
 
PVDataType dataType
 
char * dataTypeString
 
int dataWidth
 
PV_Streamfp_pos
 
PVCuda::CudaTimer * gpu_recvsyn_timer
 
PVCuda::CudaTimer * gpu_update_timer
 
pvdata_t ** GSyn
 
InputColorType imageColorType
 
pvdata_t * imageData
 
int imageLeft
 
PVLayerLoc imageLoc
 
int imageTop
 
bool initializeFromCheckpointFlag
 
bool initialValuesSetFlag
 
double initialWriteTime
 
bool initInfoCommunicatedFlag
 
InitVinitVObject
 
char * inputPath
 
InputInterpolationMethod interpolationMethod
 
bool inverseFlag
 
Timerio_timer
 
int ioAppend
 
int jitterFlag
 
int jitterRefractoryPeriod
 
int jitterType
 
PVCuda::CudaKernel * krUpdate
 
double lastUpdateTime
 
int layerId
 
int * marginIndices
 
float maxRate
 
bool mirrorBCflag
 
MPI_Datatype * mpi_datatypes
 
char * name
 
double nextBiasChange
 
double nextTriggerTime
 
double nextUpdateTime
 
bool normalizeLuminanceFlag
 
bool normalizeStdDev
 
int numChannels
 
int numDelayLevels
 
int numFeatures
 
int numMargin
 
int numProbes
 
int numSynchronizedMarginWidthLayers
 
float nxScale
 
float nyScale
 
char * offsetAnchor
 
int offsetConstraintMethod
 
int offsets [2]
 
PV_StreamoutputStateStream
 
float padValue
 
HyPerColparent
 
float persistenceProb
 
int phase
 
LayerProbe ** probes
 
Timerpublish_timer
 
RandomrandState
 
float recurrenceProb
 
std::vector< BaseConnection * > recvConns
 
bool recvGpu
 
Timerrecvsyn_calc_timer
 
Timerrecvsyn_timer
 
float resizeFactor
 
bool restartFlag
 
unsigned int rngSeedBase
 
bool sparseLayer
 
int stepSize
 
HyPerLayer ** synchronizedMarginWidthLayers
 
pvdata_t ** thread_gSyn
 
Timertimescale_timer
 
int timeSinceLastJitter
 
char * triggerBehavior
 
TriggerBehaviorType triggerBehaviorType
 
bool triggerFlag
 
HyPerLayertriggerLayer
 
char * triggerLayerName
 
double triggerOffset
 
HyPerLayertriggerResetLayer
 
char * triggerResetLayerName
 
Timerupdate_timer
 
bool updatedDeviceActivity
 
bool updatedDeviceDatastore
 
bool updatedDeviceGSyn
 
bool updateGpu
 
bool useImageBCflag
 
pvdata_t valueBC
 
int writeActivityCalls
 
int writeActivitySparseCalls
 
int writeImages
 
char * writeImagesExtension
 
int writePosition
 
bool writeSparseValues
 
double writeStep
 
double writeTime
 
int xmargin
 
int ymargin
 

Static Protected Attributes

static const int RANDOM_JUMP = 1
 
static const int RANDOM_WALK = 0
 

Detailed Description

Definition at line 21 of file ImageFromMemoryBuffer.hpp.

Member Function Documentation

int PV::HyPerLayer::allocateDeviceBuffers ( )
protectedvirtualinherited

Allocate GPU buffers. This must be called after PVLayer data have been allocated.

Definition at line 1012 of file HyPerLayer.cpp.

int PV::HyPerLayer::allocateExtendedBuffer ( pvdata_t **  buf,
const char *  bufname 
)
protectedinherited

Allocates an extended buffer (that is, buffer's length is getNumExtendedAllBatches()).

Definition at line 529 of file HyPerLayer.cpp.

int PV::HyPerLayer::allocateRestrictedBuffer ( pvdata_t **  buf,
const char *  bufname 
)
protectedinherited

Allocates a restricted buffer (that is, buffer's length is getNumNeuronsAllBatches()).

Definition at line 525 of file HyPerLayer.cpp.

int PV::BaseInput::bicubicInterp ( pvadata_t const *  bufferIn,
int  widthIn,
int  heightIn,
int  numBands,
int  xStrideIn,
int  yStrideIn,
int  bandStdrideIn,
pvadata_t *  bufferOut,
int  widthOut,
int  heightOut 
)
protectedinherited

Resizes an image using band-by-band bicubic interpolation of the bufferIn array, placing the result in the bufferOut array. bufferIn is widthIn-by-heightOut-by-numBands; bufferOut is widthOut-by-heightOut-by-numBands. Inputs: bufferIn A pointer to the buffer containing the image. widthIn The width in pixels of the entire image heightIn The height in pixels of the entire image numbands The number of bands in the image: i.e., grayscale=1, RGB=3, etc. xStrideIn The difference between the memory locations, as pointers of type pixeltype, between two pixels adjacent in the x-direction, with the same y-coordinate and band number. yStrideIn The difference between the memory locations, as pointers of type pixeltype, between two pixels adjacent in the y-direction, with the same x-coordinate and band number. bandStrideIn The difference between the memory locations, as pointers of type pixeltype, between two pixels from adjacent bands, with the same x- and y-coordinates. bufferOut The buffer for the resized image widthOut The width in pixels of the entire image heightOut The height in pixels of the entire image

Definition at line 579 of file BaseInput.cpp.

int PV::BaseInput::calcBandWeights ( int  numBands,
float *  bandweights,
InputColorType  colorType 
)
staticprotectedinherited

Based on the value of colorType, fills the bandweights buffer with weights to assign to each band of a multiband buffer when converting to grayscale.

Definition at line 1286 of file BaseInput.cpp.

int PV::BaseInput::calcBias ( int  current_bias,
int  step,
int  sizeLength 
)
protectedvirtualinherited

Calculate a bias in x or y here. Input argument is the step size and the size of the interval of possible values Output is the value of the bias. It can perform a random walk of a fixed stepsize or it can perform a random jump up to a maximum length equal to step.

Definition at line 933 of file BaseInput.cpp.

int PV::BaseInput::calcBiasedOffset ( int  bias,
int  current_offset,
int  step,
int  sizeLength 
)
protectedvirtualinherited

Return an offset that moves randomly around position bias Perform a random jump of maximum length equal to step. The routine returns the resulting offset. (The recurrenceProb test has been moved to the calling routine jitter() )

Definition at line 987 of file BaseInput.cpp.

int PV::BaseInput::calcLocalBox ( int  rank,
int *  dataLeft,
int *  dataTop,
int *  imageLeft,
int *  imageTop,
int *  width,
int *  height 
)
protectedinherited

Calculates the intersection of the given rank's local extended region with the imageData, based on the offsetX, offsetY, and offsetAnchor parameters. Used in scatterInput by the root process to determine what part of the imageData buffer to scatter to the other processes. Return value is zero if width and height are both positive, and nonzero if either is negative (i.e. the local layer and image do not intersect).

Definition at line 632 of file BaseInput.cpp.

int PV::HyPerLayer::callUpdateState ( double  timed,
double  dt 
)
protectedvirtualinherited

Called by updateStateWrapper when updating the state in the usual way (as opposed to being triggered when triggerBehavior is resetStateOnTrigger). It calls either updateState or updateStateGPU. It also starts and stops the update timer.

Definition at line 1689 of file HyPerLayer.cpp.

int PV::BaseInput::checkpointRead ( const char *  cpDir,
double *  timeptr 
)
virtualinherited

return some useful information about the image

Reimplemented from PV::HyPerLayer.

Reimplemented in PV::MoviePvp.

Definition at line 1182 of file BaseInput.cpp.

int PV::BaseInput::checkValidAnchorString ( )
protectedinherited

Returns PV_SUCCESS if offsetAnchor is a valid anchor string (two characters long; first characters one of 't', 'c', or 'b'; second characters one of 'l', 'c', or 'r') Returns PV_FAILURE otherwise

Definition at line 339 of file BaseInput.cpp.

int PV::BaseInput::convertGrayScaleToMultiBand ( float **  buffer,
int  nx,
int  ny,
int  numBands 
)
staticprotectedinherited

Converts a grayscale buffer to a multiband buffer, by replicating the buffer in each band. On entry, *buffer points to an nx-by-ny-by-1 buffer that must have been created with the new[] operator. On exit, *buffer points to an nx-by-ny-by-numBands buffer that was created with the new[] operator.

Definition at line 1258 of file BaseInput.cpp.

int PV::BaseInput::convertToGrayScale ( float **  buffer,
int  nx,
int  ny,
int  numBands,
InputColorType  colorType 
)
staticprotectedinherited

Converts a multiband buffer to a grayscale buffer, using the colorType to weight the bands. On entry, *buffer points to an nx-by-ny-by-numBands buffer that must have been created with the new[] operator. On exit, *buffer points to an nx-by-ny-by-1 buffer that was created with the new[] operator.

Definition at line 1224 of file BaseInput.cpp.

static void PV::BaseInput::equalBandWeights ( int  numBands,
float *  bandweights 
)
inlinestaticprotectedinherited

Called by calcBandWeights when the color type is unrecognized; it fills each bandweights entry with 1/numBands.

Definition at line 313 of file BaseInput.hpp.

int PV::HyPerLayer::freeExtendedBuffer ( pvdata_t **  buf)
protectedinherited

Frees a buffer created by allocateRestrictedBuffer(). Note that there is no checking whether the buffer was created by allocateExtendedBuffer(), or any other allocateBuffer()-related method.

Definition at line 448 of file HyPerLayer.cpp.

int PV::HyPerLayer::freeRestrictedBuffer ( pvdata_t **  buf)
protectedinherited

Frees a buffer created by allocateRestrictedBuffer(). Note that there is no checking whether the buffer was created by allocateRestrictedBuffer(), or any other allocateBuffer()-related method.

Definition at line 444 of file HyPerLayer.cpp.

double PV::HyPerLayer::getDeltaTriggerTime ( )
virtualinherited

A function to return the interval between triggering times. A negative value means that the layer never triggers (either there is no triggerLayer or the triggerLayer never updates).

Definition at line 1657 of file HyPerLayer.cpp.

double PV::ImageFromMemoryBuffer::getDeltaUpdateTime ( )
virtual

For ImageFromMemoryBuffer, the updateTime is the parent->getStopTime() - parent->getStartTime(). Implemented to allow triggering off of an ImageFromMemoryBuffer layer.

Reimplemented from PV::HyPerLayer.

Definition at line 141 of file ImageFromMemoryBuffer.cpp.

int PV::BaseInput::getFrame ( double  timef,
double  dt 
)
protectedvirtualinherited

This is the interface for loading a new "frame" (which can be either pvp, image, etc) into the activity buffer. This function calls retrieveData, scatterInput, and postProcess.

Reimplemented in PV::ImagePvp.

Definition at line 408 of file BaseInput.cpp.

int PV::BaseInput::getImageStartX ( )
inlineinherited

getImageStartX() returns the x-coordinate in the original input corresponding to x=0 in layer coordinates.

Definition at line 341 of file BaseInput.hpp.

int PV::BaseInput::getImageStartY ( )
inlineinherited

getImageStartY() returns the y-coordinate in the original input corresponding to y=0 in the layer coordinates.

Definition at line 346 of file BaseInput.hpp.

const pvdata_t * PV::HyPerLayer::getLayerData ( int  delay = 0)
inherited

Returns the activity data for the layer. This data is in the extended space (with margins).

Definition at line 1551 of file HyPerLayer.cpp.

int PV::ImageFromMemoryBuffer::initializeActivity ( double  time,
double  dt 
)
protectedvirtual

Called by HyPerLayer::setActivity() during setInitialValues stage; calls copyBuffer()

Definition at line 125 of file ImageFromMemoryBuffer.cpp.

void PV::BaseInput::ioParam_aspectRatioAdjustment ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

aspectRatioAdjustment: either "crop" or "pad"

If autoResizeFlag is true * and the input buffer's aspect ratio is different from the layer's, this parameter controls whether to resize the image so that it completely covers the layer and then crop; or to resize the image to completely fit inside the layer and then pad.

Definition at line 167 of file BaseInput.cpp.

void PV::BaseInput::ioParam_autoResizeFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

autoResizeFlag: resize image before cropping to the layer

If set to true, image will be resized to the smallest size with the same aspect ratio that completely covers the layer size, and then cropped according to the offsets and offsetAnchor parameters inherited from BaseInput.

Definition at line 163 of file BaseInput.cpp.

void PV::BaseInput::ioParam_biasConstraintMethod ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

biasConstraintMethod: If jitter flag is set, defines the method to coerce into bounding box

Can be 0 (ignore), 1 (mirror BC), 2 (threshold), or 3 (circular BC)

Definition at line 298 of file BaseInput.cpp.

void PV::HyPerLayer::ioParam_initializeFromCheckpointFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

initializeFromCheckpointFlag: If set to true, initialize using checkpoint direcgtory set in HyPerCol.

Checkpoint read directory must be set in HyPerCol to initialize from checkpoint.

Definition at line 835 of file HyPerLayer.cpp.

virtual void PV::ImageFromMemoryBuffer::ioParam_inputPath ( enum ParamsIOFlag  ioFlag)
inlineprotectedvirtual

inputPath: Not used by ImageFromMemoryBuffer.

ImageFromMemoryBuffer does not read the input from a path. Instead, call setMemoryBuffer()

Reimplemented from PV::BaseInput.

Definition at line 90 of file ImageFromMemoryBuffer.hpp.

void PV::BaseInput::ioParam_jitterType ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

jitterType: If jitter flag is set, specifies the type of jitter. 0 for random walk, 1 for random jump

  • Random Walk: Jitters the specified step in any direction
  • Random Jump: Jitters any value between -step and step in any direction

Definition at line 246 of file BaseInput.cpp.

void PV::HyPerLayer::ioParam_nxScale ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

nxScale: Defines the relationship between the x column size and the layer size.

Must be 2^n or 1/2^n

Definition at line 805 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_nyScale ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

nyScale: Defines the relationship between the y column size and the layer size.

Must be 2^n or 1/2^n

Definition at line 809 of file HyPerLayer.cpp.

void PV::BaseInput::ioParam_offsetAnchor ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

offsetAnchor: Defines where the anchor point is for the offsets.

Specified as a 2 character string, "xy"
x can be 'l', 'c', or 'r' for left, center, right respectively
y can be 't', 'c', or 'b' for top, center, bottom respectively
Defaults to "tl"

Definition at line 138 of file BaseInput.cpp.

void PV::BaseInput::ioParam_offsetConstraintMethod ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

offsetConstraintMethod: If jitter flag is set, defines the method to coerce into bounding box

Can be 0 (ignore), 1 (mirror BC), 2 (threshold), or 3 (circular BC)

Definition at line 309 of file BaseInput.cpp.

int PV::BaseInput::ioParam_offsets ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

offsetX: offset in X direction
offsetY: offset in Y direction

Defines an offset in image space where the column is viewing the image

Definition at line 131 of file BaseInput.cpp.

void PV::HyPerLayer::ioParam_triggerBehavior ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerBehavior: If triggerLayerName is set, this parameter specifies how the trigger is handled.

The possible values of triggerBehavior are:

  • "updateOnlyOnTrigger": updateState is called (computing activity buffer from GSyn) only on triggering timesteps. On other timesteps the layer's state remains unchanged.
  • "resetStateOnTrigger": On timesteps where the trigger occurs, the membrane potential is copied from the layer specified in triggerResetLayerName and setActivity is called. On nontriggering timesteps, updateState is called. For backward compatibility, this parameter defaults to updateOnlyOnTrigger.

Definition at line 912 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_triggerFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerFlag: (Deprecated) Specifies if this layer is being triggered

Defaults to false. This flag is deprecated. To turn triggering off, set triggerLayer to NULL or the empty string. It is an error to set this flag to false and triggerLayer to a nonempty string.

Reimplemented in PV::ConstantLayer.

Definition at line 875 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_triggerOffset ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerOffset: If triggerLayer is set, triggers <triggerOffset> timesteps before target trigger

Defaults to 0

Definition at line 903 of file HyPerLayer.cpp.

void PV::BaseInput::ioParam_writeImagesExtension ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

writeImageExtension: If writeImages is set, specifies the extention of the image output.

Defaults to .tif

Definition at line 156 of file BaseInput.cpp.

void PV::HyPerLayer::ioParam_writeStep ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

writeStep: Specifies how often to output a pvp file for this layer

Defaults to every timestep. -1 specifies not to write at all.

Definition at line 952 of file HyPerLayer.cpp.

int PV::ImageFromMemoryBuffer::ioParamsFillGroup ( enum ParamsIOFlag  ioFlag)
protectedvirtual

The function that calls all ioParam functions

Reimplemented from PV::BaseInput.

Definition at line 42 of file ImageFromMemoryBuffer.cpp.

int PV::HyPerLayer::mirrorInteriorToBorder ( int  whichBorder,
PVLayerCube cube,
PVLayerCube border 
)
inherited

Copy cube data to the border region while applying boundary conditions

  • this implements mirror boundary conditions
  • assumes both input PVLayerCubes are of identical size and shape, typically the same struct

Definition at line 1562 of file HyPerLayer.cpp.

bool PV::HyPerLayer::needReset ( double  timed,
double  dt 
)
protectedvirtualinherited

Returns true if the trigger behavior is resetStateOnTrigger and the layer was triggered.

Definition at line 1666 of file HyPerLayer.cpp.

virtual bool PV::ImageFromMemoryBuffer::needUpdate ( double  time,
double  dt 
)
inlinevirtual

Returns true if a new image has been set by a call to setMemoryBuffer without having been copied to the activity buffer by a call to copyBuffer() (which is called by either updateState or initializeActivity)

Reimplemented from PV::HyPerLayer.

Definition at line 55 of file ImageFromMemoryBuffer.hpp.

int PV::ImageFromMemoryBuffer::outputState ( double  time,
bool  last = false 
)
virtual

ImageFromMemoryBuffer uses the same outputState as HyPerLayer

Reimplemented from PV::HyPerLayer.

Definition at line 145 of file ImageFromMemoryBuffer.cpp.

int PV::BaseInput::postProcess ( double  timef,
double  dt 
)
protectedvirtualinherited

This function achieves post processing of the activity buffer after a frame is loaded.

Definition at line 778 of file BaseInput.cpp.

int PV::HyPerLayer::resetStateOnTrigger ( )
protectedvirtualinherited

Called instead of updateState when triggerBehavior is "resetStateOnTrigger" and a triggering event occurs. Copies the membrane potential V from triggerResetLayer and then calls setActivity to update A.

Definition at line 1747 of file HyPerLayer.cpp.

int PV::BaseInput::resizeInput ( )
protectedvirtualinherited

This method is called during scatterInput, by the root process only. It uses the values of autoResizeFlag, aspectRatioAdjustment, and ImageBCflag to resize the imageData buffer. It also updates the nxGlobal, nyGlobal, and nf fields of imageLoc, and the resizeFactor data member.

Definition at line 495 of file BaseInput.cpp.

int PV::ImageFromMemoryBuffer::retrieveData ( double  timef,
double  dt,
int  batchIndex 
)
protectedvirtual

This pure virtual function gets called from getFrame by the root process only. Derived classes should set the nxGlobal, nyGlobal, and nf fields of imageLoc. If the product of nxGlobal, nyGlobal, and nf changes, retrieveData should free imageData with delete[] and reallocate imageData with new[], to prevent memory leaks. retrieveData should also set the imageColorType data member.

Implements PV::BaseInput.

Definition at line 135 of file ImageFromMemoryBuffer.cpp.

int PV::BaseInput::scatterInput ( int  batchIndex)
protectedvirtualinherited

This function scatters the imageData buffer to the activity buffers of the several MPI processes.

Definition at line 420 of file BaseInput.cpp.

template<typename pixeltype >
int PV::ImageFromMemoryBuffer::setMemoryBuffer ( pixeltype const *  externalBuffer,
int  height,
int  width,
int  numbands,
int  xstride,
int  ystride,
int  bandstride,
pixeltype  zeroval,
pixeltype  oneval 
)

Sets the image. Under MPI, nonroot processes ignore the externalBuffer argument; all other arguments must be the same across all processes.

Inputs: buffer A pointer to the beffer containing the image. Under MPI, only the root process uses buffer and the root process scatters the image to the other processes. height The height in pixels of the entire image width The width in pixels of the entire image numbands The number of bands in the image: i.e., grayscale=1, RGB=3, etc. xstride The difference between the memory locations, as pointers of type pixeltype, between two pixels adjacent in the x-direction, with the same y-coordinate and band number. ystride The difference between the memory locations, as pointers of type pixeltype, between two pixels adjacent in the y-direction, with the same x-coordinate and band number. bandstride The difference between the memory locations, as pointers of type pixeltype, between two pixels from adjacent bands, with the same x- and y-coordinates. zeroval The value that should be converted to 0.0f internally. oneval The value that should be converted to 1.0f internally. Values other than zeroval and oneval are converted to floats using a linear transformation.

Definition at line 50 of file ImageFromMemoryBuffer.cpp.

template<typename pixeltype >
int PV::ImageFromMemoryBuffer::setMemoryBuffer ( pixeltype const *  externalBuffer,
int  height,
int  width,
int  numbands,
int  xstride,
int  ystride,
int  bandstride,
pixeltype  zeroval,
pixeltype  oneval,
int  offsetX,
int  offsetY,
char const *  offsetAnchor 
)

Sets the image. Overloads setMemoryBuffer to also change the parameters offsetX, offsetY, and offsetAnchor.

Definition at line 102 of file ImageFromMemoryBuffer.cpp.

virtual void PV::HyPerLayer::setNextUpdateTime ( double  in)
inlinevirtualinherited

A function to set nextUpdateTime to a specific time

Definition at line 423 of file HyPerLayer.hpp.

int PV::HyPerLayer::updateNextTriggerTime ( )
virtualinherited

A function to update the time that the next trigger is expected to occur.

Definition at line 1646 of file HyPerLayer.cpp.

int PV::HyPerLayer::updateNextUpdateTime ( )
virtualinherited

A function to update nextUpdateTime of the layer based on trigger

Definition at line 1626 of file HyPerLayer.cpp.

int PV::ImageFromMemoryBuffer::updateState ( double  time,
double  dt 
)
virtual

Overrides updateState

Reimplemented from PV::BaseInput.

Definition at line 129 of file ImageFromMemoryBuffer.cpp.

int PV::BaseInput::writeImage ( const char *  filename,
int  batchIdx 
)
inherited

The data buffer lives in the extended space. Here, we only copy the restricted space to the buffer buf. The size of this buffer is the size of the image patch - borders are not included.

Definition at line 1204 of file BaseInput.cpp.


The documentation for this class was generated from the following files: