From 866b9f7fcb7c36af62e1e40763e0e1903ea806ac Mon Sep 17 00:00:00 2001
From: BertrandP <bertrand.provot@insa-rennes.fr>
Date: Thu, 19 Jul 2018 17:21:31 +0200
Subject: [PATCH] Test Ready functions

---
 app/CMakeLists.txt                      |  4 --
 app/Operations/QuantificationDialog.cpp | 25 +++++---
 app/Operations/QuantificationDialog.h   |  4 +-
 app/Operations/QuantificationOp.cpp     | 80 +++++++++++++++----------
 app/Operations/QuantificationOp.h       | 12 ++++
 app/Operations/ThresholdDialog.cpp      | 17 ++++--
 app/Operations/ThresholdDialog.h        | 11 ++--
 app/Operations/ThresholdOp.cpp          | 52 +++++++++++++---
 app/Operations/ThresholdOp.h            | 24 ++++++--
 app/Operations/TranslateOp.cpp          | 23 ++++++-
 app/Operations/TranslateOp.h            | 19 ++++--
 test/README.txt                         |  5 ++
 12 files changed, 197 insertions(+), 79 deletions(-)

diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 93c3d02..13b8423 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -134,7 +134,6 @@ set(imageinsa_SOURCES
 	Operations/ThresholdDialog.cpp
 	Operations/ThresholdDialog.h
 	Operations/ThresholdOp.cpp
-	Operations/ThresholdOp.cpp
 	Operations/ThresholdOp.h
 	Operations/Transforms.cpp
 	Operations/Transforms.h
@@ -220,7 +219,6 @@ target_link_libraries(imageinsa
 	Qt5::Xml
 	${RandomLib_LIBRARIES}
 )
-if(!WIN32)
   add_library(libimageinsa STATIC ${EXTRA_FLAGS} ${imageinsa_SOURCES} ${WRAPPED_UIS} ${UIS} ${QM_FILES} ${TS_FILES} ${RCC_FILES})
   target_link_libraries(libimageinsa
     core
@@ -231,8 +229,6 @@ if(!WIN32)
     Qt5::Xml
     ${RandomLib_LIBRARIES}
   )
-endif()
-
 add_custom_command(TARGET imageinsa POST_BUILD
 	COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPLOY_OUTPUT_DIRECTORY}/lang
 	COMMENT "Create directory ${DEPLOY_OUTPUT_DIRECTORY}/lang")
diff --git a/app/Operations/QuantificationDialog.cpp b/app/Operations/QuantificationDialog.cpp
index d017a05..92cfb80 100644
--- a/app/Operations/QuantificationDialog.cpp
+++ b/app/Operations/QuantificationDialog.cpp
@@ -103,27 +103,27 @@ Quantification QuantificationDialog::getQuantif(const Image* image, unsigned int
     int size = _sizeBox->value();
     if(_editorOnly) return Quantification::linearQuant(size);
     switch(_quantBox->currentIndex()) {
-        case 1: 
+        case 1:
                 to_print = QString(tr("Quantification non lineaire a valeurs centrees :")).toStdString();
-                return Quantification::nonLinearQuant(size, image, c); 
+                return Quantification::nonLinearQuant(size, image, c);
                 break;
-        case 2: 
+        case 2:
                 to_print = QString(tr("Quantification non lineaire a valeurs moyennes :")).toStdString();
-                return Quantification::nonLinearQuantOptimized(size, image, c); 
+                return Quantification::nonLinearQuantOptimized(size, image, c);
                 break;
-        case 3: 
+        case 3:
                 to_print = QString(tr("Quantification personnalisee :")).toStdString();
-                return _quantWidget->getQuantif(); 
+                return _quantWidget->getQuantif();
                 break;
-        case 4: 
+        case 4:
                 to_print = QString(tr("Quantification LloydMax :")).toStdString();
                 //*checkOptiQuant = true;
                 return Quantification::lloydMaxQuant(size, image, c);
                 break;
 
-        default: 
+        default:
                 to_print = QString(tr("Quantification lineaire a valeurs centrees :")).toStdString();
-                return Quantification::linearQuant(size); 
+                return Quantification::linearQuant(size);
                 break;
     }
 }
