Skip to content
Snippets Groups Projects
Commit abfbe8ea authored by Sacha Percot-Tétu's avatar Sacha Percot-Tétu
Browse files

Improved the operation's output

parent 7d3a20a1
No related branches found
No related tags found
No related merge requests found
......@@ -27,30 +27,40 @@
#include "Image.h"
class QWidget;
class EIImageService;
namespace genericinterface {
class ImageWindow;
}
class GenericOperation {
public:
GenericOperation(std::string name) : _name(name) {}
GenericOperation(std::string name) : _name(name), _ws(NULL) {}
inline std::string getName() { return _name; }
virtual std::vector<QWidget*> operator()(const genericinterface::ImageWindow* currentWnd, std::map<const genericinterface::ImageWindow*, std::string>&) = 0;
virtual void operator()(const genericinterface::ImageWindow* currentWnd, std::vector<genericinterface::ImageWindow*>&) = 0;
virtual void operator()(EIImageService*);
virtual bool needCurrentImg() const = 0;
virtual bool isValidImgWnd(const genericinterface::ImageWindow* imgWnd) const = 0;
protected:
void outImage(imagein::Image*, std::string title = "");
void outDoubleImage(imagein::Image_t<double>*, std::string title = "", bool norm=false, bool log=false);
void outText(std::string);
std::string _name;
EIImageService* _ws;
private:
void outImgWnd(genericinterface::ImageWindow* imgWnd, std::string title);
};
class Operation : public GenericOperation {
public:
Operation(std::string name) : GenericOperation(name) {}
virtual std::vector<QWidget*> operator()(const genericinterface::ImageWindow* currentWnd, std::map<const genericinterface::ImageWindow*, std::string>&);
virtual std::vector<QWidget*> operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&) = 0;
virtual void operator()(const genericinterface::ImageWindow* currentWnd, std::vector<genericinterface::ImageWindow*>&);
virtual void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&) = 0;
virtual bool isValidImgWnd(const genericinterface::ImageWindow* imgWnd) const;
protected:
imagein::Image* _currentImg;
......@@ -59,8 +69,8 @@ class Operation : public GenericOperation {
class DoubleOperation : public GenericOperation {
public:
DoubleOperation(std::string name) : GenericOperation(name) {}
virtual std::vector<QWidget*> operator()(const genericinterface::ImageWindow* currentWnd, std::map<const genericinterface::ImageWindow*, std::string>&);
virtual std::vector<QWidget*> operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&) = 0;
virtual void operator()(const genericinterface::ImageWindow* currentWnd, std::vector<genericinterface::ImageWindow*>&);
virtual void operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&) = 0;
virtual bool isValidImgWnd(const genericinterface::ImageWindow* imgWnd) const;
protected:
imagein::Image_t<double>* _currentImg;
......
......@@ -44,11 +44,10 @@ void PlugOperation::addOutput(const Output& output) {
}
std::vector<QWidget*> PlugOperation::operator()(const Image* currentImg, const std::map<const Image*, std::string>&) {
vector<QWidget*> result;
void PlugOperation::operator()(const Image* currentImg, const std::map<const Image*, std::string>&) {
if(this->needCurrentImg()) {
if(currentImg==NULL) return result;
if(currentImg==NULL) return;
*_currentImg = *currentImg;
}
......@@ -72,7 +71,7 @@ std::vector<QWidget*> PlugOperation::operator()(const Image* currentImg, const s
cout << code << endl;
if(code!=QDialog::Accepted) {
return result;
return;
}
for(vector<Input*>::iterator it = _inputs.begin(); it < _inputs.end(); ++it) {
......@@ -85,7 +84,6 @@ std::vector<QWidget*> PlugOperation::operator()(const Image* currentImg, const s
this->operation();
for(vector<Output*>::iterator it = _outputs.begin(); it < _outputs.end(); ++it) {
result.push_back((*it)->getWidget());
// result.push_back((*it)->getWidget());
}
return result;
}
......@@ -44,7 +44,7 @@ class PlugOperation : public Operation {
public:
PlugOperation(std::string name);
std::vector<QWidget*> operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
inline bool needCurrentImg() { return _needCurrentImg; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment