Commit f17e58f3 authored by SCHMITT Louise-Amelie's avatar SCHMITT Louise-Amelie

fixed database import upon process success

parent 09bb95c8
......@@ -33,7 +33,6 @@
#include <medRegistrationWorkspace.h>
#include <medSeedPointAnnotationData.h>
#include <medSegmentationWorkspace.h>
#include <optimDBSWorkspace.h>
#include <medSettingsManager.h>
#include <medSettingsWidget.h>
#include <medSettingsWidgetFactory.h>
......@@ -186,7 +185,6 @@ void medApplication::initialize()
//viewerWSpaceFactory->registerWorkspace<medDiffusionWorkspace>();
viewerWSpaceFactory->registerWorkspace<medFilteringWorkspace>();
viewerWSpaceFactory->registerWorkspace<medSegmentationWorkspace>();
viewerWSpaceFactory->registerWorkspace<optimDBSWorkspace>();
//Register settingsWidgets
medSettingsWidgetFactory* settingsWidgetFactory = medSettingsWidgetFactory::instance();
......
......@@ -5,6 +5,7 @@
#include <odbsMarkProcess.h>
#include "odbsToolBox.h"
#include "odbsPredictionToolBox.h"
#include <odbsWorkspace.h>
//#include "mscMarkerProcess.h"
namespace odbs
......@@ -33,6 +34,10 @@ bool ODBSPlugin::initialize()
{
dtkWarn() << "Unable to register prediction toolbox.";
}
if(!ODBSWorkspace::registered())
{
dtkWarn() << "Unable to register mscSimulationWorkspace type";
}
return true;
}
......
......@@ -309,7 +309,7 @@ void ODBSPredictionToolBoxPrivate::slider_moved(int position)
/** ------------------------ ODBSPredictionToolBox ----------------------- **/
ODBSPredictionToolBox::ODBSPredictionToolBox(QWidget *parent)
: medToolBox(parent),
: medAbstractSelectableToolBox(parent),
d(new ODBSPredictionToolBoxPrivate)
{
initialize();
......@@ -347,10 +347,11 @@ dtkPlugin* ODBSPredictionToolBox::plugin()
medAbstractData* ODBSPredictionToolBox::processOutput()
{
// if(!d->process)
// {
// return nullptr;
// }
if(!d->process)
{
return nullptr;
}
return d->process->output();
}
......@@ -591,6 +592,7 @@ void ODBSPredictionToolBox::rotateImage()
void ODBSPredictionToolBox::importImageOnProcessSuccess()
{
d->output = processOutput();
medDataManager::instance()->importData(d->output);
importImage();
}
......@@ -693,6 +695,7 @@ void ODBSPredictionToolBox::markImage(std::array<std::array<double, 3>, 2> predi
void ODBSPredictionToolBox::importMarkedImageOnProcessSuccess()
{
d->output = processOutput();
medDataManager::instance()->importData(d->output);
importMarkedImage();
}
......@@ -1091,7 +1094,17 @@ void ODBSPredictionToolBox::initialize()
d->rightResults = new ODBSResultsBox("Right");
swLayout->addWidget(d->rightResults);
QHBoxLayout* exportLayout = new QHBoxLayout();
QLabel* exportText = new QLabel(tr("Get marked image:"), this);
QPushButton* exportButton = new QPushButton(tr("Export"));
exportButton->setEnabled(false);
// connect(d->exportButton, SIGNAL(clicked()), this, SLOT(launchPrediction()));
// connect(d->modelsManager, SIGNAL(modelLoaded(bool)), d->exportButton, SLOT(setEnabled(bool)))
exportLayout->addWidget(exportText);
exportLayout->addWidget(exportButton);
swLayout->addLayout(exportLayout);
d->markedImageWidget->setLayout(swLayout);
// Should only appear once the image is marked and ready to download
......
......@@ -18,7 +18,7 @@ class ODBSPredictionToolBoxPrivate;
* free tetgen software. It must be installed on the user's
* computer.
*/
class ODBSPLUGIN_EXPORT ODBSPredictionToolBox : public medToolBox
class ODBSPLUGIN_EXPORT ODBSPredictionToolBox : public medAbstractSelectableToolBox
{
Q_OBJECT
MED_TOOLBOX_INTERFACE("ODBS Prediction Toolbox ",
......
......@@ -11,7 +11,7 @@
=========================================================================*/
#include <optimDBSWorkspace.h>
#include <odbsWorkspace.h>
#include <medSelectorToolBox.h>
#include <medTabbedViewContainers.h>
......@@ -20,19 +20,27 @@
#include <medToolBoxFactory.h>
#include <medToolBoxHeader.h>
#include <medToolBoxBody.h>
#include <medDataManager.h>
#include <medAbstractSelectableToolBox.h>
#include <medWorkspaceFactory.h>
#include <iostream>
class optimDBSWorkspacePrivate
#include <odbsPredictionToolBox.h>
namespace odbs
{
class ODBSWorkspacePrivate
{
public:
medViewContainer* containers[2]; // MRIcoords, ACPCcoords
medToolBox * odbsToolBox;
ODBSPredictionToolBox * odbsToolBox;
};
optimDBSWorkspace::optimDBSWorkspace(QWidget * parent) :
medAbstractWorkspace(parent), d(new optimDBSWorkspacePrivate)
ODBSWorkspace::ODBSWorkspace(QWidget * parent) :
medAbstractWorkspace(parent), d(new ODBSWorkspacePrivate)
{
setUserViewPoolable(false); // blocks the grouping menu from the view settings
......@@ -53,7 +61,7 @@ medAbstractWorkspace(parent), d(new optimDBSWorkspacePrivate)
foreach(QString toolbox, tbFactory->toolBoxesFromCategory(TB_CATEGORY))
{
medToolBoxDetails* details = tbFactory->toolBoxDetailsFromId(toolbox);
medToolBox * tb = qobject_cast<medToolBox*>(medToolBoxFactory::instance()->createToolBox(toolbox));
ODBSPredictionToolBox * tb = qobject_cast<ODBSPredictionToolBox*>(medToolBoxFactory::instance()->createToolBox(toolbox));
if(!tb)
qWarning() << "Unable to instantiate" << details->name << "toolbox";
else
......@@ -65,13 +73,18 @@ medAbstractWorkspace(parent), d(new optimDBSWorkspacePrivate)
}
}
bool optimDBSWorkspace::isUsable()
bool ODBSWorkspace::isUsable()
{
medToolBoxFactory * tbFactory = medToolBoxFactory::instance();
return (tbFactory->toolBoxesFromCategory(TB_CATEGORY).size()!=0);
}
void optimDBSWorkspace::setupViewContainerStack()
bool ODBSWorkspace::registered()
{
return medWorkspaceFactory::instance()->registerWorkspace <ODBSWorkspace>();
}
void ODBSWorkspace::setupViewContainerStack()
{
medAbstractWorkspace::setupViewContainerStack();
......@@ -105,3 +118,17 @@ void optimDBSWorkspace::setupViewContainerStack()
// Select the tab
this->stackedViewContainers()->setCurrentIndex(MRIcoords);
}
void ODBSWorkspace::importProcessOutput()
{
// std::this_thread::sleep_for (std::chrono::seconds(1));
// qDebug()<<"COUCOU";
// medAbstractData* output2 = nullptr;
// output2 = d->odbsToolBox->processOutput();
// if (!output2->data()) qDebug()<<"J'EXISTE PAS";
// qDebug()<<"TRETRETYE"<<output2->data();
// qDebug()<<"TRETRETYE"<<output2->identifier();
// medDataManager::instance()->importData(output2);
}
} //namespace
......@@ -15,14 +15,17 @@
#include <medSelectorWorkspace.h>
class optimDBSWorkspacePrivate;
namespace odbs
{
class ODBSWorkspacePrivate;
const QString TB_CATEGORY{"OptimDBS"};
/**
* class optimDBSWorkspace
* class ODBSWorkspace
* Defines the workspace.
*/
class optimDBSWorkspace : public medAbstractWorkspace
class ODBSWorkspace : public medAbstractWorkspace
{
Q_OBJECT
MED_WORKSPACE_INTERFACE("OptimDBS",
......@@ -38,14 +41,17 @@ class optimDBSWorkspace : public medAbstractWorkspace
public:
optimDBSWorkspace(QWidget * parent);
ODBSWorkspace(QWidget * parent);
static bool isUsable();
static bool registered();
void setupViewContainerStack ();
protected slots:
void importProcessOutput();
private:
optimDBSWorkspacePrivate *d;
ODBSWorkspacePrivate *d;
};
} //namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment