MIL_CONST_TEXT_PTR FileName, | //in |
MIL_INT64 FileFormat, | //in |
MIL_ID SrcContainerOrBufId | //in |
This function exports a data buffer or container to a file, in the specified output file format.
When exporting an image buffer, all the pixel information in the buffer is exported to the file. To export an image with a LUT (color palette), associate the LUT to the image, using MbufControl(). Upon export, the image is saved with its associated color palette (MIM, TIFF, PNG, and BMP file formats).
When exporting an image buffer in the M_MIL_TIFF file format, you can save the camera calibration information associated with the buffer (if applicable) using M_WITH_CALIBRATION. Additionally, if the image buffer includes any region of interest (ROI) information, set using MbufSetRegion(), the ROI information is also exported to the file (unless you specify M_NO_REGION).
You can also save a buffer in the M_MIL_TIFF file format, using MbufSave().
When exporting uncompressed data to a file in an M_JPEG_... or M_JPEG2000_... file format, this function will automatically compress the data, according to the specified file format. The buffer does not need an M_COMPRESS attribute. If you are exporting compressed data to a file in an uncompressed file format, this function will automatically decompress the data.
You can export a buffer or container with all of its data, attributes, and settings (excluding process-dependent settings, such as MIL identifiers) using the M_MIL_NATIVE file format. You can restore the buffer or container exactly as it was exported using MbufImport().
Specifies the name and path of the file in which to save the data buffer or container. It is recommended that you use the appropriate file extension for the specified format (for example, files in a JPEG format should usually be stored with the jpg file extension). The function handles (internally) the opening and closing of the file. If the file already exists, it will be overwritten.
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"). To specify a file on a remote computer (under Distributed MIL), prefix the specified file name string with "remote:///" (for example, "remote:///C:\mydirectory\myfile"). (summarize)Specifies the drive, directory, and name of the file (for example, "C:\mydirectory\myfile"). (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL_TEXT("ftp://user:password@server/pathtofile") 1 |
Export a data buffer to a remote FTP file. To access a remote FTP server anonymously, omit the user name and password. FTPS is not supported. Note that GenDC, STL, and PLY files cannot be imported using an FTP file path. (summarize)Export a data buffer to a remote FTP file. (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.
The following setting can be used to store either a buffer or a container with an automatically determined file format.
For determining the file format
automatically
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_USE_EXTENSION |
Specifies that the buffer or container is saved in a format automatically determined from the file extension specified in the FileName parameter. An error is generated if the automatically determined file format cannot be used to store the specified buffer or container. If the file extension specifies a jpeg or jpeg 2000 format, the buffer is saved as though it were exported using M_JPEG_LOSSY and M_JPEG2000_LOSSY respectively (except if the file extension is jp2, in which case the buffer is saved as though it were exported using M_JPEG2000_LOSSY_JP2). If the file extension specifies a stl or ply format, the buffer is saved as though it were exported using M_STL_BINARY and M_PLY_BINARY_LITTLE_ENDIAN respectively. (summarize)Specifies that the buffer or container is saved in a format automatically determined from the file extension specified in the FileName parameter. (more details...) |
The following file type can be used to store either a buffer or a container.
For specifying the file format that can be used with
either a buffer or a container
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_MIL_NATIVE |
Specifies that the buffer or container is saved in the MIL native file format. This format stores all contents of the buffer or container, including all attributes and settings (excluding process-dependent settings, such as MIL identifiers). The recommended file extension when exporting a buffer is mbuf. The recommended file extension when exporting a container is mbufc. Note that the MIL native file format is MIL-specific. You can use the M_MIL_TIFF file format to export buffers to a file that complies with the TIFF standard. (summarize)Specifies that the buffer or container is saved in the MIL native file format. (more details...) |
The following file types can be used to store any data buffer.
For specifying the file format that can be used with
a buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_MIL_TIFF + |
Specifies that the buffer is saved in a MIL file format that uses the baseline TIFF 6.0 file format with extra MIL information included in the comment field. The buffer attributes and data type are also saved in the file. This file format supports images that are binary, grayscale, and RGB, as well as palette-color images. The MIL file format is a single-page, uncompressed TIFF file format. By default, most color image buffers are saved in a packed (chunky) format (in accordance with baseline TIFF 6.0 specifications). Color binary buffers are saved in a 1-bit per pixel format (data is stored in a 3-band, packed binary format). The recommended file extension is mim. (summarize)Specifies that the buffer is saved in a MIL file format that uses the baseline TIFF 6.0 file format with extra MIL information included in the comment field. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_RAW |
Specifies that the buffer is saved as raw data. The contents are dumped directly (byte stream) into the file and no header is added. If the buffer is multi-band, the buffer is saved in planar format (one band after another). (summarize)Specifies that the buffer is saved as raw data. (more details...) |
The following file types can be used to store a buffer in an image format.
Note that the source buffer should typically have an M_IMAGE attribute when exporting to these formats. The data in non-image buffers will be exported as though it were image data. This can be useful for visualizing or compressing non-image data.
For specifying the file format for use with a buffer
that stores image data
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_BMP |
Specifies that the buffer is saved in a BMP file format. The standard Windows BMP format is used. This file format supports images that are grayscale or RGB. Images in a different format are internally converted before being saved. This file format supports only 8-bit, or 8-bit/band if applicable, buffers. If you are saving a non 8-bit buffer in this file format, only the 8 least-significant bits are saved/band. (summarize)Specifies that the buffer is saved in a BMP file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG2000_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossless file format. If the buffer is 3-band and does not have an M_COMPRESS + M_JPEG2000_LOSSLESS attribute, the data will be stored in RGB format; otherwise, it will be stored in the same color format as the buffer. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossless file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG2000_LOSSLESS_JP2 |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossless file format using the standard JP2 format. Only the color specification of the image buffer can be specified from the additional JP2 information. If the buffer is 3-band and does not have an M_COMPRESS + M_JPEG2000_LOSSLESS attribute, the data will be stored in RGB format; otherwise, it will be stored in the same color format as the buffer. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossless file format using the standard JP2 format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG2000_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossy file format. If the buffer is 3-band and does not have an M_COMPRESS + M_JPEG2000_LOSSY attribute, the data will be stored in YUV16 planar format if the buffer is 8-bit or in RGB format if the buffer is 16-bit; otherwise, it will be stored in the same color format as the buffer. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG2000 lossy file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG2000_LOSSY_JP2 |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JP2000 lossy file format using the standard JP2 file format. Only the color specification of the image buffer can be specified from the additional JP2 information. If the buffer is 3-band and does not have an M_COMPRESS + M_JPEG2000_LOSSY attribute, the data will be stored in YUV16 planar format if the buffer is 8-bit or in RGB format if the buffer is 16-bit; otherwise, it will be stored in the same color format as the buffer. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JP2000 lossy file format using the standard JP2 file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG_LOSSLESS |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossless file format. If the buffer is 3-band, the data will be stored in RGB format. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossless file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG_LOSSLESS_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in an interlaced JPEG lossless file format. This file format is only applicable to 1-band image buffers. This file format supports only 8- and 16-bit buffers. 1-bit buffers are unpacked and saved as 8-bit buffers. 32-bit buffers are saved as 16-bit buffers; only the 16-least significant bits are saved. In the case of a 32-bit buffer, it is best to shift the buffer by 16 bits to the right before exporting the image to keep the most significant data. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in an interlaced JPEG lossless file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG_LOSSY |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossy file format. If the buffer is 3-band and does not have an M_COMPRESS + M_JPEG_LOSSY attribute, the data will be stored in YUV16 packed format; otherwise, it will be stored in the same color format as the buffer. This file format supports only 8-bit, or 8-bit/band if applicable, buffers. If you are saving a non 8-bit buffer in this file format, only the 8 least-significant bits are saved/band. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossy file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG_LOSSY_INTERLACED |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in an interlaced JPEG lossy file format. If the buffer is 3-band, the data will be stored in YUV16 packed format. This file format supports only 8-bit, or 8-bit/band if applicable, buffers. If you are saving a non 8-bit buffer in this file format, only the 8 least-significant bits are saved/band. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in an interlaced JPEG lossy file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_JPEG_LOSSY_RGB |
[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossy file format. If the buffer is 3-band, the data will be stored in RGB format. This file format supports only 8-bit, or 8-bit/band if applicable, buffers. If you are saving a non 8-bit buffer in this file format, only the 8 least-significant bits are saved/band. (summarize)[For
essential MIL-Lite information, see remarks ]
Specifies that the buffer is saved in a JPEG lossy file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_PNG |
Specifies that the buffer is saved in a PNG file format. |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_TIFF + |
Specifies that the buffer is saved in a TIFF file format. The TIFF file format that is used respects the baseline TIFF 6.0 specification. The TIFF file format that is used supports images that are binary, grayscale, and RGB, as well as palette-color images. Also, this TIFF format supports any data type and depth that MIL supports for buffers. An image buffer cannot be saved using a multi-page TIFF file format; it is always saved as a single-page TIFF file. By default, most color image buffers are saved in a packed (chunky) format (in accordance with baseline TIFF 6.0 specifications). Color binary buffers are saved in a 1-bit per pixel format (data is stored in a 3-band, packed binary format). (summarize)Specifies that the buffer is saved in a TIFF file format. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa |
You can add one of the following values to the above-mentioned value to set whether to save the camera calibration information or region of interest data associated with the buffer.
For saving camera calibration information or ROI
data
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_NO_REGION |
Specifies that any ROI data associated with the buffer is not saved with the buffer contents. |
||||||||||||||||||||||||||||||||||||||
M_WITH_CALIBRATION |
Specifies that any camera calibration information associated with the buffer is saved. To restore the associated camera calibration, use McalRestore(). (summarize)Specifies that any camera calibration information associated with the buffer is saved. (more details...) |
You can add the following value to the above-mentioned values to set whether to save the color image buffer in a planar format.
For saving a color image in a planar
format
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_PLANAR |
Specifies that the color image buffer is saved in a planar format. |
You can add the following value to the above-mentioned value to set whether to save the image buffer in big endian format.
For saving an image in big endian
format
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_BIG_ENDIAN |
Specifies that the image buffer is saved in big endian format. |
You can add one of the following values to the above-mentioned value to set whether to use compression when saving a TIFF image file.
For compressing a TIFF image file
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_CCITTFAX3 |
Specifies to use CCITT FAX3 compression. This compression can only be used with monochrome 1-bit buffers. (summarize)Specifies to use CCITT FAX3 compression. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_CCITTFAX4 |
Specifies to use CCITT FAX4 compression. This compression can only be used with monochrome 1-bit buffers. (summarize)Specifies to use CCITT FAX4 compression. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_CCITTRLE |
Specifies to use CCITT RLE compression. This compression can only be used with monochrome 1-bit buffers. (summarize)Specifies to use CCITT RLE compression. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_CCITTRLEW |
Specifies to use CCITT RLEW compression. This compression can only be used with monochrome 1-bit buffers. (summarize)Specifies to use CCITT RLEW compression. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_LZW |
Specifies to use LZW compression. |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_NONE |
Specifies to use no compression. |
||||||||||||||||||||||||||||||||||||||
M_COMPRESSION_PACKBITS |
Specifies to use PackBits compression. |
The following file type can be used to store any container.
For specifying the file format that can be used with
a container
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_GENDC |
Specifies that the container is saved in the GenDC file format. The recommended file extension is gendc. An error is generated if the source container has one of the following:
Specifies that the container is saved in the GenDC file format. (more details...) |
The following file types can be used to store a 3D-processable point cloud container (you can inquire whether a container is 3D-processable using MbufInquireContainer() with M_3D_PROCESSABLE). Any points with a confidence of zero will not be exported. Intensity, reflectance, normals, and mesh components will be included in the exported file.
Note that these settings are only available when mil3d.dll is present.
For specifying the file format for use with a
3D-processable container
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_PLY_ASCII |
Specifies that the point cloud container is saved in the PLY file format using ASCII encoding. |
||||||||||||||||||||||||||||||||||||||
M_PLY_BINARY_LITTLE_ENDIAN |
Specifies that the point cloud container is saved in the PLY file format using binary encoding. |
||||||||||||||||||||||||||||||||||||||
M_STL_ASCII |
Specifies that the point cloud container is saved in the STL file format using ASCII encoding. Note that exporting to an STL file requires the presence of a valid mesh component. (summarize)Specifies that the point cloud container is saved in the STL file format using ASCII encoding. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_STL_BINARY |
Specifies that the point cloud container is saved in the STL file format using binary encoding. Note that exporting to an STL file requires the presence of a valid mesh component. (summarize)Specifies that the point cloud container is saved in the STL file format using binary encoding. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib;. |
DLL | Requires mil.dll, mil3d.dll for some formats. |