21 #include "../../../datatype/DataType.h" 22 #include "../../../dataaccess/utils/Utils.h" 23 #include "../../../raster/Band.h" 24 #include "../../../raster/Raster.h" 25 #include "../../../se/ColorMap.h" 26 #include "../charts/ChartDisplay.h" 27 #include "../charts/ChartStyle.h" 28 #include "../charts/Histogram.h" 29 #include "../charts/HistogramChart.h" 30 #include "../charts/HistogramStyle.h" 31 #include "../charts/Utils.h" 32 #include "../utils/ScopedCursor.h" 34 #include "ui_PCAWizardPageForm.h" 39 #include <QFileDialog> 44 m_ui.reset(
new Ui::PCAWizardPageForm);
49 this->setTitle(tr(
"Principal Components Analysis"));
50 this->setSubTitle(tr(
"Define PCA parameters."));
52 m_ui->m_outputDataTypeComboBox->addItem(
"Unsigned Int 8 bits" );
53 m_ui->m_outputDataTypeComboBox->addItem(
"Unsigned Int 16 bits" );
54 m_ui->m_outputDataTypeComboBox->addItem(
"Unsigned Int 32 bits" );
55 m_ui->m_outputDataTypeComboBox->addItem(
"Float" );
56 m_ui->m_outputDataTypeComboBox->addItem(
"Double" );
58 m_ui->m_outputDataTypeComboBox->setCurrentIndex( 4 );
68 std::vector< unsigned int > returnVector;
70 QList<QListWidgetItem *> selectedItens =
m_ui->m_layerBandsListWidget->selectedItems();
72 QList<QListWidgetItem *>::iterator it = selectedItens.begin();
73 QList<QListWidgetItem *>::iterator itEnd = selectedItens.end();
77 returnVector.push_back( (*it)->text().toUInt() );
86 return m_ui->m_pcaMatrixFileLineEdit->text().toStdString();
91 switch(
m_ui->m_outputDataTypeComboBox->currentIndex() )
134 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
140 size_t bandsNumber =
m_raster->getNumberOfBands();
142 m_ui->m_layerBandsListWidget->clear();
145 m_ui->m_layerBandsListWidget->addItem(QString::number(
band));
148 m_ui->m_layerBandsListWidget->selectAll();
155 QList<QListWidgetItem *> selectedItens =
m_ui->m_layerBandsListWidget->selectedItems();
158 ( selectedItens.empty() )
161 (
m_ui->m_inversePCACheckBox->checkState() == Qt::Checked )
163 (
m_ui->m_pcaMatrixFileLineEdit->text().isEmpty() )
177 return (
m_ui->m_inversePCACheckBox->checkState() == Qt::Checked );
182 m_ui->m_pcaMatrixFileLineEdit->clear();
186 m_ui->m_loadPCAMatrixFilePushButton->setText( tr(
"Load" ) );
188 m_ui->m_outputDataTypeComboBox->setEnabled(
true );
192 m_ui->m_loadPCAMatrixFilePushButton->setText( tr(
"Save" ) );
194 m_ui->m_outputDataTypeComboBox->setCurrentIndex( 4 );
195 m_ui->m_outputDataTypeComboBox->setEnabled(
false );
198 emit completeChanged();
206 if(
m_ui->m_inversePCACheckBox->checkState() == Qt::Checked )
208 fileName = QFileDialog::getOpenFileName(
this, tr(
"Select File"),
209 ".",
"*",
nullptr, QFileDialog::ReadOnly);
213 fileName = QFileDialog::getSaveFileName(
this, tr(
"Select the output file name"),
214 ".",
"*",
nullptr , QFileDialog::DontConfirmOverwrite);
217 m_ui->m_pcaMatrixFileLineEdit->setText( fileName );
219 emit completeChanged();
int getOutputRasterDataType() const
This function returns the output raster data type.
void loadPCAMatrixFilePushButtonClicked(bool checked)
te::map::AbstractLayerPtr m_rasterLayer
Testing a better way to show the chart.
std::unique_ptr< Ui::PCAWizardPageForm > m_ui
The wizard page form.
std::vector< unsigned int > getSelectedBands() const
This function returns the bands from the raster taht will be used.
std::unique_ptr< te::rst::Raster > m_raster
The raster that will be processed.
static te::dt::Date ds(2010, 01, 01)
void inversePCACheckBoxToggled(bool checked)
bool inversePCASelected() const
Returnes true the inverse PCA option is selected.
PCAWizardPage(QWidget *parent=0)
Constructor.
std::string getMatrixFileName() const
This function returns the bands from the raster taht will be used.
~PCAWizardPage()
Destructor.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void setLayer(te::map::AbstractLayerPtr layer)
This function sets the layer that contains the raster that will be sliced.