// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void MultiOtsuThreshold::preflight() { // These are the REQUIRED lines of CODE to make sure the filter behaves correctly setInPreflight(true); // Set the fact that we are preflighting. emit preflightAboutToExecute(); // Emit this signal so that other widgets can do one file update emit updateFilterParameters(this); // Emit this signal to have the widgets push their values down to the filter dataCheck(); // Run our DataCheck to make sure everthing is setup correctly emit preflightExecuted(); // We are done preflighting this filter setInPreflight(false); // Inform the system this filter is NOT in preflight mode anymore. }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindTwinBoundarySchmidFactors::preflight() { setInPreflight(true); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheckVoxel(); dataCheckSurfaceMesh(); emit preflightExecuted(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void GenerateFaceSchuhMisorientationColoring::preflight() { setInPreflight(true); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheckSurfaceMesh(); dataCheckVoxel(); emit preflightExecuted(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void RegularGridSampleSurfaceMesh::preflight() { setInPreflight(true); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheck(); emit preflightExecuted(); SampleSurfaceMesh::preflight(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ChangeResolution::preflight() { setInPreflight(true); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheck(); if (getErrorCondition() < 0) { emit preflightExecuted(); setInPreflight(false); return; } DataContainer::Pointer m; if (m_SaveAsNewDataContainer == false) { m = getDataContainerArray()->getDataContainer(getCellAttributeMatrixPath().getDataContainerName()); } else { m = getDataContainerArray()->getDataContainer(getNewDataContainerName()); } size_t dims[3] = { 0, 0, 0 }; m->getGeometryAs<ImageGeom>()->getDimensions(dims); float sizex = (dims[0]) * m->getGeometryAs<ImageGeom>()->getXRes(); float sizey = (dims[1]) * m->getGeometryAs<ImageGeom>()->getYRes(); float sizez = (dims[2]) * m->getGeometryAs<ImageGeom>()->getZRes(); size_t m_XP = size_t(sizex / m_Resolution.x); size_t m_YP = size_t(sizey / m_Resolution.y); size_t m_ZP = size_t(sizez / m_Resolution.z); if (m_XP == 0) { m_XP = 1; } if (m_YP == 0) { m_YP = 1; } if (m_ZP == 0) { m_ZP = 1; } m->getGeometryAs<ImageGeom>()->setDimensions(m_XP, m_YP, m_ZP); m->getGeometryAs<ImageGeom>()->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z); QVector<size_t> tDims(3, 0); tDims[0] = m_XP; tDims[1] = m_YP; tDims[2] = m_ZP; m->getAttributeMatrix(getCellAttributeMatrixPath().getAttributeMatrixName())->setTupleDimensions(tDims); if (m_RenumberFeatures == true) { AttributeMatrix::Pointer cellFeatureAttrMat = m->getAttributeMatrix(getCellFeatureAttributeMatrixPath().getAttributeMatrixName()); QVector<bool> activeObjects(cellFeatureAttrMat->getNumTuples(), true); cellFeatureAttrMat->removeInactiveObjects(activeObjects, m_FeatureIdsPtr.lock()); } emit preflightExecuted(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void WriteStatsGenOdfAngleFile::preflight() { setInPreflight(true); /* Place code here that sanity checks input arrays and input values. Look at some * of the other DREAM3DLib/Filters/.cpp files for sample codes */ emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheck(); emit preflightExecuted(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindGBCD::preflight() { setInPreflight(true); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheckVoxel(); // order here matters...because we are going to use the size of the crystal structures out of the dataCheckVoxel to size the faceAttrMat in dataCheckSurfaceMesh if (getErrorCondition() >= 0) { dataCheckSurfaceMesh(); } emit preflightExecuted(); setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataArraySelectionWidget::setupGui() { // Sanity Check the filter and the filter parameter if(getFilter() == NULL) { return; } if (getFilterParameter() == NULL) { return; } // Generate the text for the QLabel label->setText(getFilterParameter()->getHumanLabel() ); // Get the default path from the Filter instance to cache m_DefaultPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataArrayPath>(); // dataContainerCombo->addItem(m_DefaultPath.getDataContainerName()); // attributeMatrixCombo->addItem(m_DefaultPath.getAttributeMatrixName() ); // attributeArrayCombo->addItem(m_DefaultPath.getDataArrayName() ); // Block Signals from the ComboBoxes while we clear them dataContainerCombo->blockSignals(true); attributeMatrixCombo->blockSignals(true); attributeArrayCombo->blockSignals(true); dataContainerCombo->clear(); attributeMatrixCombo->clear(); attributeArrayCombo->clear(); dataContainerCombo->blockSignals(false); attributeMatrixCombo->blockSignals(false); attributeArrayCombo->blockSignals(false); populateComboBoxes(); // Lastly, hook up the filter's signals and slots to our own signals and slots // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void VolumeDataContainerInfoWidget::setupGui() { if(getFilter() == NULL) { return; } // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); if (m_FilterParameter == NULL) { return; } label->setText(m_FilterParameter->getHumanLabel() ); dataContainerList->blockSignals(true); dataContainerList->clear(); // Now let the gui send signals like normal dataContainerList->blockSignals(false); if (m_FilterParameter != NULL) { IntVec3_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<IntVec3_t>(); QString str = QString("%1 x %2 x %3").arg(data.x).arg(data.y).arg(data.z); voxelExtentsLabel->setText(str); } if (m_FilterParameter != NULL) { FloatVec3_t data = getFilter()->property(m_FilterParameter->getResolutionProperty().toLatin1().constData()).value<FloatVec3_t>(); QString str = QString("%1, %2, %3").arg(data.x).arg(data.y).arg(data.z); resolutionLabel->setText(str); } populateComboBoxes(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FloatVec3Widget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(xData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(yData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(zData, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QLocale loc = QLocale::system(); QDoubleValidator* xVal = new QDoubleValidator(xData); xData->setValidator(xVal); xVal->setLocale(loc); QDoubleValidator* yVal = new QDoubleValidator(yData); yData->setValidator(yVal); yVal->setLocale(loc); QDoubleValidator* zVal = new QDoubleValidator(zData); zData->setValidator(zVal); zVal->setLocale(loc); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); FloatVec3_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<FloatVec3_t>(); xData->setText(loc.toString(data.x)); yData->setText(loc.toString(data.y)); zData->setText(loc.toString(data.z)); } errorLabel->hide(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataArrayCreationWidget::setupGui() { blockSignals(true); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QString str = getFilter()->property(PROPERTY_NAME_AS_CHAR).toString(); dataArrayName->setText(str); } blockSignals(false); applyChangesBtn->setVisible(false); // Do not allow the user to put a forward slash into the attributeMatrixName line edit dataArrayName->setValidator(new QRegularExpressionValidator(QRegularExpression("[^/]*"), this)); // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(dataArrayName, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&))); dataContainerCombo->blockSignals(true); attributeMatrixCombo->blockSignals(true); dataArrayName->blockSignals(true); dataContainerCombo->clear(); attributeMatrixCombo->clear(); dataArrayName->clear(); // Now let the gui send signals like normal dataContainerCombo->blockSignals(false); attributeMatrixCombo->blockSignals(false); dataArrayName->blockSignals(false); populateComboBoxes(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerReader::preflight() { setInPreflight(true); // Annouce we are about to preflight // The GUI will pick up the structure emit preflightAboutToExecute(); // The Gui sends down any changes to the Proxy (which for preflight we don't care about) emit updateFilterParameters(this); // to the read here because this will populate the DataContainerArray with our DataContainer dataCheck(); // The GUI needs to send down the selections that were made by the user and we need to update // DataContainerArray->DataContainer object so the rest of the pipeline has the proper information emit preflightExecuted(); // Done executing setInPreflight(false); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void UnknownWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); if (getFilterParameter() != NULL) { QString str = QObject::tr("%1: Unknown Filter ParameterWidgetType: %2.").arg(getFilterParameter()->getHumanLabel()).arg(getFilterParameter()->getWidgetType()); label->setText( str ); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerReaderWidget::setupGui() { connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); // Put in a QStandardItemModel QAbstractItemModel* oldModel = dcaProxyView->model(); QStandardItemModel* model = new QStandardItemModel; dcaProxyView->setModel(model); delete oldModel; // void activated(const QModelIndex& index); connect(dcaProxyView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemActivated(const QModelIndex))); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); } if(getFilter() != NULL) { QString path = m_Filter->getInputFile(); filePath->setText(path); on_filePath_fileDropped(path); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DynamicTableWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); tableLabel->setText(m_FilterParameter->getHumanLabel()); // Set the item delegate so that we can only enter 'double' values into the table DynamicTableItemDelegate* dlg = new DynamicTableItemDelegate; dynamicTable->setItemDelegate(dlg); // Set button tooltips addRowBtn->setToolTip(addRowTT); addColBtn->setToolTip(addColTT); deleteRowBtn->setToolTip(deleteRowTT); deleteColBtn->setToolTip(deleteColTT); // Populate the table populateTable(); // Set Icons QIcon addIcon = QIcon(QString(":/add2.png")); QIcon deleteIcon = QIcon(QString(":/delete2.png")); addRowBtn->setIcon(addIcon); addColBtn->setIcon(addIcon); deleteRowBtn->setIcon(deleteIcon); deleteColBtn->setIcon(deleteIcon); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void BooleanWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(stateChanged(int)), this, SLOT(widgetChanged(int) ) ); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); QVariant objValue = getFilter()->property(PROPERTY_NAME_AS_CHAR); if (objValue.isValid() == true) { value->setChecked(objValue.toBool()); } else { QString ss = QObject::tr("Error occurred getting Filter Parameter %1 for filter %2").arg(getFilterParameter()->getPropertyName()).arg(getFilter()->getNameOfClass()); emit errorSettingFilterParameter(ss); qDebug() << ss; } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ChoiceWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(value, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetChanged(int) ) ); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); // setup the list of choices for the widget ChoiceFilterParameter* choice = dynamic_cast<ChoiceFilterParameter*>(getFilterParameter()); if(choice) { QList<QString> choices = choice->getChoices().toList(); value->blockSignals(true); value->addItems(choices); value->blockSignals(false); } // Get the Default value from the filter int i = getFilter()->property(PROPERTY_NAME_AS_CHAR).toInt(); value->setCurrentIndex(i); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DataContainerArrayProxyWidget::setupGui() { connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); // Put in a QStandardItemModel QAbstractItemModel* oldModel = dcaProxyView->model(); QStandardItemModel* model = new QStandardItemModel; dcaProxyView->setModel(model); delete oldModel; connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemActivated(QStandardItem*))); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); //If the filter is just being dragged into the pipeline then the filter is going to have an empty // Proxy object at which point nothing is going to be put into the lists. But if the Filter was // initialized from a pipeline file then it might actually have a proxy so we need to do something // with that proxy? m_DcaProxy = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataContainerArrayProxy>(); //m_DcaProxy.print("DataContainerArrayProxyWidget::setupGui()"); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void Symmetric6x6Widget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(v11, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v12, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v13, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v14, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v15, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v16, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v22, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v23, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v24, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v25, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v26, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v33, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v34, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v35, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v36, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v44, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v45, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v46, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v55, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v56, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(v66, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QDoubleValidator* v11Val = new QDoubleValidator(v11); v11->setValidator(v11Val); QDoubleValidator* v12Val = new QDoubleValidator(v12); v12->setValidator(v12Val); QDoubleValidator* v13Val = new QDoubleValidator(v13); v13->setValidator(v13Val); QDoubleValidator* v14Val = new QDoubleValidator(v14); v14->setValidator(v14Val); QDoubleValidator* v15Val = new QDoubleValidator(v15); v15->setValidator(v15Val); QDoubleValidator* v16Val = new QDoubleValidator(v16); v16->setValidator(v16Val); QDoubleValidator* v22Val = new QDoubleValidator(v22); v22->setValidator(v22Val); QDoubleValidator* v23Val = new QDoubleValidator(v23); v23->setValidator(v23Val); QDoubleValidator* v24Val = new QDoubleValidator(v24); v24->setValidator(v24Val); QDoubleValidator* v25Val = new QDoubleValidator(v25); v25->setValidator(v25Val); QDoubleValidator* v26Val = new QDoubleValidator(v26); v26->setValidator(v26Val); QDoubleValidator* v33Val = new QDoubleValidator(v33); v33->setValidator(v33Val); QDoubleValidator* v34Val = new QDoubleValidator(v34); v34->setValidator(v34Val); QDoubleValidator* v35Val = new QDoubleValidator(v35); v35->setValidator(v35Val); QDoubleValidator* v36Val = new QDoubleValidator(v36); v36->setValidator(v36Val); QDoubleValidator* v44Val = new QDoubleValidator(v44); v44->setValidator(v44Val); QDoubleValidator* v45Val = new QDoubleValidator(v45); v45->setValidator(v45Val); QDoubleValidator* v46Val = new QDoubleValidator(v46); v46->setValidator(v46Val); QDoubleValidator* v55Val = new QDoubleValidator(v55); v55->setValidator(v55Val); QDoubleValidator* v56Val = new QDoubleValidator(v56); v56->setValidator(v56Val); QDoubleValidator* v66Val = new QDoubleValidator(v66); v66->setValidator(v66Val); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); FloatVec21_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<FloatVec21_t>(); v11->setText( QString::number(data.v11) ); v12->setText( QString::number(data.v12) ); v13->setText( QString::number(data.v13) ); v14->setText( QString::number(data.v14) ); v15->setText( QString::number(data.v15) ); v16->setText( QString::number(data.v16) ); v22->setText( QString::number(data.v22) ); v23->setText( QString::number(data.v23) ); v24->setText( QString::number(data.v24) ); v25->setText( QString::number(data.v25) ); v26->setText( QString::number(data.v26) ); v33->setText( QString::number(data.v33) ); v34->setText( QString::number(data.v34) ); v35->setText( QString::number(data.v35) ); v36->setText( QString::number(data.v36) ); v44->setText( QString::number(data.v44) ); v45->setText( QString::number(data.v45) ); v46->setText( QString::number(data.v46) ); v55->setText( QString::number(data.v55) ); v56->setText( QString::number(data.v56) ); v66->setText( QString::number(data.v66) ); } //connect combobox to symmetry state connect(comboBox, SIGNAL(currentIndexChanged( int )), this, SLOT( changeSym( int ) ) ); clearSym(); changeSym(comboBox->currentIndex()); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FourthOrderPolynomialWidget::setupGui() { // Catch when the filter is about to execute the preflight connect(getFilter(), SIGNAL(preflightAboutToExecute()), this, SLOT(beforePreflight())); // Catch when the filter is finished running the preflight connect(getFilter(), SIGNAL(preflightExecuted()), this, SLOT(afterPreflight())); // Catch when the filter wants its values updated connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)), this, SLOT(filterNeedsInputParameters(AbstractFilter*))); connect(c40, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c04, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c31, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c13, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c22, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c30, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c03, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c21, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c12, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c20, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c02, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c11, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c10, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c01, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); connect(c00, SIGNAL(textChanged(const QString&)), this, SLOT(widgetChanged(const QString&) ) ); QDoubleValidator* c40Val = new QDoubleValidator(c40); c40->setValidator(c40Val); QDoubleValidator* c04Val = new QDoubleValidator(c04); c04->setValidator(c04Val); QDoubleValidator* c31Val = new QDoubleValidator(c31); c31->setValidator(c31Val); QDoubleValidator* c13Val = new QDoubleValidator(c13); c13->setValidator(c13Val); QDoubleValidator* c22Val = new QDoubleValidator(c22); c22->setValidator(c22Val); QDoubleValidator* c30Val = new QDoubleValidator(c30); c30->setValidator(c30Val); QDoubleValidator* c03Val = new QDoubleValidator(c03); c03->setValidator(c03Val); QDoubleValidator* c21Val = new QDoubleValidator(c21); c21->setValidator(c21Val); QDoubleValidator* c12Val = new QDoubleValidator(c12); c12->setValidator(c12Val); QDoubleValidator* c20Val = new QDoubleValidator(c20); c20->setValidator(c20Val); QDoubleValidator* c02Val = new QDoubleValidator(c02); c02->setValidator(c02Val); QDoubleValidator* c11Val = new QDoubleValidator(c11); c11->setValidator(c11Val); QDoubleValidator* c10Val = new QDoubleValidator(c10); c10->setValidator(c10Val); QDoubleValidator* c01Val = new QDoubleValidator(c01); c01->setValidator(c01Val); QDoubleValidator* c00Val = new QDoubleValidator(c00); c00->setValidator(c00Val); if (getFilterParameter() != NULL) { label->setText(getFilterParameter()->getHumanLabel() ); Float4thOrderPoly_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<Float4thOrderPoly_t>(); c40->setText( QString::number(data.c40) ); c04->setText( QString::number(data.c04) ); c31->setText( QString::number(data.c31) ); c13->setText( QString::number(data.c13) ); c22->setText( QString::number(data.c22) ); c30->setText( QString::number(data.c30) ); c03->setText( QString::number(data.c03) ); c21->setText( QString::number(data.c21) ); c12->setText( QString::number(data.c12) ); c20->setText( QString::number(data.c20) ); c02->setText( QString::number(data.c02) ); c11->setText( QString::number(data.c11) ); c10->setText( QString::number(data.c10) ); c01->setText( QString::number(data.c01) ); c00->setText( QString::number(data.c00) ); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void RotateSampleRefFrame::preflight() { setInPreflight(true); setErrorCondition(0); emit preflightAboutToExecute(); emit updateFilterParameters(this); dataCheck(); emit preflightExecuted(); if(getErrorCondition() < 0) { setInPreflight(false); return; } getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getCellAttributeMatrixPath().getDataContainerName()); getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, getCellAttributeMatrixPath(), -301); if(getErrorCondition() < 0) { setInPreflight(false); return; } DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getCellAttributeMatrixPath().getDataContainerName()); float rotAngle = m_RotationAngle * SIMPLib::Constants::k_Pi / 180.0; int64_t xp = 0, yp = 0, zp = 0; float xRes = 0.0f, yRes = 0.0f, zRes = 0.0f; int64_t xpNew = 0, ypNew = 0, zpNew = 0; float xResNew = 0.0f, yResNew = 0.0f, zResNew = 0.0f; RotateSampleRefFrameImplArg_t params; xp = static_cast<int64_t>(m->getGeometryAs<ImageGeom>()->getXPoints()); xRes = m->getGeometryAs<ImageGeom>()->getXRes(); yp = static_cast<int64_t>(m->getGeometryAs<ImageGeom>()->getYPoints()); yRes = m->getGeometryAs<ImageGeom>()->getYRes(); zp = static_cast<int64_t>(m->getGeometryAs<ImageGeom>()->getZPoints()); zRes = m->getGeometryAs<ImageGeom>()->getZRes(); params.xp = xp; params.xRes = xRes; params.yp = yp; params.yRes = yRes; params.zp = zp; params.zRes = zRes; size_t col = 0, row = 0, plane = 0; float rotMat[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float coords[3] = { 0.0f, 0.0f, 0.0f }; float newcoords[3] = { 0.0f, 0.0f, 0.0f }; float xMin = std::numeric_limits<float>::max(); float xMax = -xMin; float yMin = std::numeric_limits<float>::max(); float yMax = -yMin; float zMin = std::numeric_limits<float>::max(); float zMax = -zMin; FOrientArrayType om(9); FOrientTransformsType::ax2om(FOrientArrayType(m_RotationAxis.x, m_RotationAxis.y, m_RotationAxis.z, rotAngle), om); om.toGMatrix(rotMat); for (int32_t i = 0; i < 8; i++) { if (i == 0) { col = 0, row = 0, plane = 0; } if (i == 1) { col = xp - 1, row = 0, plane = 0; } if (i == 2) { col = 0, row = yp - 1, plane = 0; } if (i == 3) { col = xp - 1, row = yp - 1, plane = 0; } if (i == 4) { col = 0, row = 0, plane = zp - 1; } if (i == 5) { col = xp - 1, row = 0, plane = zp - 1; } if (i == 6) { col = 0, row = yp - 1, plane = zp - 1; } if (i == 7) { col = xp - 1, row = yp - 1, plane = zp - 1; } coords[0] = static_cast<float>(col * xRes); coords[1] = static_cast<float>(row * yRes); coords[2] = static_cast<float>(plane * zRes); MatrixMath::Multiply3x3with3x1(rotMat, coords, newcoords); if (newcoords[0] < xMin) { xMin = newcoords[0]; } if (newcoords[0] > xMax) { xMax = newcoords[0]; } if (newcoords[1] < yMin) { yMin = newcoords[1]; } if (newcoords[1] > yMax) { yMax = newcoords[1]; } if (newcoords[2] < zMin) { zMin = newcoords[2]; } if (newcoords[2] > zMax) { zMax = newcoords[2]; } } float xAxis[3] = {1, 0, 0}; float yAxis[3] = {0, 1, 0}; float zAxis[3] = {0, 0, 1}; float xAxisNew[3] = { 0.0f, 0.0f, 0.0f }; float yAxisNew[3] = { 0.0f, 0.0f, 0.0f }; float zAxisNew[3] = { 0.0f, 0.0f, 0.0f }; MatrixMath::Multiply3x3with3x1(rotMat, xAxis, xAxisNew); MatrixMath::Multiply3x3with3x1(rotMat, yAxis, yAxisNew); MatrixMath::Multiply3x3with3x1(rotMat, zAxis, zAxisNew); float closestAxis = 0.0f; xResNew = xRes; closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(xAxis, xAxisNew)); if (fabs(GeometryMath::CosThetaBetweenVectors(yAxis, xAxisNew)) > closestAxis) { xResNew = yRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(yAxis, xAxisNew)); } if (fabs(GeometryMath::CosThetaBetweenVectors(zAxis, xAxisNew)) > closestAxis) { xResNew = zRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(zAxis, xAxisNew)); } yResNew = yRes; closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(yAxis, yAxisNew)); if (fabs(GeometryMath::CosThetaBetweenVectors(xAxis, yAxisNew)) > closestAxis) { yResNew = xRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(xAxis, yAxisNew)); } if (fabs(GeometryMath::CosThetaBetweenVectors(zAxis, yAxisNew)) > closestAxis) { yResNew = zRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(zAxis, yAxisNew)); } zResNew = zRes; closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(zAxis, zAxisNew)); if (fabs(GeometryMath::CosThetaBetweenVectors(xAxis, zAxisNew)) > closestAxis) { zResNew = xRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(xAxis, zAxisNew)); } if (fabs(GeometryMath::CosThetaBetweenVectors(yAxis, zAxisNew)) > closestAxis) { zResNew = yRes, closestAxis = fabs(GeometryMath::CosThetaBetweenVectors(yAxis, zAxisNew)); } xpNew = static_cast<int64_t>(nearbyint((xMax - xMin) / xResNew) + 1); ypNew = static_cast<int64_t>(nearbyint((yMax - yMin) / yResNew) + 1); zpNew = static_cast<int64_t>(nearbyint((zMax - zMin) / zResNew) + 1); params.xpNew = xpNew; params.xResNew = xResNew; params.xMinNew = xMin; params.ypNew = ypNew; params.yResNew = yResNew; params.yMinNew = yMin; params.zpNew = zpNew; params.zResNew = zResNew; params.zMinNew = zMin; m->getGeometryAs<ImageGeom>()->setResolution(params.xResNew, params.yResNew, params.zResNew); m->getGeometryAs<ImageGeom>()->setDimensions(params.xpNew, params.ypNew, params.zpNew); setInPreflight(false); }