Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 42509024 authored by cfouard's avatar cfouard
Browse files

NEW a working ActionStateMachine !

MODIFIED we can now edit any parameter of volume rendering

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@549 ec899d31-69d1-42ba-9299-647d76f65fb3
parent d71775f8
if(ACTION_VOLUMERENDERING)
# specific section in order to use the XML module of Qt
set (QT_USE_QTWEBKIT ON)
set (QT_USE_QTXML ON)
set (QT_USE_QTXMLPATTERNS ON)
find_package(Qt4 REQUIRED)
if(QT_USE_FILE)
include(${QT_USE_FILE})
else(QT_USE_FILE)
set(QT_LIBRARIES ${QT_QT_LIBRARY})
endif(QT_USE_FILE)
# warning: redefines CAMITK_LIBRARIES
set(CAMITK_LIBRARIES ${CAMITK_LIBRARIES} ${QT_LIBRARIES})
endif()
camitk_extension(
ACTION_EXTENSION
DEFAULT
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK 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 Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// - Qt stuff
#include <QColor>
#include <QColorDialog>
// - Local stuff
#include "ColorPointWidget.h"
#include "VolumeRenderingWidget.h"
ColorPointWidget::ColorPointWidget(QWidget * dad) : QWidget(dad)
{
ui.setupUi(this);
this->dad = dad;
this->currentColor = QColor(255, 255, 255, 255);
QString s = "background-color: ";
ui.colorPushButton->setStyleSheet(s + currentColor.name());
}
ColorPointWidget::ColorPointWidget(QWidget * dad, int grayLevel, QColor color) : QWidget(dad)
{
ui.setupUi(this);
this->dad = dad;
this->currentColor = QColor(255, 255, 255, 255);
ui.GrayLevelSpinBox->setValue(grayLevel);
if (color.isValid())
currentColor = color;
QString s = "background-color: ";
ui.colorPushButton->setStyleSheet(s + currentColor.name());
}
void ColorPointWidget::remove() {
VolumeRenderingWidget * dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
if (dadVR)
dadVR->removeColorPoint(this);
}
void ColorPointWidget::colorButtonClicked() {
QColor color = QColorDialog::getColor(currentColor, this, "Please choose a color", QColorDialog::ShowAlphaChannel);
if (color.isValid()) {
currentColor = color;
QString s = "background-color: ";
ui.colorPushButton->setStyleSheet(s + currentColor.name());
}
}
int ColorPointWidget::getGrayLevel() {
return ui.GrayLevelSpinBox->value();
}
QColor ColorPointWidget::getColor() {
return currentColor;
}
void ColorPointWidget::grayLevelChanged(int gray) {
bool oldState = ui.grayLevelSlider->blockSignals(true);
ui.grayLevelSlider->setValue(gray);
ui.grayLevelSlider->blockSignals(oldState);
}
\ No newline at end of file
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK 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 Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef COLORPOINTWIDGET_H
#define COLORPOINTWIDGET_H
// Qt
#include <QMainWindow>
#include <QString>
// Include GUI automatically generated from the file
// ColorPointWidget.ui (to be modified via QtDesigner).
#include "ui_ColorPointWidget.h"
class ColorPointWidget : public QWidget {
Q_OBJECT
public:
ColorPointWidget(QWidget * dad);
ColorPointWidget(QWidget * dad, int grayLevel, QColor color);
int getGrayLevel();
QColor getColor();
public slots:
virtual void remove();
virtual void grayLevelChanged(int);
virtual void colorButtonClicked();
private:
Ui_ColorPointWidget ui;
QWidget * dad;
QColor currentColor;
};
#endif // COLORPOINTWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ColorPointWidget</class>
<widget class="QWidget" name="ColorPointWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>42</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="GrayLevelLabel">
<property name="text">
<string>Gray Level</string>
</property>
<property name="buddy">
<cstring>GrayLevelSpinBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="GrayLevelSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="grayLevelSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="hSpacer01">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="CorrespondingColorLabel">
<property name="text">
<string>Color</string>
</property>
<property name="buddy">
<cstring>colorPushButton</cstring>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="colorPushButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="Line" name="VLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<spacer name="hSpacer02">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="removePushButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="volumerendering.qrc">
<normaloff>:/resources/dialogClose.png</normaloff>:/resources/dialogClose.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>GrayLevelSpinBox</tabstop>
<tabstop>colorPushButton</tabstop>
<tabstop>removePushButton</tabstop>
</tabstops>
<resources>
<include location="volumerendering.qrc"/>
</resources>
<connections>
<connection>
<sender>GrayLevelSpinBox</sender>
<signal>valueChanged(int)</signal>
<receiver>ColorPointWidget</receiver>
<slot>grayLevelChanged(int)</slot>
<hints>
<hint type="sourcelabel">
<x>86</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>109</x>
<y>26</y>
</hint>
</hints>
</connection>
<connection>
<sender>colorPushButton</sender>
<signal>clicked()</signal>
<receiver>ColorPointWidget</receiver>
<slot>colorButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>287</x>
<y>27</y>
</hint>
<hint type="destinationlabel">
<x>291</x>
<y>0</y>
</hint>
</hints>
</connection>
<connection>
<sender>removePushButton</sender>
<signal>clicked()</signal>
<receiver>ColorPointWidget</receiver>
<slot>remove()</slot>
<hints>
<hint type="sourcelabel">
<x>390</x>
<y>28</y>
</hint>
<hint type="destinationlabel">
<x>327</x>
<y>34</y>
</hint>
</hints>
</connection>
<connection>
<sender>grayLevelSlider</sender>
<signal>valueChanged(int)</signal>
<receiver>GrayLevelSpinBox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>134</x>
<y>12</y>
</hint>
<hint type="destinationlabel">
<x>104</x>
<y>11</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>remove()</slot>
<slot>grayLevelChanged(int)</slot>
<slot>colorButtonClicked()</slot>
</slots>
</ui>
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK 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 Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// - Qt stuff
#include <QColor>
#include <QColorDialog>
// - Local stuff
#include "ColorPointWidget.h"
#include "VolumeRenderingWidget.h"
GradientOpacityWidget::GradientOpacityWidget(QWidget * dad) : QWidget(dad)
{
ui.setupUi(this);
this->dad = dad;
}
GradientOpacityWidget::GradientOpacityWidget(QWidget * dad, int grayLevel, double opacity) : QWidget(dad)
{
ui.setupUi(this);
this->dad = dad;
ui.grayLevelSpinBox->setValue(grayLevel);
ui.opacitySpinBox->setValue(opacity);
}
void GradientOpacityWidget::remove() {
VolumeRenderingWidget * dadVR = dynamic_cast<VolumeRenderingWidget*> (this->dad);
if (dadVR)
dadVR->removeOpacityPoint(this);
}
int GradientOpacityWidget::getGrayLevel() {
return ui.grayLevelSpinBox->value();
}
double GradientOpacityWidget::getOpacity() {
return ui.opacitySpinBox->value();
}
void GradientOpacityWidget::grayLevelChanged(int gray) {
bool oldState = ui.grayLevelSlider->blockSignals(true);
ui.grayLevelSlider->setValue(gray);
ui.grayLevelSlider->blockSignals(oldState);
}
void GradientOpacityWidget::opacityChanged(double value) {
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK 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 Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef GRADIENTOPACITYWIDGET_H
#define GRADIENTOPACITYWIDGET_H
// Qt
#include <QMainWindow>
#include <QString>
// Include GUI automatically generated from the file
// ColorPointWidget.ui (to be modified via QtDesigner).
#include "ui_GradientOpacityWidget.h"
class GradientOpacityWidget : public QWidget {
Q_OBJECT
public:
GradientOpacityWidget(QWidget * dad);
GradientOpacityWidget(QWidget * dad, int grayLevel, double opacity);
int getGrayLevel();
double getOpacity();
public slots:
virtual void remove();
virtual void grayLevelChanged(int);
virtual void opacityChanged(double);
private:
Ui_GradientOpacityWidget ui;
QWidget * dad;
};
#endif // GRADIENTOPACITYWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GradientOpacityWidget</class>
<widget class="QWidget" name="GradientOpacityWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>42</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="grayLevelLabel">
<property name="text">
<string>Gray Level</string>
</property>
<property name="buddy">
<cstring>grayLevelSpinBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="grayLevelSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="grayLevelSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="hSpacer02">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="opacityLabel">
<property name="text">
<string>Opacity</string>
</property>
<property name="buddy">
<cstring>opacitySpinBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="opacitySpinBox"/>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<spacer name="hSpacer01">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="removePushButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="volumerendering.qrc">
<normaloff>:/resources/dialogClose.png</normaloff>:/resources/dialogClose.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>grayLevelSpinBox</tabstop>
<tabstop>opacitySpinBox</tabstop>
<tabstop>removePushButton</tabstop>
</tabstops>
<resources>
<include location="volumerendering.qrc"/>
</resources>
<connections>