Example #1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int StatsGenPlotWidget::extractStatsData(int index,
                                         QVector<float>&  binNumbers,
                                         VectorOfFloatArray arrays)
{
  int err = 0;
  if (m_StatsType == DREAM3D::StatisticsType::UnknownStatisticsGroup)
  {
    QMessageBox::critical(this, tr("StatsGenerator"),
                          tr("This Plot has not been assigned a Statistics Group. This should be happening from within the program. Contact the developer."),
                          QMessageBox::Ok,
                          QMessageBox::Ok);
    return -1;
  }

  if (m_DistributionType == DREAM3D::DistributionType::UnknownDistributionType)
  {
    QMessageBox::critical(this, tr("StatsGenerator"),
                          tr("The 'Distribution Type' was of an unknown type."),
                          QMessageBox::Ok,
                          QMessageBox::Ok);
    return -1;
  }


  // Remove all the current rows in the table model
  m_TableModel->removeRows(0, m_TableModel->rowCount());

  // This will force a reset of the table model creating a new table model
  setDistributionType(m_DistributionType); // This makes sure the combo box is set correctly

  QVector<QString> colors;
  qint32 count = binNumbers.count();
  QStringList colorNames = QColor::colorNames();
  qint32 colorOffset = 21;
  for (qint32 i = 0; i < count; ++i)
  {
    colors.push_back(colorNames[colorOffset++]);
  }
  QVector<QVector<float> > data;

  for(VectorOfFloatArray::size_type i = 0; i < arrays.size(); ++i)
  {
    QVector<float> col(static_cast<int>(arrays[i]->getNumberOfTuples()));
    if (arrays[i]->getNumberOfTuples() > 0)
    {
      ::memcpy( &(col.front()), arrays[i]->getVoidPointer(0), sizeof(float)*col.size() );
    }
    data.push_back(col);
  }

  m_TableModel->setTableData(binNumbers, data, colors);

  m_TableView->resizeColumnsToContents();
  m_TableView->scrollToBottom();
  m_TableView->setFocus();
  updatePlotCurves();

  m_UserUpdatedData = true;
  return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FitFeatureData::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setNewEnsembleArrayArray(reader->readDataArrayPath("NewEnsembleArrayArray", getNewEnsembleArrayArray()));
  setBiasedFeaturesArrayPath(reader->readDataArrayPath("BiasedFeaturesArrayPath", getBiasedFeaturesArrayPath() ) );
  setFeaturePhasesArrayPath(reader->readDataArrayPath("FeaturePhasesArrayPath", getFeaturePhasesArrayPath() ) );
  setSelectedFeatureArrayPath( reader->readDataArrayPath( "SelectedFeatureArrayPath", getSelectedFeatureArrayPath() ) );
  setDistributionType( reader->readValue( "DistributionType", getDistributionType() ) );
  setRemoveBiasedFeatures( reader->readValue( "RemoveBiasedFeatures", getRemoveBiasedFeatures() ) );
  reader->closeFilterGroup();
}