@@ -158,3 +158,10 @@ void QuantificationDialog::save() {
     }
 }
 
+void QuantificationDialog::setValues(int a){
+  _sizeBox->setValue(a);
+}
+
+void QuantificationDialog::setQuantif(int a){
+  _quantBox->setCurrentIndex(a);
+}
diff --git a/app/Operations/QuantificationDialog.h b/app/Operations/QuantificationDialog.h
index 2b56a89..80e5926 100644
--- a/app/Operations/QuantificationDialog.h
+++ b/app/Operations/QuantificationDialog.h
@@ -35,8 +35,10 @@ public:
     explicit QuantificationDialog(QWidget *parent = 0, QString imgName = QString());
     Quantification getQuantif(const imagein::Image *image, unsigned int c, std::string &, bool * checkOptiQuant);
     Quantification getQuantif();
+    void setValues(int);
+    void setQuantif(int);
 signals:
-    
+
 public slots:
     void methodChanged(int);
     void open();
diff --git a/app/Operations/QuantificationOp.cpp b/app/Operations/QuantificationOp.cpp
index 0bf8144..9ac49ca 100644
--- a/app/Operations/QuantificationOp.cpp
+++ b/app/Operations/QuantificationOp.cpp
@@ -20,8 +20,6 @@
 #include "QuantificationOp.h"
 #include "../Tools.h"
 #include <Converter.h>
-#include "QuantificationDialog.h"
-
 #include <QApplication>
 
 using namespace std;
@@ -30,6 +28,7 @@ using namespace genericinterface;
 
 QuantificationOp::QuantificationOp() : Operation(qApp->translate("Operations", "Quantification").toStdString())
 {
+  _test=false, _quantif=0, _values=2;
 }
 
 
