Process.pm

Summary
Process.pm
JOINCACHE::ProcessConfigure, assemble commands used to generate merged pyramid’s images, from source pyramids’ images.
COMMANDSDefine allowed merge methods.
Commands’ calls
BASHFUNCTIONSDefine bash functions, used to factorize and reduce scripts :
Constructors
newProcess constructor.
Process methods
treatImage
makeLinkCreate a symbolic link in the final cache, to a source image.
mergeImagesWrite commands in the current script to merge N (N could be 1) images according to the merge method.
Configuration method
configureFunctionsConfigure bash functions to write in scripts’ header thanks to pyramid’s components.
Getters - Setters
getMergeMethod
useMasks
isMergeMethodCheck merge method value.
List methods
storeInListWrites file’s path in the pyramid’s content list and store the root.
writeRootsInListWrite roots at the top of the cache list.
closeScriptsClose all scripts and the list.
getCurrentScript
Export methods
exportForDebugReturns all commands’ informations.

JOINCACHE::Process

Exporter
JOINCACHE::Process

Configure, assemble commands used to generate merged pyramid’s images, from source pyramids’ images.  Manage scripts and the final pyramid’s content list.

When we have several source images, we have to merge them.  3 ways are available

  • replace : just the top pyramid’s image is kept.  That’s why order in the composition section in configuration is important.
  • multiply : samples are multiplied.
  • alphatop : alpha blending method.  If images dont’ own an alpha sample, white is considered as transparent.  White is too the background color if we don’t want alpha sample in the final images.
  • top : like replace, but more clever (we can avoid to remove data with nodata thanks to the masks)

Using

use JOINCACHE::Process;

# Process object creation
my $objProcess = JOINCACHE::Process->new(
    $objPyramid, # BE4::Pyramid object
    $process_params, # Process section as an hash
);

Attributes

pyramidBE4::Pyramid - Allowed to know output format specifications and configure commands.
mergeMethodstring - Precise way to merge images (in upper case).
ontConfDirstring - Directory, where to write overlayNtiff configuration files.
useMasksboolean - Precise if masks have to be search and used.  They are used if : user precise it (through the *use_masks” parameter OR the merge method is “TOP” OR user want masks in the final pyramid.
liststream - Stream to the pyramid’s content list.
rootsinteger hash - Index all pyramid’s roots.  Values : root - string => ID - integer
splitsNumberinteger - Number of script used for work parallelization.
scriptsJOINCACHE::Script array - splitsNumber scripts, which will be executed to generate the pyramid.
currentScriptinteger - Work sharing between splits is the round robin method.  We know in which script we have to write the next commands.
Summary
COMMANDSDefine allowed merge methods.
Commands’ calls
BASHFUNCTIONSDefine bash functions, used to factorize and reduce scripts :
Constructors
newProcess constructor.
Process methods
treatImage
makeLinkCreate a symbolic link in the final cache, to a source image.
mergeImagesWrite commands in the current script to merge N (N could be 1) images according to the merge method.
Configuration method
configureFunctionsConfigure bash functions to write in scripts’ header thanks to pyramid’s components.
Getters - Setters
getMergeMethod
useMasks
isMergeMethodCheck merge method value.
List methods
storeInListWrites file’s path in the pyramid’s content list and store the root.
writeRootsInListWrite roots at the top of the cache list.
closeScriptsClose all scripts and the list.
getCurrentScript
Export methods
exportForDebugReturns all commands’ informations.

COMMANDS

my %COMMANDS

Define allowed merge methods.

Commands’ calls

BASHFUNCTIONS

my $BASHFUNCTIONS

Define bash functions, used to factorize and reduce scripts :

  • Cache2work
  • OverlayNtiff
  • Work2cache

Constructors

new

sub new

Process constructor.  Bless an instance.

Parameters (list)

pyrBE4::Pyramid - Images pyramid to generate
processParamshash - Parameters in the section process
merge_method - string - Way to merge several overlayed images (can be in lower case)
job_number - integer - Level of parallelization for scripts
path_temp - string - Directory, where to write proper temporary directory
path_temp_common - string - Directory, where to write common temporary directory
path_shell - string - Directory, where to write scripts
use_masks - string - TRUE or FALSE, to precise if masks have to be used

Process methods

treatImage

sub treatImage

3 possibilities

  • the node owns just one source image and is compatible with the final cache -> we write a symbolic link : makeLink.
  • the node owns just one source image and is not compatible with the final cache -> we have just to convert image : compression and samples per pixel, commands are written in scripts : mergeImages.
  • the node owns several source images -> we use tool ‘overlayNtiff’, commands are written in scripts : mergeImages.

Parameters (list)

nodeNode - Node to treat

makeLink

sub makeLink

Create a symbolic link in the final cache, to a source image.  Return TRUE if success, FALSE otherwise.

Parameters

finaleImagestring - Absolute path of the final image
sourceImagestring - Absolute source image’s path, to link

mergeImages

sub mergeImages

Write commands in the current script to merge N (N could be 1) images according to the merge method.  We use tiff2rgba to convert into work format and overlayNtiff to merge.  Masks are treated if needed.  Code is store into the node.

If just one input image, overlayNtiff is used to change the image’s properties (samples per pixel for example).  Mask is not treated (masks have always the same properties and a symbolic link have been created).

Returns

A boolean, TRUE if success, FALSE otherwise.

Parameters (list)

nodeNode - Node to treat

Configuration method

configureFunctions

sub configureFunctions

Configure bash functions to write in scripts’ header thanks to pyramid’s components.

Getters - Setters

getMergeMethod

sub getMergeMethod

useMasks

sub useMasks

isMergeMethod

sub isMergeMethod

Check merge method value.  Possible values: ‘REPLACE’,’ALPHATOP’,’MULTIPLY’,’TOP’.

Parameters (list)

mergeMethodstring - Merge method value

List methods

storeInList

sub storeInList

Writes file’s path in the pyramid’s content list and store the root.

Parameters

pathstring - Path to write in the cache list : root will be factorize.

writeRootsInList

sub writeRootsInList

Write roots at the top of the cache list.

closeScripts

Close all scripts and the list.

getCurrentScript

sub getCurrentScript

Export methods

exportForDebug

sub exportForDebug

Returns all commands’ informations.  Useful for debug.

Example

Object JOINCACHE::Process :
     Merge method : MULTIPLY
     Use masks
my %COMMANDS
Define allowed merge methods.
my $BASHFUNCTIONS
Define bash functions, used to factorize and reduce scripts :
sub new
Process constructor.
sub treatImage
sub makeLink
Create a symbolic link in the final cache, to a source image.
sub mergeImages
Write commands in the current script to merge N (N could be 1) images according to the merge method.
sub configureFunctions
Configure bash functions to write in scripts’ header thanks to pyramid’s components.
sub getMergeMethod
sub useMasks
sub isMergeMethod
Check merge method value.
sub storeInList
Writes file’s path in the pyramid’s content list and store the root.
sub writeRootsInList
Write roots at the top of the cache list.
sub getCurrentScript
sub exportForDebug
Returns all commands’ informations.
Store all informations about a pyramid.
Describe a script, allowed to write in.
Descibe a node
Close