Exporting Data

This feature allows the user to export data that was the output of a node in the training/analysis process. To export data, select the export_data button. This will open the Export Data window:

_images/data_viewer_export_data.png

The windows is split in two parts: on the left hand side which data is to be exported is selected. At the top the user can select any output of any node as the Data Source. Only nodes the training process has already reached will be shown.

The user can then choose to export either All datasets or only a Selected dataset. When selecting All datasets all loaded cubes will be part of the export. When selecting Selected dataset only a single cube will be exported. The slider below the Preview allows the user to select which cube to export. (In case All datasets are to be exported, the slider only affects the preview.)

On the right hand side the user can select the format in which the data sets will be exported. The following file formats are supported:

  • CSV (comma separated values): this will export a text file with comma-separated values. When exporting object lists some columns may not be able to be exported (if they contain more than just a single value) and will be skipped.

    The rows of the CSV file will correspond to the rows shown in the preview on the left side of the window, as will the columns.

    Warning

    Exporting an entire cube as CSV will take a long time and produce a very large file.

  • MATLAB matrix: the data will be exported as a MATLAB .mat file that can be loaded with MATLAB and many other programs for further analysis.

    The MATLAB file will contain a variable headings_2, which will contain the column labels (in numerical format). For example, when exporting spectral data, this would contain the wavelengths.

    The data is stored in variables with the name data_0 for the first dataset, data_1 for the second dataset, etc. (If only a single dataset is exported per file - see below - then only data_0 will be present.)

  • TIFF image: exports the data as a TIFF image. This is only available if the input data is image-like (object lists cannot be exported as a TIFF image, for example). If the dataset has multiple columns, each column will be mapped to an individual channel in the TIFF file. Additionally the data type of the data will be used as the data type of the TIFF file. Not all programs will be able to read TIFF files written this way (even though all files written by fluxTrainer comply with the standard).

Below the format there is the option of choosing whether to output all datasets into a single file, or whether to output them into multiple files. (If only a single dataset/cube is to be exported, even in multi-file mode only one file will be written.)

  • If the user chooses the Single file mode then upon closing the window they must provide a single file name to save the exported data under.

    For CSV files the rows of all datasets will just be concatenated in the order of the datasets.

    For MATLAB files the datasets will be stored as data_0 for the first dataset, data_1 for the second, etc.

    For TIFF files the individual datasets will be stored as distinct TIFF directories. (Most TIFF files will only have a single directory, but the standard allows for multiple directories.)

  • If the user chooses One file per dataset then upon closing the window they must choose a directory to store the various files. The Filename prefix specified at the bottom of the window will be concatenated with the name of the data set and stored with that file name in the directory. (For example, if Filename prefix is set to ABC_ and the first dataset had a name XYZ, then the file name for the first dataset would be ABC_XYZ.ext, where .ext is the file extension of the chosen format, i.e. .tiff for TIFF files, .csv for CSV files, and .mat for MATLAB matrices.

The checkbox Include data set names in export allows the user to choose whether the data set names will be stored in the exported file. For CSV files this results in an additional column with the name, for TIFF files this will set the Document Name TIFF tag, and for MATLAB matrix files this will generate variables name_0, name_1, etc. corresponding to the respective dataset variables, data_0, data_1, etc.

Beneath that there are two tabs: Physical coordinates and a tab for format-specific options.

Physical coordinates are only useful if all cubes that were loaded have an assigned pixel size. When physical coordinates are enabled, they will translate the pixel positions into physical positions based on the pixel size assigned to the cube. The center of the cube will be assumed to be the origin, (0, 0). The user can manually specify an offset for this (the offset may be specified individually for each dataset/cube) if they want to adjust that. The Output unit allows the user to select in which unit the coordinates will be output.

In the CSV format the coordinates will be output as additional columns. In MATLAB the coordinates will be stored in separate variables, coordinates_x_0/coordinates_y_0 for the first dataset, coordinates_x_1/coordinates_y_1 for the second, etc. The coordinate variables will be matrices that have as many rows as the height of each dataset, and as many columns as the width of each dataset. (The TIFF export currently does not support exporting coordinates.)

The second visible tab contains format-specific options.

The CSV format has the option of including a header line that gives the user an indication of the meaning of the columns.

The MATLAB format has the option of selecting which MATLAB matrix format version should be written.

The export in the TIFF format cannot be influenced with format-specific options at the moment.