@@ -40,7 +39,7 @@ bool QuantificationOp::needCurrentImg() const {
 string QuantificationOp::quantificationOpLog(unsigned int c, Quantification * quant){
     char buffer[30];
     string output_msg;
-    int val;    
+    int val;
     QString bob(qApp->translate("Operations", "\nCanal%d : \n"));
 
     sprintf(buffer, bob.toUtf8(), c);
@@ -49,10 +48,10 @@ string QuantificationOp::quantificationOpLog(unsigned int c, Quantification * qu
     output_msg += QString(qApp->translate("Operations","             Valeurs :  ")).toStdString();
 
     for(int i = 0; i < quant->nbValues(); ++i) {
-        
+
         val =(int)quant->value(i);
         if(i != 0) output_msg += " |  ";
-                
+
         sprintf(buffer, "%d ", val);
         output_msg += buffer;
         if(val < 10) output_msg += " ";
@@ -62,15 +61,15 @@ string QuantificationOp::quantificationOpLog(unsigned int c, Quantification * qu
     }
     output_msg += "\n";
     output_msg += QString(qApp->translate("Operations","             Seuils    :       ")).toStdString();
-            
+
     for(int i = 0; i < quant->nbThresholds(); ++i) {
         val =(int)quant->threshold(i);
 
         if(i != 0) output_msg += " |  ";
-                
+
         sprintf(buffer, "%d ", val);
         output_msg += buffer;
-                
+
         if(val < 10) output_msg += " ";
         if(val < 100 ) output_msg += " ";
     }
@@ -81,22 +80,22 @@ string QuantificationOp::quantificationOpLog(unsigned int c, Quantification * qu
 }
 
 string checkOptimumQuantizier(const imagein::Image* image, Quantification * quant, unsigned int c){
-    
+
     float baricenter;
-    float valueCenter; 
+    float valueCenter;
     float centroid = 0.0;
     float neighbor = 0.0;
     int som_lum = 0;
     int nb_points = 0;
     char buffer[100];
-    
+
     Histogram hist = image->getHistogram(c);
     for (int j=1; j<quant->nbThresholds();j++){
         som_lum = 0;
         nb_points = 0;
-        //Calcul des baricentres entre deux seuils  
+        //Calcul des baricentres entre deux seuils
         for(int i= quant->threshold(j-1); i <= quant->threshold(j); i++){
-            som_lum += hist[i]*i;          
+            som_lum += hist[i]*i;
             nb_points += hist[i];
         }
         if(nb_points != 0) baricenter = som_lum/nb_points;
@@ -105,34 +104,34 @@ string checkOptimumQuantizier(const imagein::Image* image, Quantification * quan
         centroid += abs( baricenter - quant->value(j) ) /( quant->threshold(j) - quant->threshold(j-1) ) * 100;
     }
 
-    //cas spécial 
+    //cas spécial
     if( quant->nbValues() == 2){
         som_lum = 0;
         nb_points = 0;
         for(int i= 0; i <= quant->threshold(0); i++){
-                som_lum += hist[i]*i;          
+                som_lum += hist[i]*i;
                 nb_points += hist[i];
         }
         if(nb_points != 0) baricenter = som_lum/nb_points;
         else baricenter =  (quant->threshold(0))/2;;
         centroid = abs( baricenter - quant->value(0) ) /( quant->threshold(0) ) * 100;
-        
+
         som_lum = 0;
         nb_points = 0;
         for(int i= quant->threshold(0); i <= 255 ; i++){
-                som_lum += hist[i]*i;          
+                som_lum += hist[i]*i;
                 nb_points += hist[i];
             }
         if(nb_points != 0) baricenter = som_lum/nb_points;
-        else baricenter =  255 - quant->threshold(0)/2;    
+        else baricenter =  255 - quant->threshold(0)/2;
         centroid += abs( baricenter - quant->value(1) ) / ( 255 - quant->threshold(0) ) * 100;
     }
     for(int i = 0; i<quant->nbThresholds(); i++){
-        
-        valueCenter = ( quant->value(i) + quant->value(i+1) ) / 2 ; 
+
+        valueCenter = ( quant->value(i) + quant->value(i+1) ) / 2 ;
         neighbor += abs( valueCenter - quant->threshold(i) ) / ( quant->value(i) - quant->value(i+1) ) * 100;
     }
-    
+
     neighbor = neighbor / quant->nbThresholds();
     if( quant->nbValues() == 2) centroid = centroid / 2;
     else centroid = centroid / ( quant->nbThresholds() - 1 );
@@ -151,38 +150,42 @@ void QuantificationOp::operator()(const imagein::Image* image, const std::map<co
     string output_msg = "";
     string optiQuant;
 
-    bool checkOptiQuant; 
+    bool checkOptiQuant;
 
     QuantificationDialog* dialog;
+
     if(image != NULL) {
         QString imgName = QString::fromStdString(imgList.find(image)->second);
-        
         dialog = new QuantificationDialog(QApplication::activeWindow(), imgName);
     }
     else {
         dialog = new QuantificationDialog(QApplication::activeWindow());
     }
 
-    QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
-
+    if(_test){
+      dialog->setQuantif(_quantif);
+      dialog->setValues(_values);
+    }else{
+      QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
+      if(code!=QDialog::Accepted) return;
+    }
 
-    if(code!=QDialog::Accepted) return;
 
     if(image != NULL) {
-        
+
         Image* resImg = new Image(image->getWidth(), image->getHeight(), image->getNbChannels());
         for(unsigned int c = 0; c < image->getNbChannels(); ++c) {
-            
-            
+
+
             Quantification quantification = dialog->getQuantif(image, c, quantType, &checkOptiQuant);
-            
+
             //Generate the text to print in the information window
             output_msg += quantificationOpLog(c, &quantification);
 
 
             for(unsigned int j = 0; j < image->getHeight(); ++j) {
                 for(unsigned int i = 0; i < image->getWidth(); ++i) {
-                    
+
                     const Image::depth_t value = image->getPixelAt(i, j, c);
                     resImg->setPixelAt(i, j, c, quantification.valueOf(value));
                 }
@@ -191,8 +194,8 @@ void QuantificationOp::operator()(const imagein::Image* image, const std::map<co
                 optiQuant += checkOptimumQuantizier(image, &quantification, c);
         }
 
-        
-        
+
+
         outText(quantType);
         outText(output_msg);
         if(checkOptiQuant){
@@ -217,3 +220,14 @@ void QuantificationOp::operator()(const imagein::Image* image, const std::map<co
 
 }
 
+void QuantificationOp::setTest(bool a){
+  _test=a;
+}
+
+void QuantificationOp::setQuantif(int a){
+  _quantif=a;
+}
+
+void QuantificationOp::setValues(int a ){
+  _values = a;
+}
diff --git a/app/Operations/QuantificationOp.h b/app/Operations/QuantificationOp.h
index dfabe02..72d8fec 100644
--- a/app/Operations/QuantificationOp.h
+++ b/app/Operations/QuantificationOp.h
@@ -22,6 +22,7 @@
 
 #include <Operation.h>
 #include "Quantification.h"
+#include "QuantificationDialog.h"
 class QuantificationOp : public Operation
 {
 public:
@@ -34,6 +35,17 @@ public:
     void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
 
     bool needCurrentImg() const;
+
+    void setTest(bool);
+
+    void setQuantif(int);
+
+    void setValues(int);
+
+private:
+    bool _test;
+    int _quantif;
+    int _values;
 };
 
 #endif // QUANTIFICATIONOP_H
diff --git a/app/Operations/ThresholdDialog.cpp b/app/Operations/ThresholdDialog.cpp
index 8d2bb41..a1bdbc6 100644
--- a/app/Operations/ThresholdDialog.cpp
+++ b/app/Operations/ThresholdDialog.cpp
@@ -35,7 +35,6 @@ void ThresholdDialog::marker2Moved(const QPointF& point) {
 void ThresholdDialog::spinbox1Changed(int i) {
     _marker1->setXValue(i);
      updatePreview();
-
 }
 
 void ThresholdDialog::spinbox2Changed(int i) {
@@ -54,11 +53,18 @@ void ThresholdDialog::doubleThreshold(bool activate) {
     }
 }
 
+void ThresholdDialog::setSpinBox1(int a){
+  _spinbox1->setValue(a);
+}
+
+void ThresholdDialog::setSpinBox2(int a){
+  _spinbox2->setValue(a);
+}
+
 void ThresholdDialog::otsu() {
     int threshold = Otsu_t<GrayscaleImage::depth_t>::computeThreshold(_image);
     _marker1->setXValue(threshold);
     _spinbox1->setValue(threshold);
-
 }
 
 void ThresholdDialog::updatePreview(){
@@ -128,7 +134,7 @@ ThresholdDialog::ThresholdDialog(const GrayscaleImage* image, bool converted)  :
     box2layout->addWidget(spin2label);
     box2layout->addWidget(_spinbox2);
     Vboxlayout->addLayout(box2layout);
-    
+
     QHBoxLayout* radiolayout = new QHBoxLayout();
     QLabel* radioLabel = new QLabel(tr("Color between thresholds :"));
     QRadioButton* whiteButton = new QRadioButton(tr("White"));
@@ -152,7 +158,7 @@ ThresholdDialog::ThresholdDialog(const GrayscaleImage* image, bool converted)  :
     _marker1->setLinePen(QPen(Qt::black));
     _marker1->setXValue(127);
     _marker1->attach(plot);
-    
+
     _marker2 = new QwtPlotMarker();
     _marker2->setLineStyle(QwtPlotMarker::VLine);
     _marker2->setLinePen(QPen(Qt::black));
@@ -175,7 +181,7 @@ ThresholdDialog::ThresholdDialog(const GrayscaleImage* image, bool converted)  :
 
 
     layout->setSizeConstraint(QLayout::SetMinimumSize);
-    
+
     QPushButton *okButton = new QPushButton(tr("Validate"), this);
     okButton->setDefault(true);
     Vboxlayout->addWidget(okButton);
@@ -207,4 +213,3 @@ ThresholdDialog::ThresholdDialog(const GrayscaleImage* image, bool converted)  :
 
 
 }
-
diff --git a/app/Operations/ThresholdDialog.h b/app/Operations/ThresholdDialog.h
index 044dd92..fbf6283 100644
--- a/app/Operations/ThresholdDialog.h
+++ b/app/Operations/ThresholdDialog.h
@@ -1,18 +1,18 @@
 /*
  * Copyright 2011-2012 INSA Rennes
- * 
+ *
  * This file is part of ImageINSA.
- * 
+ *
  * ImageINSA is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * ImageINSA is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with ImageINSA.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -55,6 +55,9 @@ class ThresholdDialog : public QDialog {
     void otsu();
     void updatePreview();
     void showPreview(bool);
+    void setSpinBox1(int);
+    void setSpinBox2(int);
+
 
   private:
     QwtPlotMarker *_marker1, *_marker2;
diff --git a/app/Operations/ThresholdOp.cpp b/app/Operations/ThresholdOp.cpp
index bd89f53..0d890be 100644
--- a/app/Operations/ThresholdOp.cpp
+++ b/app/Operations/ThresholdOp.cpp
@@ -2,37 +2,57 @@
 #include "Converter.h"
 
 #include "ThresholdOp.h"
-#include "ThresholdDialog.h"
 #include "../Tools.h"
-using namespace std     ;
+
+
+using namespace std;
 using namespace imagein;
 using namespace imagein::algorithm;
 
 ThresholdOp::ThresholdOp() : Operation(qApp->translate("Operations", "Thresholding").toStdString()) {
+  _test = false, _testotsu=false, _testThreshold1=-1, _testThreshold2=-1;
 }
 
 bool ThresholdOp::needCurrentImg() const {
     return true;
 }
 
+
 void ThresholdOp::operator()(const imagein::Image* image, const std::map<const imagein::Image*, std::string>&) {
     const GrayscaleImage* img = dynamic_cast<const GrayscaleImage*>(image);
     bool convert = (img == NULL);
+
     if(convert) {
         img = Converter<GrayscaleImage>::convert(*image);
     }
 
     ThresholdDialog* dialog = new ThresholdDialog(img, convert);
-    
-    QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
-    
-    if(code!=QDialog::Accepted) {
-        return;
+
+
+    if(_test && _testotsu){
+      dialog->otsu();
+    }
+    else if(_test){
+      dialog->setSpinBox1(_testThreshold1);
+      if(_testThreshold2!=-1){
+        dialog->doubleThreshold(true);
+        dialog->setSpinBox2(_testThreshold2);
+
+      }
     }
+    else{
+        QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
+        if(code!=QDialog::Accepted) {
+            return;
+        }
+    }
+
+
+
 
     Binarization_t<GrayscaleImage::depth_t>* algo;
     if(dialog->doubleThreshold()) {
-        algo = new Binarization_t<GrayscaleImage::depth_t>(dialog->threshold1(), dialog->threshold2(), dialog->blackBand());
+        algo = new Binarization_t<GrayscaleImage::depth_t>(dialog->threshold1(),dialog->threshold2(), dialog->blackBand());
     }
     else {
         algo = new Binarization_t<GrayscaleImage::depth_t>(dialog->threshold1());
@@ -42,3 +62,19 @@ void ThresholdOp::operator()(const imagein::Image* image, const std::map<const i
     delete algo;
     this->outImage(resImg);
 }
+
+void ThresholdOp::setTest(bool a){
+  _test = a;
+}
+
+void ThresholdOp::setTestThreshold1(int a){
+  _testThreshold1 = a;
+}
+
+void ThresholdOp::setTestThreshold2(int a){
+  _testThreshold2 = a;
+}
+
+void ThresholdOp::setTestOtsu(bool a){
+  _testotsu = a;
+}
diff --git a/app/Operations/ThresholdOp.h b/app/Operations/ThresholdOp.h
index 98ddc85..df0b65b 100644
--- a/app/Operations/ThresholdOp.h
+++ b/app/Operations/ThresholdOp.h
@@ -1,18 +1,18 @@
 /*
  * Copyright 2011-2012 INSA Rennes
- * 
+ *
  * This file is part of ImageINSA.
- * 
+ *
  * ImageINSA is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * ImageINSA is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with ImageINSA.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -33,13 +33,14 @@
 #include "Operation.h"
 #include "Image.h"
 #include "GrayscaleImage.h"
+#include "ThresholdDialog.h"
 
 class QWidget;
 
 class ThresholdOp : public Operation {
 
   public:
-    
+
     ThresholdOp();
 
     void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
@@ -48,9 +49,20 @@ class ThresholdOp : public Operation {
 
     static inline QString tr(const char* str) { return QCoreApplication::tr(str); }
 
+    void setTest(bool);
+
+    void setTestThreshold1(int);
+
+    void setTestThreshold2(int);
+
+    void setTestOtsu(bool);
+
 
   private:
+    bool _test;
+    int _testThreshold1;
+    int _testThreshold2;
+    bool _testotsu;
 
 };
-
 #endif //!THRESHOLDOP_H
diff --git a/app/Operations/TranslateOp.cpp b/app/Operations/TranslateOp.cpp
index b05f5d6..32f66ac 100644
--- a/app/Operations/TranslateOp.cpp
+++ b/app/Operations/TranslateOp.cpp
@@ -10,6 +10,7 @@ using namespace std;
 using namespace imagein;
 
 TranslateOp::TranslateOp() : Operation(qApp->translate("Operations", "Translation").toStdString()) {
+  _test=false, _xval=0, _yval=0;
 }
 
 bool TranslateOp::needCurrentImg() const {
@@ -49,9 +50,13 @@ void TranslateOp::operator()(const Image* img, const map<const Image*, string>&
     QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
     QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
 
-    QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
-
-    if(code!=QDialog::Accepted) return;
+    if(_test){
+      xSpinBox->setValue(_xval);
+      ySpinBox->setValue(_yval);
+    }else{
+      QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
+      if(code!=QDialog::Accepted) return;
+    }
 
     int dx = xSpinBox->value();
     int dy = ySpinBox->value();
@@ -86,3 +91,15 @@ void TranslateOp::operator()(const Image* img, const map<const Image*, string>&
     this->outImage(resImg, name.toStdString());
     return;
 }
+
+void TranslateOp::setTest(bool a){
+  _test=a;
+}
+
+void TranslateOp::setXVal(int a){
+  _xval=a;
+}
+
+void TranslateOp::setYVal(int a){
+  _yval=a;
+}
diff --git a/app/Operations/TranslateOp.h b/app/Operations/TranslateOp.h
index ccacdb5..9a27fb4 100644
--- a/app/Operations/TranslateOp.h
+++ b/app/Operations/TranslateOp.h
@@ -1,18 +1,18 @@
 /*
  * Copyright 2011-2012 INSA Rennes
- * 
+ *
  * This file is part of ImageINSA.
- * 
+ *
  * ImageINSA is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * ImageINSA is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with ImageINSA.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -37,15 +37,24 @@ class QWidget;
 class TranslateOp : public Operation {
 
   public:
-    
+
     TranslateOp();
 
     void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
 
     bool needCurrentImg() const;
 
+    void setTest(bool);
+
+    void setXVal(int);
+
+    void setYVal(int);
+
 
   private:
+    bool _test;
+    int _xval;
+    int _yval;
 
 };
 
diff --git a/test/README.txt b/test/README.txt
index 9a6113b..ba64806 100644
--- a/test/README.txt
+++ b/test/README.txt
@@ -5,3 +5,8 @@ In order to launch the test class you need to follow these steps:
 	-make
 
 You will probably have to edit the .pro file before the qmake in order to specify the path to the qwt library in the include path (e.g /mydirectory/qwt6.0.1/src), and to specify the .a used by the test class to run the tests by adding the line "LIBS += -L../build/ImageINSA/lib llibimageinsa" to the .pro file.
+
+The test directory is composed of three sub directories named ref, res and src. Res should be empty at the end of your compilation, because it contains the resulting image after application of the operations. Src contains all the source which the test are applied to. Ref contains the images reference with each operation applied on through another software (here matlab).
+
+Everytime you execute the test you have to run a make distclean, then do the qmake, make and LD_LIBRARY_PATH=/home/bprovot/Documents/eiimage/build/ImageINSA/lib  ./test, in order to empty the src directory and not run test on a previous value of the resulting images.
+
-- 
GitLab