2 #include "ui_stitchimportdialog.h"    19 void StitchImportDialog::on_browsePushButton_clicked()
    22             QFileDialog::getOpenFileName(
this,
    23                                          "Select Instruction File",
    24                                          workspace_->directory(),
    25                                          "Instruction File (*.csv)");
    26     ui->filenameLineEdit->setText(filename);
    29 bool StitchImportDialog::LoadDatasets(field<string> filenames, mat &spectra, vec &x, vec &y, vec &abscissa, 
bool swap_spatial, QString type)
    32     field<field<mat> > datasets(filenames.n_rows, filenames.n_cols);
    34     vec current_x, current_y, current_abscissa;
    36     bool two_dim = datasets.n_rows > 1 && datasets.n_cols > 1;
    37     for (uword j = 0; j < filenames.n_cols; ++j){
    38         for (uword i = 0; i < filenames.n_rows; ++i){
    41                 filename = path_ + 
"/" + QString::fromStdString(filenames(i, j));
    43                 filename = path_ + 
"/" + QString::fromStdString(filenames(i));
    44             if (type == 
"Vespucci Dataset"){
    52             else if (type == 
"Wide Text" || type == 
"Wide CSV"){
    63             else if (type == 
"Long Text" || 
"Long CSV"){
    72                 cout << 
"Improper!\n";
    80                 field<mat> dataset(4);
    81                 dataset(0) = current_spectra;
    82                 dataset(1) = current_abscissa;
    83                 dataset(2) = current_x;
    84                 dataset(3) = current_y;
    85                 datasets(i, j) = dataset;
    93         workspace_->main_window()->DisplayExceptionWarning(
"Vespucci::StitchDatasets", e);
   100 void StitchImportDialog::on_buttonBox_accepted()
   102     QString filename = ui->filenameLineEdit->text();
   103     path_ = QFileInfo(filename).absolutePath();
   104     QString data_format = ui->formatComboBox->currentText();
   105     bool swap_spatial = ui->swapSpatialCheckBox->isChecked();
   109     field<string> instruction;
   110     ok = instruction.load(filename.toStdString());
   112         QMessageBox::warning(
this,
   113                              "Failed to Load Instructions",
   114                              "The instruction file could not be loaded");
   117         ok = LoadDatasets(instruction,
   118                           spectra, x, y, abscissa,
   119                           swap_spatial, data_format);
   120     }
catch (exception e){
   121         workspace_->main_window()->DisplayExceptionWarning(e);
   125         QMessageBox::warning(
this,
   126                              "Failed to Load Dataset",
   127                              "One or more datasets could not be loaded, or "   128                              "datasets of incompatible spatial coordinates.");
   131         QString x_description = ui->xLineEdit->text();
   132         QString x_units = ui->xUnitsLineEdit->text();
   133         QString y_description = ui->yLineEdit->text();
   134         QString y_units = ui->yUnitsLineEdit->text();
   135         QString name = ui->nameLineEdit->text();
   136         QSharedPointer<VespucciDataset>
   138                                             workspace_->main_window(),
   140         dataset->SetData(spectra, abscissa, x, y);
   141         dataset->SetXDescription(x_description + 
" (" + x_units + 
")");
   142         dataset->SetYDescription(y_description + 
" (" + y_units + 
")");
   143         workspace_->AddDataset(dataset);
 
VESPUCCI_EXPORT bool ImportVespucciBinary(std::string filename, arma::mat &spectra, arma::vec &abscissa, arma::vec &x, arma::vec &y)
 
VESPUCCI_EXPORT bool StitchDatasets(const arma::field< arma::field< arma::mat > > &datasets, arma::mat &spectra, arma::vec &x, arma::vec &y, arma::vec &abscissa)
Vespucci::StitchDatasets. 
 
The VespucciDataset class This is the main class for dealing with hyperspectral data. This handles the import and export of spectra, and the creation of maps. Images are handled by the MapData class. This class is intended to be allocated on the heap inside of a smart pointer, there is no copy constructor. 
 
StitchImportDialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws)
 
VESPUCCI_EXPORT bool ImportWideText(std::string filename, arma::mat &spectra, arma::vec &abscissa, arma::vec &x, arma::vec &y, bool swap_spatial)
TextImport::ImportWideText. 
 
VESPUCCI_EXPORT bool ImportLongText(std::string filename, arma::mat &spectra, arma::mat &abscissa, arma::vec &x, arma::vec &y, bool swap_spatial)
TextImport::ImportLongText.