+bool MULTIPR_GUI_DecimateDlg::setGradAvgFilterParams(char* pParams)
+{
+ int boxing = spinBoxBoxing->value();
+
+ double thresholdMed;
+ int ret = sscanf(lineEditTMed->text().toLatin1(), "%lf", &thresholdMed);
+ if ((ret != 1) || (thresholdMed <= 0.0f))
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Invalid medium threshold (should be > 0.0)");
+
+ return false;
+ }
+
+ double thresholdLow;
+ ret = sscanf(lineEditTLow->text().toLatin1(), "%lf", &thresholdLow);
+ if ((ret != 1) || (thresholdLow <= 0.0f))
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Invalid low threshold (should be > 0.0)");
+
+ return false;
+ }
+
+ if (thresholdMed >= thresholdLow)
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Medium threshold must be < low threshold");
+
+ return false;
+ }
+
+ double radius;
+ ret = sscanf(lineEditRadius->text().toLatin1(), "%lf", &radius);
+ if ((ret != 1) || (radius <= 0.0f))
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Invalid radius (should be > 0.0)");
+
+ return false;
+ }
+
+ sprintf(pParams, "%lf %lf %lf %d", thresholdMed, thresholdLow, radius, boxing);
+
+ return true;
+}
+
+bool MULTIPR_GUI_DecimateDlg::setDirectFilterParams(char* pParams)
+{
+ double thresholdMed;
+ int ret = sscanf(lineEditTMed->text().toLatin1(), "%lf", &thresholdMed);
+ if (ret != 1)
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Invalid medium threshold.");
+
+ return false;
+ }
+
+ double thresholdLow;
+ ret = sscanf(lineEditTLow->text().toLatin1(), "%lf", &thresholdLow);
+ if (ret != 1)
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Invalid low threshold.");
+
+ return false;
+ }
+
+ if (thresholdMed >= thresholdLow)
+ {
+ SUIT_MessageBox::critical(
+ (QWidget*)mModule->getAppli()->desktop(),
+ "Decimation parameters error",
+ "Medium threshold must be < low threshold");
+
+ return false;
+ }
+
+ sprintf(pParams, "%lf %lf", thresholdMed, thresholdLow);