| Customize Help
| Save Settings


Function Map
Restore data from disk into an automatically allocated data buffer or container.
MIL_ID MbufRestore(
MIL_ID SystemId, //in
MIL_ID *ContainerOrBufIdPtr //out

This function restores the data that was previously saved to a file and loads it into an automatically allocated buffer or container. It tries to detect the file format from the data.

This function will allocate the destination buffer or container with the same attributes as the original buffer or container, with the exception of an M_IMAGE buffer.

In the case of an M_IMAGE buffer, the MbufRestore() function tries to allocate the buffer so that it can be used for acquisition (M_GRAB), display (M_DISP), and processing (M_PROC) operations. If there is insufficient appropriate memory to allocate such a buffer, it allocates one that can be used in all of the above operations except for acquisition (M_GRAB). Note that the maximum (total) number of grab (M_GRAB) buffers that can be allocated is restricted by the total amount of MIL non-paged (DMA) memory (specified at installation time or using the MILConfig utility). For systems with on-board processors, the total number of M_GRAB buffers and M_PROC buffers is limited by the amount of on-board memory.

If restoring an image, all the pixel information in the file is restored and loaded into the buffer. Additionally, if the file was saved in M_MIL_TIFF file format and includes any region of interest (ROI) information, the ROI information is also restored and loaded into the buffer.

If the vectorial information of an M_VECTOR_AND_RASTER ROI was input in M_WORLD units, the ROI will be restored as an M_VECTOR ROI.

[MIL-Lite with restriction]

When restoring compressed data, the buffer will have an M_COMPRESS attribute.

When restoring an image file that was saved with an associated LUT (color palette), the LUT is also restored and associated with the restored image buffer. You can obtain the identifier of the associated LUT, using MbufInquire().

After restoring a buffer or container, we recommend that you check that the operation was successful using MappGetError() or by checking that the buffer or container identifier returned is not M_NULL.

Note, you can perform the same operation as MbufRestore() using MbufImport(), which uses the specified file format to restore the data instead of trying to determine the format from the data.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
This function is not supported on the selected boards.

Specifies the name and path of the file from which to restore the data buffer or container. The function handles (internally) the opening and closing of the file.

This parameter can be set to one of the following:

function map For specifying the file name and path
Click to summarizeValue Description
Click to summarize M_INTERACTIVE

Opens the File Open dialog box from which you can interactively specify the drive, directory, and name of the file.

Click to summarize MIL_TEXT("FileName") 1

Specifies the drive, directory, and name of the file (for example "C:\mydirectory\myfile"). Typically, data buffer files can contain any of the file extensions listed in MbufImport.

To specify the file on the remote computer (under Distributed MIL), prefix the specified file name string with "remote:///" (for example, "remote:///C:\mydirectory\myfile").

Click to summarize MIL_TEXT("ftp://user:password@server/pathtofile") 1

Restore data from a remote FTP server into an automatically allocated data buffer.

To access a remote FTP server anonymously, omit the user name and password.

FTPS is not supported.

Click to summarize MIL_TEXT("http://user:password@server/pathtofile") 1

Restore data from a remote HTTP server into an automatically allocated data buffer.

Import data from a remote HTTP server into a data buffer.

HTTPS is not supported.


1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().


Specifies the system on which to allocate the buffer or container.

This parameter should be set to one of the following values:

function map For specifying the system
Click to summarizeValue Description
Click to summarize M_DEFAULT_HOST

Specifies the default Host system of the current MIL application.

Click to summarize MIL system identifier

Specifies a valid system identifier, previously allocated using MsysAlloc().


Specifies the address of the variable in which the buffer or container identifier is to be written. Since the MbufRestore() function also returns the buffer or cotainer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Return value
The returned value is the buffer or container identifier. If allocation fails, M_NULL is returned.
  • [MIL-Lite]
    Note that during development and at runtime, compression support, particularly for an M_IMAGE + M_COMPRESS buffer type, requires the presence of a MIL license that grants access to the compression/decompression package. This access is only granted by default with the development license dongle for the full version of MIL. In other cases, you must purchase access to this package separately.
Compilation information
Header Include mil.h.
Library Use mil.lib;.
DLL Requires mil.dll, mil3d.dll for some formats.