|
@@ -243,8 +243,8 @@ Experiment::start ()
|
|
|
|
|
|
for(int i = 0 ; i<experimentation->size()*4 ; i++)
|
|
|
{
|
|
|
- int rand1 = std::rand()%filenames->size();
|
|
|
- int rand2 = std::rand()%filenames->size();
|
|
|
+ int rand1 = std::rand()%experimentation->size();
|
|
|
+ int rand2 = std::rand()%experimentation->size();
|
|
|
experimentation->swapItemsAt(rand1, rand2);
|
|
|
}
|
|
|
|
|
@@ -282,20 +282,20 @@ void Experiment::leftImage(){
|
|
|
choice->append(QString("random"));*/
|
|
|
|
|
|
|
|
|
- if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->length()-6) == 'o')
|
|
|
+ if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->at(1).length()-6) == 'o')
|
|
|
{
|
|
|
choice->append(QString("algo"));
|
|
|
- std::cout << "Choix algo" << std::endl;
|
|
|
+ // std::cout << "Choix algo" << std::endl;
|
|
|
}
|
|
|
- if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->length()-6) == 'm')
|
|
|
+ if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->at(1).length()-6) == 'm')
|
|
|
{
|
|
|
choice->append(QString("random"));
|
|
|
- std::cout << "Choix random" << std::endl;
|
|
|
+ // std::cout << "Choix random" << std::endl;
|
|
|
}
|
|
|
- if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->length()-6) == 't')
|
|
|
+ if(experimentation->at(openedImage)->at(1).at(experimentation->at(openedImage)->at(1).length()-6) == 't')
|
|
|
{
|
|
|
choice->append(QString("expert"));
|
|
|
- std::cout << "Choix expert" << std::endl;
|
|
|
+ // std::cout << "Choix expert" << std::endl;
|
|
|
}
|
|
|
|
|
|
openNext();
|
|
@@ -315,22 +315,22 @@ void Experiment::rightImage(){
|
|
|
else
|
|
|
choice->append(QString("random"));*/
|
|
|
|
|
|
- std::cout << experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->length()-6).toLatin1() << std::endl;
|
|
|
+ // std::cout << experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->at(2).length()-6).toLatin1() << std::endl;
|
|
|
|
|
|
- if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->length()-6) == 'o')
|
|
|
+ if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->at(2).length()-6).toLatin1() == 'o')
|
|
|
{
|
|
|
choice->append(QString("algo"));
|
|
|
- std::cout << "Choix algo" << std::endl;
|
|
|
+ // std::cout << "Choix algo" << std::endl;
|
|
|
}
|
|
|
- if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->length()-6) == 'm')
|
|
|
+ if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->at(2).length()-6).toLatin1() == 'm')
|
|
|
{
|
|
|
choice->append(QString("random"));
|
|
|
- std::cout << "Choix random" << std::endl;
|
|
|
+ // std::cout << "Choix random" << std::endl;
|
|
|
}
|
|
|
- if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->length()-6) == 't')
|
|
|
+ if(experimentation->at(openedImage)->at(2).at(experimentation->at(openedImage)->at(2).length()-6).toLatin1() == 't')
|
|
|
{
|
|
|
choice->append(QString("expert"));
|
|
|
- std::cout << "Choix expert" << std::endl;
|
|
|
+ // std::cout << "Choix expert" << std::endl;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -342,15 +342,15 @@ void Experiment::rightImage(){
|
|
|
void
|
|
|
Experiment::openNext (){
|
|
|
openedImage = openedImage+1;
|
|
|
-
|
|
|
- std::cout << experimentation->at(openedImage)->at(0).toStdString() << " - " << experimentation->at(openedImage)->at(1).toStdString() << " - " << experimentation->at(openedImage)->at(2).toStdString() << std::endl;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if(openedImage == 1)
|
|
|
undoAct->setEnabled(true);
|
|
|
|
|
|
- progressBar->setValue((int)((openedImage+1.0)/(filenames->size())*100.0));
|
|
|
+ progressBar->setValue((int)((openedImage+1.0)/(experimentation->size())*100.0));
|
|
|
|
|
|
- if(openedImage >= filenames->size())
|
|
|
+ if(openedImage >= experimentation->size())
|
|
|
{
|
|
|
qDebug() << "That's all folks !" << Qt::endl;
|
|
|
|
|
@@ -361,7 +361,10 @@ Experiment::openNext (){
|
|
|
for (int i = 0; i < choice->size (); i++){
|
|
|
QJsonObject choiceOnImage;
|
|
|
choiceOnImage["index"] = i;
|
|
|
- choiceOnImage["image"] = QString(QFileInfo(filenames->at(i)).baseName());
|
|
|
+ choiceOnImage["image"] = QString(QFileInfo(experimentation->at(i)->at(0)).baseName());
|
|
|
+ QString possibleChoices1(QFileInfo(experimentation->at(i)->at(1)).baseName().split("_").at(1));
|
|
|
+ QString possibleChoices2(QFileInfo(experimentation->at(i)->at(2)).baseName().split("_").at(1));
|
|
|
+ choiceOnImage["choices"] = possibleChoices1.append(", ").append(possibleChoices2);
|
|
|
choiceOnImage["choice"] = QString(choice->at(i));
|
|
|
choices.push_back(choiceOnImage);
|
|
|
}
|
|
@@ -382,6 +385,8 @@ Experiment::openNext (){
|
|
|
else
|
|
|
{
|
|
|
|
|
|
+ // std::cout << experimentation->at(openedImage)->at(0).toStdString() << " - " << experimentation->at(openedImage)->at(1).toStdString() << " - " << experimentation->at(openedImage)->at(2).toStdString() << std::endl;
|
|
|
+
|
|
|
// waLeft->loadImage (filenames->at(openedImage).toStdString ());
|
|
|
// waRight->loadImage (filenames->at(openedImage).toStdString ());
|
|
|
|
|
@@ -389,25 +394,33 @@ Experiment::openNext (){
|
|
|
waRight->loadImage (experimentation->at(openedImage)->at(0).toStdString ());
|
|
|
|
|
|
|
|
|
- // left display
|
|
|
if(QFile(experimentation->at(openedImage)->at(1)).exists()==false)
|
|
|
{
|
|
|
- for(int i = 0 ; i < waLeft->getNumberOfLines() ; i++)
|
|
|
+ waRight->loadSL(experimentation->at(openedImage)->at(2).toStdString());
|
|
|
+ for(int i = 0 ; i < waRight->getNumberOfLines() ; i++)
|
|
|
waLeft->addRandomSL();
|
|
|
waLeft->saveStrengthLine (experimentation->at(openedImage)->at(1).toStdString ());
|
|
|
}
|
|
|
else
|
|
|
- waLeft->loadSL(experimentation->at(openedImage)->at(1).toStdString());
|
|
|
-
|
|
|
- // right display
|
|
|
- if(QFile(experimentation->at(openedImage)->at(2)).exists()==false)
|
|
|
{
|
|
|
- for(int i = 0 ; i < waRight->getNumberOfLines() ; i++)
|
|
|
- waRight->addRandomSL();
|
|
|
- waRight->saveStrengthLine (experimentation->at(openedImage)->at(2).toStdString ());
|
|
|
+ if(QFile(experimentation->at(openedImage)->at(2)).exists()==false)
|
|
|
+ {
|
|
|
+ waLeft->loadSL(experimentation->at(openedImage)->at(1).toStdString());
|
|
|
+ for(int i = 0 ; i < waLeft->getNumberOfLines() ; i++)
|
|
|
+ waRight->addRandomSL();
|
|
|
+ waRight->saveStrengthLine (experimentation->at(openedImage)->at(2).toStdString ());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ waLeft->loadSL(experimentation->at(openedImage)->at(1).toStdString());
|
|
|
+ waRight->loadSL(experimentation->at(openedImage)->at(2).toStdString());
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
- waRight->loadSL(experimentation->at(openedImage)->at(2).toStdString());
|
|
|
+
|
|
|
+ // right display
|
|
|
+
|
|
|
+ // else
|
|
|
+ // waRight->loadSL(experimentation->at(openedImage)->at(2).toStdString());
|
|
|
|
|
|
/*if(side->size() == openedImage)
|
|
|
{
|