| MIL 10 Reference
| Customize Help
| Save Settings

MbufRestore



See also
Availability
Available in MIL-Lite with restrictions (see remarks)
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
3dmodelheightdefect.cpp
3dplanefit.cpp
advancedmeasurement.cpp
aimdpmgrading.cpp
binarybasedcircledetection.cpp
calibratedruler.cpp
calibrationfromlist.cpp
circlemeasurement.cpp
circleshapefinder.cpp
codegrading.cpp
colorbasedproductidentification.cpp
colorrelativecalibration.cpp
deadpixelcorrection.cpp
defectdetectionexample.cpp
defectdetectiontask.cpp
dmiladdconstantmain.cpp
dmilbasic.cpp
dmilremap.cpp
dmilsyncasyncmain.cpp
dotspacing.cpp
exampleinterface.cpp
fixturedcoderead.cpp
fixturingusingblob.cpp
flatfieldcorrection.cpp
foodinspection_cereal.cpp
foodinspectioncereal.cpp
histogramequalizeadaptive.cpp
m3dmap.cpp
m3dmap.cs
m3dmap.vb
mappbenchmark.cpp
mappbenchmark.cs
mappbenchmark.vb
mbead.cpp
mbead.cs
mbead.vb
mblob.cpp
mblob.cs
mblob.vb
mbufbayer.cpp
mcal.cpp
mcal.cs
mcal.vb
mcode.cpp
mcode.cs
mcode.vb
mcolorwarp.cpp
mdigautofocus.cpp
mdigautofocus.cs
mdigautofocus.vb
mdispoverlay.cpp
mdispoverlay.cs
mdispoverlay.vb
mdispwindowleveling.cpp
mdispwindowleveling.cs
mdispwindowleveling.vb
meas2stepoverview.cpp
measoverviewexample.cpp
medge.cpp
medge.cs
medge.vb
mgrainteractive.cpp
mgrainteractive.cs
mgrainteractive.vb
mimconvolve.cpp
mimconvolve.cs
mimconvolve.vb
mimdeinterlace.cpp
mimdeinterlace.cs
mimdeinterlace.vb
mimhistogram.cpp
mimhistogram.cs
mimhistogram.vb
mimmorphic.cpp
mimpolar.cpp
mimpolar.cs
mimpolar.vb
mimprocessing.cpp
mimprocessing.cs
mimprocessing.vb
mimsegment.cpp
mimsegment.cs
mimsegment.vb
mimwarp.cpp
mimwarp.cs
mimwarp.vb
mmeas.cpp
mmeas.cs
mmeas.vb
mmet.cpp
mmet.cs
mmet.vb
mmod.cpp
mmod.cs
mmod.vb
morphology.cpp
mpat.cpp
mpat.cs
mpat.vb
mpmenubutton.cpp
mreg.cpp
mreg.cs
mreg.vb
mstr.cpp
mstr.cs
mstr.vb
muart.cpp
multipledatamatrixcoderead.cpp
multiviewannotations.cpp
objectseparation.cpp
pfocus.cpp
productidentificationoasis.cpp
publishingapplication.cpp
registeredgoldentemplate.cpp
segmentationandanalysisofcells.cpp
simpledilateerode.cpp
stereocalibration.cpp
targetalignmenttask.cpp
variouscodereadings.cpp
wavelettransformation.cpp
Synopsis
Restore data from a file into an automatically allocated data buffer.
Syntax
MIL_ID MbufRestore(
MIL_CONST_TEXT_PTR FileName, //in
MIL_ID SystemId, //in
MIL_ID *BufIdPtr //out
)
Description

This function restores the data from the specified file and loads it into an automatically allocated buffer. It tries to detect the file format from the data.

This function will allocate the destination buffer with the same attributes as the original buffer, 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 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, we recommend that you check that the operation was successful using MappGetError() or by checking that the buffer 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.
Parameters
This function is not supported on the selected boards.
Parameters
FileName

Specifies the name and path of the file from which to restore the data buffer. 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
CollapseValue Description
Collapse M_INTERACTIVE

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

Collapse MIL_TEXT("FileName") 1

Specifies the drive, directory, and name of the file (for example "C:\mydirectory\myfile").

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").

(summarize)

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

SystemId

Specifies the system on which to allocate the buffer.

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

function map For specifying the system
CollapseValue Description
Collapse M_DEFAULT_HOST

Specifies the default Host system of the current MIL application.

Collapse MIL system identifier

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

BufIdPtr

Specifies the address of the variable in which the buffer identifier is to be written. Since the MbufRestore() function also returns the buffer 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 identifier. If allocation fails, M_NULL is returned.
Remark
  • [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.
INTERACTIVE DEFAULT HOST