classPiiImageSplitter
#include <PiiImageSplitter.h>
An operation for splitting images into pieces.
Inherits PiiDefaultOperation
Description
The operation reads a large image and extracts a number of sub-images from it. It may be configured to extract a fixed number of images or images with a fixed size. (These options are equal if the input images are of equal size.) Unless the randomize flag is set to true, the output is ordered in a raster-scan order: the first sub-image is extracted on the upper left corner of the large image (but may be offset by a predefined amount). The next sub-image is extracted on the right side of the first one, until the whole large image has been covered. The process is repeated for each row of sub-images. Each sub-image is accompanied with a point that determines the location of the upper left corner of the sub-image with respect to that of the large image.
Inputs
Outputs
PiiImageSplitter will pass the input image to this output before it sends the pieces. Properties
|
int
|
The number of columns of equally sized image pieces. |
|
int
|
The index of the next-to-be-sent sub-image within the last received image. |
|
int
|
The height of the extracted sub-images in pixels. |
|
bool
|
Randomization flag. |
|
int
|
The number of rows of equally sized image pieces. |
|
int
|
The number of sub-images in the last received image. |
|
int
|
The width of the extracted sub-images in pixels. |
|
int
|
The number of pixels the upper left corner of the first extracted sub-image is horizontally offset with respect to that of the input image. |
|
int
|
The number of pixels each sub-image is separated from the previous one in horizontal direction. |
|
int
|
The number of pixels the upper left corner of the first extracted sub-image is vertically offset with respect to that of the input image. |
|
int
|
The number of pixels each sub-image is separated from the previous one in vertical direction. |
Constructors and destructor
|
(
)
|
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
int
|
(
)
|
|
int
|
(
)
|
|
int
|
(
)
|
|
bool
|
(
)
|
|
int
|
(
)
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
void
|
(
|
|
int
|
(
)
|
|
int
|
(
)
|
|
int
|
(
)
|
|
int
|
(
)
|
|
int
|
(
)
|
|
int
|
(
)
|
Protected member functions
|
virtual void
|
(
)
Executes one round of processing. |
Property details
-
int columns
[read, write]The number of columns of equally sized image pieces.
-
int currentIndex
[read]The index of the next-to-be-sent sub-image within the last received image.
-
int height
[read, write]The height of the extracted sub-images in pixels.
-
PII_OPERATION_SERIALIZATION_FUNCTION
-
bool randomize
[read, write]Randomization flag.
If this flag is set to
true, the order of emitted sub-images will be random. Otherwise, the upper left corner will always become first. The default value isfalse. -
int rows
[read, write]The number of rows of equally sized image pieces.
If the height (in pixels) of the large image is not a multiple of
rows, empty pixels are left at the bottom of the large image. For example, if the height of the large image is 10 pixels androwsequals to 3, one pixel will be left over.If a fixed number of rows or columns is used, the size of the small images may vary, if width is set to a non-positive value. If this value is zero or negative, width determines the number of sub-image rows. The default value is 0.
-
int subimageCount
[read]The number of sub-images in the last received image.
-
int width
[read, write]The width of the extracted sub-images in pixels.
If the size of the input images varies, the number of extracted sub-images may also vary. If this value is zero or negative, columns is used to determine the width. The default value is 32.
-
int xOffset
[read, write]The number of pixels the upper left corner of the first extracted sub-image is horizontally offset with respect to that of the input image.
The default value is -1, which causes the sub-images to be horizontally centered into the image.
-
int xSpacing
[read, write]The number of pixels each sub-image is separated from the previous one in horizontal direction.
Negative values are OK, and cause overlapping images to be extracted. The default value is 0.
-
int yOffset
[read, write]The number of pixels the upper left corner of the first extracted sub-image is vertically offset with respect to that of the input image.
The default value is -1, which causes the sub-images to be vertically centered into the image.
-
int ySpacing
[read, write]The number of pixels each sub-image is separated from the previous one in vertical direction.
Default is 0.
Function details
-
PiiImageSplitter
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
int columns
() -
int currentIndex
() -
int height
() -
bool randomize
() -
int rows
() -
void setColumns
(- int columns
-
void setHeight
(- int height
-
void setRandomize
(- bool randomize
-
void setRows
(- int rows
-
void setWidth
(- int width
-
void setXOffset
(- int offset
-
void setXSpacing
(- int spacing
-
void setYOffset
(- int offset
-
void setYSpacing
(- int spacing
-
int subimageCount
() -
int width
() -
int xOffset
() -
int xSpacing
() -
int yOffset
() -
int ySpacing
() -
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.