classPiiMinMaxOperation
#include <PiiMinMaxOperation.h>
Calculates the minimum/maximum of two arguments, or the minimum/maximum value in a matrix.
Inherits PiiDefaultOperation
Description
Inputs
input0 is a scalar, input1 must be a
scalar. If input0 is a matrix, input1 can
be either a scalar or a matrix. In the latter case, the sizes of
the matrices must match.
Outputs
input0 is connected, and the object read from it is a
matrix, outputs the minimum/maximum value of the matrix as a
scalar. If minMaxCount is larger than 1, outputs the N
smallest/largest values as a 1-by-N matrix. If both inputs are
connected and a) the objects are matrices, outputs a matrix that
stores the minimum/maximum of corresponding elements b) the objects
are scalars, outputs the minimum/maximum of them c) the object in
input0 is a matrix and the object in
input1 a scalar, outputs the minimum/maximum of the
matrix and the scalar.
input1 is not connected.
Emits a N-by-2 PiiMatrix<int> that stores
the column and row coordinates (x and y) of the located
minima/maxima, in this order.
Properties
|
int
|
The number of smallest/largest values to find in a matrix. |
|
Operation mode. |
Public types
|
enum
|
{ MinimumMode, MaximumMode }
Operation modes. |
Constructors and destructor
Public member functions
|
int
|
( )
|
|
( )
|
|
|
void
|
(
|
|
void
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
int minMaxCount
[read, write]The number of smallest/largest values to find in a matrix.
If the number of elements in a matrix is smaller than this value, the operation will stop running. Default is one.
-
Mode mode
[read, write]Operation mode.
Default is
MaximumMode.
Enumeration details
-
enum Mode
Operation modes.
-
MinimumMode- find minimum/mimina -
MaximumMode- find maximum/maxima
-
Function details
-
PiiMinMaxOperation
() -
int minMaxCount
() -
Mode mode
() -
void setMinMaxCount
(- int minMaxCount
-
void setMode
-
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.