| Customize Help
| Save Settings

MclassImport



Function Map
Synopsis
Import data from a CSV file to a dataset context.
Syntax
void MclassImport(
MIL_CONST_TEXT_PTR FileName, //in
MIL_INT64 FileFormat, //in
MIL_ID DatasetContextClassId, //in
MIL_INT64 Index, //in
MIL_INT64 ImportType, //in
MIL_INT64 ControlFlag //in
)
Description

This function imports data from a CSV file to a dataset context. Imported data is appended to any existing data in the dataset. To export data from a dataset, use MclassExport().

When importing from a CSV file, it must adhere to formatting requirements and contain the required data (this can depend on what you are importing). For more information, see the Importing data from a CSV file to a dataset context subsection of the Datasets section of Chapter 20: Classification.

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 which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
FileName

Specifies the name and path of the file from which to import. The function handles (internally) the opening and closing of the file. For easier use with other Matrox Imaging software products, the specified file name must use the CSV file extension. A CSV file represents a common format that holds comma separated values.

Set this parameter to one of the values below.

function map For specifying the file name and path
Click to summarizeValue Description
Click to summarize M_INTERACTIVE
[This is only applicable to Windows]

Opens a dialog box from which to interactively specify the file's drive, directory, and name.

Click to summarize MIL_TEXT("FileName") 1

Specifies the file's drive, directory, and name (for example, "E:\Manual\MySweetSweetDataset.csv").

To specify a dataset file on a remote computer (under Distributed MIL), prefix the file name string with "remote:///" (for example, "remote:///E:\Manual\\MyEvenSweeterDataset.csv").

(summarize)

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

FileFormat

Specifies the format of the file from which to import. Set this parameter to the value below.

function map For specifying the file format
Click to summarizeValue Description
Click to summarize M_FORMAT_CSV

Specifies a CSV file format.

Note that if a field value in the CSV file contains commas, the value should be delimited within double quotation marks.

(summarize)
DatasetContextClassId

Specifies the identifier of the dataset context in which to import. Set this parameter to one of the following values.

function map For specifying the dataset context in which to import
Click to summarizeValue Description
Click to summarize ContextDatasetId

Specifies the identifier of a features or images dataset context. This context is allocated using MclassAlloc() with M_DATASET_FEATURES or M_DATASET_IMAGES.

(summarize)
Index

Reserved for future expansion and must be set to M_DEFAULT.

ImportType

Specifies the type of import operation to perform.

To restore an exported dataset, you must call this function for each type of import operation.

The order in which you import data is important. You should import authors and class definitions first, and then import entries, as entries require authors and class definitions.

If you only import entries, MIL automatically creates class definitions and authors according to the information in the entries. If you import class definitions or authors afterward, MIL appends them to the already existing ones. If MIL encounters non-existing class definitions or authors when importing entries, they are automatically added to the dataset using default values.

Set this parameter to one of the following values.

function map For specifying the type of the file that you can import
Click to summarizeValue Description
Click to summarize M_AUTHORS

Specifies to import authors from a CSV file. In this case, use the headers below (and provide the corresponding lines of information after the header) in the CSV file.

Key,AuthorName

Both of these fields are required.

(summarize)
Click to summarize M_CLASS_DEFINITIONS

Specifies to import class definitions from a CSV file. In this case, use the headers below (and provide the corresponding lines of information after the header) in the CSV file.

Key,Name,Color_R,Color_G,Color_B,Weight

The 'Key' and 'Name' fields are required; the others are optional.

(summarize)
Click to summarize M_ENTRIES

Specifies to import the entries from a CSV file. In this case, use the headers below (and provide the corresponding lines of information after the headers) in the CSV file.

For an images dataset:

Key,FilePath,AuthorName,AugmentationSource,RegionType,ClassIdxGroundTruth_...,ClassIdxPredicted_...,ClassScorePredicted_...,UserString

For a features dataset:

Key,FilePath,AuthorName,AugmentationSource,Data_...,ClassIdxGroundTruth_...,ClassIdxPredicted_...,ClassScorePredicted_...,UserString,EntryWeight

For either dataset, the 'Key', 'FilePath', and 'ClassIdxGroundTruth_...' fields are required; the others are optional.

The fields with an underscore and an ellipsis, such as 'Data_...', represent an array of values. You must replace the ellipsis with an integer, starting at 0 for the first array value, and increasing by 1 for each subsequent array value; for example:

Key,FilePath,AuthorName,AugmentationSource,Data_0,Data_1,Data_2,ClassIdxGroundTruth
0,E:\Images\Class1\0001.mim,Matrox,NOT_AUGMENTED,99,66,77,1
(summarize)
ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milclass.lib.
DLL Requires mil.dll; milclass.dll.
INTERACTIVE FORMAT CSV AUTHORS CLASS DEFINITIONS ENTRIES