Skip to content
Snippets Groups Projects
Commit 43f0de4c authored by Provot Bertrand's avatar Provot Bertrand
Browse files

starting to build new op for the Uchar/Double conversion, update on the...

starting to build new op for the Uchar/Double conversion, update on the cmakelists and cleaning some comments on OpService
parent ccc347e5
No related branches found
No related tags found
No related merge requests found
......@@ -124,14 +124,12 @@ set(imageinsa_SOURCES
Operations/SignalToNoiseOp.cpp
Operations/SignalToNoiseOp.h
Operations/SinusSynthesisOp.cpp
Operations/SinusSynthesisOp.cpp
Operations/SinusSynthesisOp.h
Operations/SplitColorOp.cpp
Operations/SplitColorOp.h
Operations/SplitHsvOp.cpp
Operations/SplitHsvOp.h
Operations/ThresholdDialog.cpp
Operations/ThresholdDialog.cpp
Operations/ThresholdDialog.h
Operations/ThresholdOp.cpp
Operations/ThresholdOp.cpp
......@@ -140,6 +138,10 @@ set(imageinsa_SOURCES
Operations/Transforms.h
Operations/TranslateOp.cpp
Operations/TranslateOp.h
Operations/UCharConvertOp.cpp
Operations/UCharConvertOp.h
Operations/ucharconvertdialog.cpp
Operations/ucharconvertdialog.h
Operations/ZeroCrossingOp.cpp
Operations/ZeroCrossingOp.h
Services/ImageINSAService.cpp
......@@ -185,6 +187,7 @@ set(UIS
Operations/DCTDialog.ui
Operations/ColorDialog.ui
Operations/MedianDialog.ui
Operations/ucharconvertdialog.ui
)
qt5_wrap_ui(WRAPPED_UIS ${UIS})
......
/*
* 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/>.
*/
#include "UCharConvertOp.h"
#include "../Tools.h"
#include <QApplication>
#include <QObject>
#include "Operation.h"
#include "ucharconvertdialog.h"
UCharConvertOp::UCharConvertOp() : DoubleOperation(qApp->translate("Operations", "UChar converter").toStdString())
{
}
bool UCharConvertOp::needCurrentImg() const{
return true;
}
void UCharConvertOp::operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&){
UCharConvertDialog* dialog = new UCharConvertDialog(QApplication::activeWindow());
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
if(code!=QDialog::Accepted) return;
}
#ifndef UCHARCONVERTOP_H
#define UCHARCONVERTOP_H
#include <QObject>
#include "Operation.h"
#include "ucharconvertdialog.h"
class UCharConvertOp : public DoubleOperation
{
public:
UCharConvertOp();
bool needCurrentImg() const;
void operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&);
};
#endif // UCHARCONVERTOP_H
#include "ucharconvertdialog.h"
#include "ui_ucharconvertdialog.h"
UCharConvertDialog::UCharConvertDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::UCharConvertDialog)
{
ui->setupUi(this);
}
UCharConvertDialog::~UCharConvertDialog()
{
delete ui;
}
#ifndef UCHARCONVERTDIALOG_H
#define UCHARCONVERTDIALOG_H
#include <QDialog>
namespace Ui {
class UCharConvertDialog;
}
class UCharConvertDialog : public QDialog
{
Q_OBJECT
public:
explicit UCharConvertDialog(QWidget *parent = 0);
~UCharConvertDialog();
private:
Ui::UCharConvertDialog *ui;
};
#endif // UCHARCONVERTDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UCharConvertDialog</class>
<widget class="QDialog" name="UCharConvertDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>40</x>
<y>260</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>311</width>
<height>81</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_2">
<property name="geometry">
<rect>
<x>30</x>
<y>150</y>
<width>160</width>
<height>80</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox"/>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>UCharConvertDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>UCharConvertDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -55,21 +55,8 @@ void OperationService::connect(GenericInterface* gi)
void OperationService::operation() {
// cout << _operation->getName() << endl;
WindowService* ws = _gi->windowService();
ImageWindow* curImgWnd = ws->getCurrentImageWindow();
// StandardImageWindow* curStdImgWnd = NULL;
// if (curImgWnd != NULL)
// {
// curStdImgWnd = dynamic_cast<StandardImageWindow*>(curImgWnd);
// }
// const Image* image = NULL;
// if(curStdImgWnd != NULL) {
// image = curStdImgWnd->getImage();
// }
if(_operation->needCurrentImg() && !_operation->isValidImgWnd(curImgWnd)) return;
map<const ImageWindow*, string> wndList;
......@@ -80,36 +67,6 @@ void OperationService::operation() {
_operation->operator()(dynamic_cast<ImageINSAService*>(ws));
// for(vector<QWidget*>::iterator it = result.begin(); it < result.end(); ++it) {
// QWidget* widget = *it;
// QLabel* twdgt = dynamic_cast<QLabel*>(widget);
// if((typeid(*widget) == typeid(ImgWidget)) || (typeid(*widget) == typeid(DoubleImgWidget))) {
// QString title = _operation->needCurrentImg() ? (curImgWnd->windowTitle() + " - ") : "";
// ImageWindow* siw;
// if(typeid(*widget)==typeid(ImgWidget)) {
// ImgWidget* w = dynamic_cast<ImgWidget*>(widget);
// title += w->name.c_str();
// siw = new StandardImageWindow(_operation->needCurrentImg() ? curImgWnd->getPath() : w->name.c_str(), w->img);
// }
// else {
// DoubleImgWidget* w = dynamic_cast<DoubleImgWidget*>(widget);
// title += w->name.c_str();
// siw = new DoubleImageWindow(_operation->needCurrentImg() ? curImgWnd->getPath() : w->name.c_str(), w->img, w->normalize, w->logScale);
// }
// NodeId id = _operation->needCurrentImg() ? ws->getNodeId(curImgWnd) : NodeId(siw->getDisplayImage());
// ws->addImage(id, siw);
// siw->setWindowTitle(title);
// }
// else if(twdgt != NULL) {
// emit outputText(twdgt->text());
// }
// else {
// ws->addWidget(ws->getNodeId(curImgWnd), widget);
// }
// }
}
void OperationService::setEnabled(bool enabled) {
......
......@@ -71,6 +71,7 @@
#include "Operations/ClassResultOp.h"
#include "Operations/SeparatorOp.h"
#include "Operations/MedianOp.h"
#include "Operations/UCharConvertOp.h"
#include "Services/MorphoMatService.h"
......@@ -142,6 +143,8 @@ int main(int argc, char** argv)
image->addOperation(new QuantificationOp());
image->addOperation(new ThresholdOp());
image->addOperation(new HistogramOp());
image->addOperation(new SeparatorOp());
image->addOperation(new UCharConvertOp());
BuiltinOpSet* tools = new BuiltinOpSet(qApp->translate("", "&Tools").toStdString());
......
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