Purpose

The module MemoryCache is designed to hold a copy of the image at the modle input for a user controlled period of time in memory.

The data transport to attached modules is optimized for maximum performance. Another feature is that the module input can be disconnected after filling the cache with an image without losing the cache’s contents.

Details

Notes

  • Using the MemoryCache module should be considered dangerous for applications if the size of cached images is not limited. For large files not fitting into the memory consider using the MLImageFormatFileCache module as an alternative storing the file on disk. Especially in large applications the MemoryCache module often causes trouble due to the large amount of locked memory.
  • For BitImages consider using the BitImageArithmetic modules which can cache BitImages. This could be useful especially for caching masked images.
  • The MemoryCache module seems to invite usage in loops, e.g iterative filtering, etc. This is not supported, since the output of the MemoryCache is invalidated as soon as an update is performed, which is disastrous if this output is needed to compute the input. Do not use to implement loops (unless you are willing to use a second MemoryCache module to buffer the first one’s output). Use the ImageIterator modules instead.

Windows

Default Panel

../../../Modules/ML/MLMiscModules/mhelp/Images/Screenshots/MemoryCache._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Field Index

Clear: Trigger
progress: Double
Update: Trigger
Update Mode: Enum
Valid: Bool

Visible Fields

Valid

name: valid, type: Bool, persistent: no, deprecated name: Valid

Shows if the cache’s content is valid.

If the cache content is invalid, the module’s output image is undefined, otherwise a copy of the image at the module’s input is available.

Clear

name: clear, type: Trigger, deprecated name: ClearCache

If pressed, the cache is cleared and the output is invalidated.

Update

name: update, type: Trigger, deprecated name: LoadCache

If pressed, the complete data from the module’s input is copied into the memory cache and makes it available at the module’s output.

If the input is not valid while pressing this button, the cache is cleared and the module’s output becomes invalid.

Update Mode

name: updateMode, type: Enum, default: AutoUpdate, deprecated name: AutoLoadCache

Defines the update mode of this module.

Values:

Title Name Deprecated Name Description
Off Off FALSE Nothing happens if the input image changes.
Auto Update AutoUpdate TRUE The input image is cached as it is changed.
Auto Clear AutoClear   The cache is cleared if the input image changes.

Hidden Fields

progress

name: progress, type: Double, persistent: no