MIL_CONST_TEXT_PTR FileName, | //in |
MIL_INT64 FileFormat, | //in |
MIL_INT64 Operation, | //in |
MIL_ID SystemId, | //in |
MIL_ID *BufIdPtr | //in-out |
This function imports data from a file into an existing or automatically allocated MIL data buffer. The function assumes that the data in the file is in the specified format.
Note, you can also import data using MbufLoad() or MbufRestore(); however, these functions try to determine the format from the data rather than allowing you to specify the format.
For an M_RESTORE operation, 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 MbufImport() 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 importing an image, all the pixel information in the file is imported 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 imported and loaded into the buffer when the FileFormat parameter is set to M_MIL. To load the M_MIL file without its ROI information, set FileFormat to M_MIL + M_NO_REGION.
If the vectorial information of an M_VECTOR_AND_RASTER ROI was input in M_WORLD units, the ROI will be imported as an M_VECTOR ROI.
When performing an M_RESTORE operation on a file containing compressed data, the buffer will have an M_COMPRESS attribute.
When importing compressed data, the following applies. When performing an M_LOAD operation and the destination buffer has an M_IMAGE attribute (but not an M_COMPRESS attribute), this function will automatically decompress it. If necessary, the data in the file will be transformed to the format of the buffer. If unsure of the compression type of the data, use M_DEFAULT as the file format rather than M_JPEG_... or M_JPEG2000_...; the data will be read correctly.
When importing uncompressed data into a buffer with an M_COMPRESS attribute, this function will automatically compress it, according to the compression settings found in the buffer.
When importing an image file that has been saved with an associated LUT (color palette) into a 3-band 8-bit image buffer, the LUT is automatically applied to the data to generate 3-band image data. In this case, a LUT buffer is not created and, therefore, is not associated with the 3-band 8-bit buffer. When importing an image file that has been saved with an associated LUT (color palette) into any other type of image buffer, the LUT is also imported and associated with the resulting image buffer. You can obtain the identifier of the associated LUT, using MbufInquire().
Note that the associated LUT will be automatically selected on the display (MdispLut()) if the image buffer is selected on a display and the default LUT has not been overridden by a former call to MdispLut().
Using MbufDiskInquire(), you can inquire about the dimensions of the data saved in a file (except for raw files) without importing it.
After restoring a buffer, we recommend that you check if the operation was successful, using MappGetError(), or by verifying that the returned buffer identifier is not M_NULL.
Specifies the name and path of the file from which to import the data. The function handles (internally) the opening and closing of the file.
This parameter can be set to the following value.
For specifying the file name and
path
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
MIL_TEXT("FileName") 1 |
Specifies the drive, directory, and name of the file, for example, "C:\mydirectory\myfile". (more details...) |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
Specifies the file format. This parameter can be set to one of the following values. Note that except for the M_MIL and M_RAW file formats, data is treated as image data. When performing an M_LOAD operation, the data is internally converted appropriately.
For specifying the file
format
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that MIL automatically determines the file format. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_BMP |
Imports image data that is in BMP file format. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG2000 lossless image. |
||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSLESS_JP2 |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG2000 lossless image, as well as the additional JP2 information. |
||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG2000 lossy image. |
||||||||||||||||||||||||||||||||||||||
M_JPEG2000_LOSSY_JP2 |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG2000 lossy image, as well as the additional JP2 information. |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG lossless image. |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSLESS_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG lossless image stored in two separate fields. |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG lossy image. |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSY_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Imports a JPEG lossy image stored in two separate fields. |
||||||||||||||||||||||||||||||||||||||
M_JPEG_LOSSY_RGB |
[For
essential MIL-Lite information, see remarks ]
Imports a 3-band JPEG lossy image that is in an RGB format. |
||||||||||||||||||||||||||||||||||||||
M_MIL + |
Imports data that is in a MIL file format. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PNG |
Imports image data that is in a PNG file format. |
||||||||||||||||||||||||||||||||||||||
M_RAW |
Imports raw data. |
||||||||||||||||||||||||||||||||||||||
M_TIFF |
Imports image data that is in a TIFF file format. (more details...) |
You can add one or more of the following values to the above-mentioned value to set whether to import the image with additional information.
Note that you can only specify these values if importing an image (for example, you can specify M_NO_REGION + M_WITH_CALIBRATION).
For importing calibration or ROI
information
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_NO_REGION |
Imports the image, excluding any saved ROI information. |
||||||||||||||||||||||||||||||||||||||
M_WITH_CALIBRATION |
Imports the image, including its calibration information. (more details...) |
Specifies the import operation. This parameter can be set to one of the following values.
For specifying the import
operation
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_LOAD |
Imports data from the specified file into a previously allocated MIL data buffer. |
||||||||||||||||||||||||||||||||||||||
M_RESTORE |
Imports data from the specified file into an automatically allocated MIL data buffer. (more details...) |
Specifies the system on which to allocate the buffer for an M_RESTORE operation. For an M_LOAD operation, this parameter should be set to M_NULL.
For an M_RESTORE operation, this parameter should be set to one of the following values:
For specifying the system on which to
allocate the buffer (with M_RESTORE)
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT_HOST |
Specifies the default Host system of the current MIL application. |
||||||||||||||||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, previously allocated using MsysAlloc(). |
Specifies the address of the variable containing the buffer identifier, for an M_LOAD operation, or the address of the variable in which to store the new buffer identifier, for an M_RESTORE operation.
For an M_LOAD operation, the destination buffer must be large enough in depth and dimensions to hold the data. If the data is deeper than the buffer, the most-significant bits of the data are truncated when loaded into the buffer. If the buffer depth is greater than that of the data, the data is zero or sign-extended (depending on the data type) when loaded into the buffer. If the buffer is larger in size than the data, exceeding areas of the buffer are unaffected.
For an M_RESTORE operation, the destination buffer will be allocated with an appropriate size and type to hold the data. Since MbufImport() also returns the buffer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |