Purpose

The ImageCacheForNetworkLoops module works exactly like the ImageCache module except that it keeps its output valid during Update from Loop, supporting network loops (i. e. the output being connected to its input, see example network).

The loop support comes at a price, namely additional memory/time consumption (internally, a temporary secondary cache of the same type is used), and no auto-update/auto-clear support.

Thus:

  • Use this module (ImageCacheForNetworkLoops) if you have a loop in your network
  • Use ImageCache in all other cases

Usage

Select any caching mode via the field In Mode, then initialize the cache via the inInitializationImage input. Then connect the output to your image processing pipeline that you would like to process iteratively, and then to inLoopImage. Press Update from Loop for each processing step.

Windows

Default Panel

../../../Projects/ImageCache/Modules/mhelp/Images/Screenshots/ImageCacheForNetworkLoops._default.png

Input Fields

inInitializationImage

name: inInitializationImage, type: Image

Input used for initialization of the cache.

inLoopImage

name: inLoopImage, type: Image

Input used for iterative updates of the cache.

Output Fields

outImage

name: outImage, type: Image, deprecated name: output0

Output image, representing the cached image.

Parameter Fields

Visible Fields

(Re-)Initialize

name: initialize, type: Trigger

Initializes the cache from the left input (inInitializationImage). If successful, the cached image will be made available at the output. After the initialization attempt (no matter if successful or not), the field [] will be triggered.

Update from Loop

name: update, type: Trigger

Initiates update of the cache from the right input (inLoopImage). During the update, the output image at outImage will remain valid, so that it is allowed and possible to iteratively change the image in an image processing loop as in the example network. If the update is successful, the cached image will be made available at the output. After an update (no matter if successful or not), the field [] will be triggered.

Clear

name: clear, type: Trigger

Clears all output field values to a clean initial state.

In Mode

name: inMode, type: Enum, default: FileCache

Caching mode

Values:

Title Name Description
Memory Caching (Pages) PageCache Cache the input image in memory internally using the PageCache module. That module requests the entire input image and then locks the ML image cache pages until Clear is pressed.
Memory Caching (Memory Image) MemoryCache Cache the input image in memory internally using the MemoryCache module. That module requests the entire input image and then stores it in a so-called MemoryImage (see also MemoryImage Concept), which in contrast to PageCache mode requires a free memory chunk of the entire image size.
File Cache (MLImageFormat LZ4) FileCache Cache the input image in memory internally using the MLImageFormatFileCache module. That module requests the entire input image and then stores it in a temporary file using fast LZ4 compression (if available on your system).

Use Automatic Filename

name: inFileCache_useAutoFilename, type: Bool, default: TRUE

If enabled, no cache file prefix or name has to be provided, the module automatically selects a non-existing one in your temp folder.

Custom Cache File Name

name: inFileCache_customFilenameBase, type: String, deprecated name: inFileCache\_filenameBase

FileCache mode only: Prefix (path + filename prefix) for the cache file (used if Use Automatic Filename is off). If you provide a path without any file prefix, you have to append a path separator (“/”) at the end to indicate that.

Preserve Cache Files

name: inFileCache_preserveCacheFile, type: Bool, default: FALSE

FileCache mode only: Prevents deletion of the cache file on Clear.

Cached Image Extent

name: outCachedImageExtent, type: Vector6, persistent: no

Displays the image extent of the currently cached image.

Cached Image Type

name: outCachedImageType, type: String, persistent: no

Displays the voxel type of the currently cached image.

Cached Image File:

name: outFileCache_cachedImageFilename, type: String, persistent: no

File name of the cached image if in FileCache mode. If invalid, the value is “n/a”.

Status Code

name: statusCode, type: Enum, persistent: no

Reflects module’s status (successful or failed computations) as one of some predefined enumeration values.

Values:

Title Name
Ok Ok
Busy Busy
Invalid input image InvalidInputObject
Invalid input parameter InvalidInputParameter
Internal error InternalError

Last Update Time

name: updateTime_s, type: Double, persistent: no

Displays the time required for caching the input image (in seconds).

[]

name: updateDone, type: Trigger, persistent: no

Notifies that an initialization or update was performed (check status interface fields to identify success or failure).

Status Message

name: statusMessage, type: String, persistent: no

Gives additional, detailed information about status code as human-readable message.

Has Valid Output

name: hasValidOutput, type: Bool, persistent: no

Indicates validity of output field values (success of computation).