// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PrimaryEquiaxedPreset::initializeNeighborTableModel(StatsGenPlotWidget* plot, QVector<float> binNumbers) { // Make sure the distribution is set correctly plot->setDistributionType(DREAM3D::DistributionType::LogNormal, false); // This line basically makes sure we have the distribution type we are looking for SGLogNormalTableModel* model = qobject_cast<SGLogNormalTableModel*> (plot->tableModel()); if (NULL == model) { return; } qint32 count = binNumbers.count(); // Remove all the current rows in the table model model->removeRows(0, model->rowCount()); float mu, sigma; SIMPL_RANDOMNG_NEW() QVector<float> mus; QVector<float> sigmas; QVector<QString> colors; QStringList colorNames = QColor::colorNames(); qint32 colorOffset = 21; int middlebin = count / 2; for (qint32 i = 0; i < count; ++i) { mu = log(14.0 + (2.0 * float(i - middlebin))); sigma = 0.3 + (float(middlebin - i) / float(middlebin * 10)); mus.push_back(mu); sigmas.push_back(sigma); colors.push_back(colorNames[colorOffset++]); if (colorOffset == colorNames.size()) { colorOffset = 21; } } QVector<QVector<float> > data; data.push_back(mus); data.push_back(sigmas); model->setTableData(binNumbers, data, colors); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PrimaryRolledPreset::initializeNeighborTableModel(StatsGenPlotWidget* plot, QVector<float> binNumbers) { // Make sure the distribution is set correctly plot->setDistributionType(SIMPL::DistributionType::LogNormal, false); // This line basically makes sure we have the distribution type we are looking for SGLogNormalTableModel* model = qobject_cast<SGLogNormalTableModel*> (plot->tableModel()); if (NULL == model) { return; } qint32 count = binNumbers.count(); // Remove all the current rows in the table model model->removeRows(0, model->rowCount()); float mu, sigma; SIMPL_RANDOMNG_NEW() QVector<float> mus; QVector<float> sigmas; QVector<QColor> colors = GenerateColors(count, 160, 255); int middlebin = count / 2; for (qint32 i = 0; i < count; ++i) { mu = log(8.0 + (1.0 * float(i - middlebin))); sigma = 0.3 + (float(middlebin - i) / float(middlebin * 10)); mus.push_back(mu); sigmas.push_back(sigma); } QVector<QVector<float> > data; data.push_back(mus); data.push_back(sigmas); model->setTableData(binNumbers, data, colors); }