ImageBuffer

MacroModule
genre Image
author Frank Heckel
package FMEstable/ReleaseMeVis
definition ImageBuffer.def
see also MemoryCache, MLImageFormatFileCache
keywords undo, redo, cache, caching, buffer, stack, LIFO, queue, FIFO

Purpose

The ImageBuffer allows saving multiple images in a FIFO (queue), LIFO (stack) or random access (list) way.

Usage

Connect the image to inImage and press push to add an image to the buffer. Depending on the mode the firstly (FIFO) or lastly (LIFO) added image is available at outImage. Press pop the remove it. In RandomAccess mode, you can choose the current output image with the index field and insert or remove images at the current index. You can also change an image to the current input.

Details

The module uses MemCache- or MLImageFormatFileCache-modules to save the images on the stack / in the queue / list. When using the file-cache the module also supports compression.

Tips

This module can for example be used for implementing an undo-functionality for a set of segmentation masks. Furthermore this module can be used in loops, i.e. is is valid to connect the output of this module directly or indirectly to its input without any caches in between.

Windows

Default Panel

../../../Modules/Macros/ImageBuffer/mhelp/Images/Screenshots/ImageBuffer._default.png

Input Fields

inImage

name: inImage, type: Image

The image that should be saved in the buffer.

Output Fields

outImage

name: outImage, type: Image

Depending on the mode the firstly (FIFO), lastly (LIFO) added or currently selected (RandomAccess) image.

Parameter Fields

Field Index

Change: Trigger Path: String
Clear: Trigger Pop: Trigger
Compression Mode: Enum Push: Trigger
Index: Integer Remove: Trigger
Insert: Trigger Size: Integer
Is empty: Bool Use Compression: Bool
Max Size: Integer Use File Cache: Bool
Mode: Enum Use Temporary User Path: Bool

Visible Fields

Use File Cache

name: useFileCache, type: Bool, default: FALSE

If enabled the MLImageFormatFileCache is used for saving the images. This way the images are saved to the disk and less memory is consumed by the ImageBuffer. Otherwise MemCaches are used which is faster but requieres more main memory.

Use Temporary User Path

name: useTemporaryUserPath, type: Bool, default: TRUE

If true, file caches are stored in the default temporary user directory instead of the location given by path.

Path

name: path, type: String

The path where the file caches should be stored. If this is empty and useFileCache is enabled, MemCaches are used instead of MLImageFormatFileCaches.

Use Compression

name: useCompression, type: Bool, default: FALSE

If enabled, the cached files are compressed for saving space. Enabling compression slowes down the caching, but this is typically negligible.

Compression Mode

name: compressionMode, type: Enum, default: LZ4

Values:

Title Name
Zlib ZLIB
Lzf LZF
Lz4 LZ4

Mode

name: mode, type: Enum, default: LIFO

Defines the order in which images are saved and deleted from the buffer. The currently available modes are LIFO (i.e. images are saved in stack-like way), FIFO (i.e. images are saved in a queue), and RandomAccess (i.e. images are saved in a list).

Values:

Title Name
Lifo LIFO
Fifo FIFO
Random Access RandomAccess

Max Size

name: maxSize, type: Integer, default: -1

Maximum number of images stored in the buffer. If an image is inserted in the buffer and the current size equals the maximum size, the oldest image is deleted. If this parameter is set to -1, the number of elements is not limited. If it is set to 0, no images will be stored and the input image is simply bypassed to the output. This field is ignored in RandomAccess mode.

Size

name: size, type: Integer, persistent: no

The number of images that are currently stored in the buffer.

Is empty

name: empty, type: Bool, persistent: no

True, if there are currently no images stored in the buffer.

Push

name: push, type: Trigger

If pressed, the image attached to inImage is stored in the buffer. If the mode is set to LIFO this image is then available at outImage. In RandomAccess mode, push behaves as in LIFO mode.

Pop

name: pop, type: Trigger

Removes a image that is currently available on outImage from the buffer. After removing the image, a new image is available on outImage, depending on the current mode. In RandomAccess mode, pop behaves as in LIFO mode.

Clear

name: clear, type: Trigger

Removes all images from the buffer.

Index

name: index, type: Integer, default: 0

The index of the currently selected image, starting from 0. This image is shown at the output (editable in RandomAccess mode only).

Insert

name: insert, type: Trigger

Inserts an image to the buffer at the current index, i.e. before the currently selected image (RandomAccess only).

Remove

name: remove, type: Trigger

Removes the image with the current index from the buffer. The image after the removed image will be the new selected image (RandomAccess only).

Change

name: change, type: Trigger

Changes the image at the current index to the image at the input by updating the corresponding cache module (RandomAccess only).