diff --git a/Modules/DicomRT/src/mitkDoseNodeHelper.cpp b/Modules/DicomRT/src/mitkDoseNodeHelper.cpp index 366a733f53..d9d98baf7f 100644 --- a/Modules/DicomRT/src/mitkDoseNodeHelper.cpp +++ b/Modules/DicomRT/src/mitkDoseNodeHelper.cpp @@ -1,82 +1,78 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkDoseNodeHelper.h" #include #include #include #include #include #include #include #include #include #include #include void mitk::ConfigureNodeAsDoseNode(mitk::DataNode* node, mitk::DoseValueAbs referenceDose) { if (node) { //set some specific colorwash and isoline properties node->SetBoolProperty(mitk::RTConstants::DOSE_SHOW_COLORWASH_PROPERTY_NAME.c_str(), true); node->SetBoolProperty(mitk::RTConstants::DOSE_SHOW_ISOLINES_PROPERTY_NAME.c_str(), false); node->SetFloatProperty(mitk::RTConstants::REFERENCE_DOSE_PROPERTY_NAME.c_str(), referenceDose); mitk::IsoDoseLevelSet::Pointer isoDoseLevelPreset = mitk::GeneratIsoLevels_Virtuos(); mitk::IsoDoseLevelSetProperty::Pointer levelSetProp = mitk::IsoDoseLevelSetProperty::New(isoDoseLevelPreset); node->SetProperty(mitk::RTConstants::DOSE_ISO_LEVELS_PROPERTY_NAME.c_str(), levelSetProp); mitk::IsoDoseLevelVector::Pointer levelVector = mitk::IsoDoseLevelVector::New(); mitk::IsoDoseLevelVectorProperty::Pointer levelVecProp = mitk::IsoDoseLevelVectorProperty::New(levelVector); node->SetProperty(mitk::RTConstants::DOSE_FREE_ISO_VALUES_PROPERTY_NAME.c_str(), levelVecProp); mitk::RenderingModeProperty::Pointer renderingModeProp = mitk::RenderingModeProperty::New(); //Generating the Colorwash vtkSmartPointer transferFunction = vtkSmartPointer::New(); for (mitk::IsoDoseLevelSet::ConstIterator itIsoDoseLevel = isoDoseLevelPreset->Begin(); itIsoDoseLevel != isoDoseLevelPreset->End(); ++itIsoDoseLevel) { - float *hsv = new float[3]; - //used for transfer rgb to hsv - vtkSmartPointer cCalc = vtkSmartPointer::New(); if (itIsoDoseLevel->GetVisibleColorWash()) { - cCalc->RGBToHSV(itIsoDoseLevel->GetColor()[0], itIsoDoseLevel->GetColor()[1], itIsoDoseLevel->GetColor()[2], &hsv[0], &hsv[1], &hsv[2]); - transferFunction->AddHSVPoint(itIsoDoseLevel->GetDoseValue()*referenceDose, hsv[0], hsv[1], hsv[2], 1.0, 1.0); + double rgbValue[] = { itIsoDoseLevel->GetColor()[0], itIsoDoseLevel->GetColor()[1], itIsoDoseLevel->GetColor()[2] }; + transferFunction->AddRGBPoint(itIsoDoseLevel->GetDoseValue()*referenceDose, rgbValue[0], rgbValue[1], rgbValue[2]); } - delete[] hsv; } mitk::TransferFunction::Pointer mitkTransFunc = mitk::TransferFunction::New(); mitk::TransferFunctionProperty::Pointer mitkTransFuncProp = mitk::TransferFunctionProperty::New(); mitkTransFunc->SetColorTransferFunction(transferFunction); mitkTransFuncProp->SetValue(mitkTransFunc); node->SetProperty("Image Rendering.Transfer Function", mitkTransFuncProp); renderingModeProp->SetValue(mitk::RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR); node->SetProperty("Image Rendering.Mode", renderingModeProp); node->SetProperty("opacity", mitk::FloatProperty::New(0.5)); } }; diff --git a/Modules/RTUI/Qmitk/QmitkDoseColorDelegate.h b/Modules/RTUI/Qmitk/QmitkDoseColorDelegate.h index 1cafcc1d48..f42463989a 100644 --- a/Modules/RTUI/Qmitk/QmitkDoseColorDelegate.h +++ b/Modules/RTUI/Qmitk/QmitkDoseColorDelegate.h @@ -1,44 +1,44 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDoseColorDelegate_h #define QmitkDoseColorDelegate_h #include #include "MitkRTUIExports.h" /** \class QmitkDoseColorDelegate \brief An item delegate for rendering and editing dose color in a QTableView.*/ class MITKRTUI_EXPORT QmitkDoseColorDelegate : public QStyledItemDelegate { Q_OBJECT public: /// /// Creates a new PropertyDelegate. /// - QmitkDoseColorDelegate(QObject *parent = 0); + explicit QmitkDoseColorDelegate(QObject *parent = 0); bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; #endif diff --git a/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.h b/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.h index 3e25a7799d..8f7cf66ba5 100644 --- a/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.h +++ b/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.h @@ -1,63 +1,63 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDoseValueDelegate_h #define QmitkDoseValueDelegate_h #include #include "MitkRTUIExports.h" /** \class QmitkDoseValueDelegate \brief An item delegate for rendering and editing dose values. The delegate assumes that the model uses the role Qt::UserRole+1 to indicate if the returned dose value is an absolute (data(Qt::UserRole+1) == true) or an relative dose (data(Qt::UserRole+1) == false).*/ class MITKRTUI_EXPORT QmitkDoseValueDelegate : public QStyledItemDelegate { Q_OBJECT public: /// /// Creates a new PropertyDelegate. /// - QmitkDoseValueDelegate(QObject *parent = 0); + explicit QmitkDoseValueDelegate(QObject *parent = 0); /// /// Renders a specific property (overwritten from QItemDelegate) /// void paint(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// void setEditorData(QWidget *editor, const QModelIndex &index) const; /// /// When the user accepts input this func commits the data to the model (overwritten from QItemDelegate) /// void setModelData(QWidget *editor, QAbstractItemModel* model, const QModelIndex &index) const; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/Modules/RTUI/Qmitk/QmitkDoseVisualStyleDelegate.h b/Modules/RTUI/Qmitk/QmitkDoseVisualStyleDelegate.h index 2cd3a558ca..d00fe17f17 100644 --- a/Modules/RTUI/Qmitk/QmitkDoseVisualStyleDelegate.h +++ b/Modules/RTUI/Qmitk/QmitkDoseVisualStyleDelegate.h @@ -1,47 +1,47 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDoseVisualStyleDelegate_h #define QmitkDoseVisualStyleDelegate_h /// Toolkit includes. #include #include "MitkRTUIExports.h" /** \class QmitkDoseVisualStyleDelegate \brief An item delegate for rendering and editing dose visualization options. The delegate is used to handle aspects of a isodose level like visualization of the isodose lines or colorwash display.*/ class MITKRTUI_EXPORT QmitkDoseVisualStyleDelegate : public QStyledItemDelegate { Q_OBJECT public: - QmitkDoseVisualStyleDelegate(QObject *parent = 0); + explicit QmitkDoseVisualStyleDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const; bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index); }; #endif diff --git a/Modules/RTUI/Qmitk/QmitkFreeIsoDoseLevelWidget.h b/Modules/RTUI/Qmitk/QmitkFreeIsoDoseLevelWidget.h index 8d6c175f66..4e97921ae4 100644 --- a/Modules/RTUI/Qmitk/QmitkFreeIsoDoseLevelWidget.h +++ b/Modules/RTUI/Qmitk/QmitkFreeIsoDoseLevelWidget.h @@ -1,78 +1,78 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITK_FREE_ISO_DOSE_LEVEL_WIDGET_H #define QMITK_FREE_ISO_DOSE_LEVEL_WIDGET_H #include "MitkRTUIExports.h" #include "ui_QmitkFreeIsoDoseLevelWidget.h" #include #include "mitkIsoDoseLevel.h" /** * \class QmitkFreeIsoDoseLevelWidget * \brief Widget that allows to show and edit the content of an mitk::IsoDoseLevel instance. */ class MITKRTUI_EXPORT QmitkFreeIsoDoseLevelWidget : public QWidget, private Ui::QmitkFreeIsoDoseLevelWidget { Q_OBJECT public: - QmitkFreeIsoDoseLevelWidget(QWidget* parent=0); + explicit QmitkFreeIsoDoseLevelWidget(QWidget* parent=0); mitk::DoseValueAbs getReferenceDose() const; mitk::IsoDoseLevel* getIsoDoseLevel() const; signals: void ValueChanged(mitk::IsoDoseLevel*, mitk::DoseValueRel oldValue); void ColorChanged(mitk::IsoDoseLevel*); void VisualizationStyleChanged(mitk::IsoDoseLevel*); public Q_SLOTS: /** * \brief Slot that can be used to set the reference dose. */ void setReferenceDose(double newReferenceDose); /** * \brief Slot that can be used to set the dose level instance that should be handled by the widget. */ void setIsoDoseLevel(mitk::IsoDoseLevel* level); void OnRelValueChanged(double newValue); void OnAbsValueChanged(double newValue); void OnSliderChanged(int newValue); void OnVisibleClicked(bool checked); void OnColorChanged(QColor color); protected: /** * \brief Updates the widget according to its current settings. */ void update(); void updateValue(mitk::DoseValueRel newDose); mitk::DoseValueAbs m_ReferenceDose; mitk::IsoDoseLevel::Pointer m_IsoDoseLevel; bool m_InternalUpdate; }; #endif // QmitkFreeIsoDoseLevelWidget_H diff --git a/Modules/RTUI/Qmitk/QmitkIsoDoseLevelSetModel.h b/Modules/RTUI/Qmitk/QmitkIsoDoseLevelSetModel.h index af7f19c9f5..c01806c844 100644 --- a/Modules/RTUI/Qmitk/QmitkIsoDoseLevelSetModel.h +++ b/Modules/RTUI/Qmitk/QmitkIsoDoseLevelSetModel.h @@ -1,98 +1,98 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkIsoDoseLevelSetModel_h #define QmitkIsoDoseLevelSetModel_h #include #include "mitkIsoDoseLevelCollections.h" #include "MitkRTUIExports.h" /*! \class QmitkIsoDoseLevelSetModel Model that handles a iso dose level set and allows viewing and editing of its contents. Please see special delegates (QmitkDoseColorDelegate, QmitkDoseValueDelegate, QmitkDoseVisualStyleDelegate) to handle visualization and editing in views that work on this model. \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation. */ class MITKRTUI_EXPORT QmitkIsoDoseLevelSetModel : public QAbstractTableModel { Q_OBJECT public: - QmitkIsoDoseLevelSetModel(QObject *parent = NULL); + explicit QmitkIsoDoseLevelSetModel(QObject *parent = NULL); virtual ~QmitkIsoDoseLevelSetModel() {}; /** Sets the data handled by the model and resets the modified flag*/ void setIsoDoseLevelSet(mitk::IsoDoseLevelSet *pSet); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant data(const QModelIndex &index, int role) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool getShowAbsoluteDose() const; mitk::DoseValueAbs getReferenceDose() const; bool getVisibilityEditOnly() const; void switchVisibilityIsoLines(bool activate); void switchVisibilityColorWash(bool activate); void invertVisibilityIsoLines(); void invertVisibilityColorWash(); void swapVisibility(); void addLevel(); void deleteLevel(const QModelIndex &index); /**Indicates if the content of the model was modified since the data was set via setIsoDoseLevelSet()*/ bool isModified(); public Q_SLOTS: /** * \brief Slot that can be used to set the prescribed dose. */ void setReferenceDose(double newReferenceDose); /** * \brief Slot that can be used to adjust whether the dose should be displayed in absolute or relative units. */ void setShowAbsoluteDose(bool showAbsoluteDose); /** * \brief Slat that can be used to adjust wether the model allows to edit only visibilities (no dose value or color) */ void setVisibilityEditOnly(bool onlyVisibility); private: mitk::IsoDoseLevelSet::Pointer m_DoseSet; bool m_showAbsoluteDose; bool m_visibilityEditOnly; mitk::DoseValueAbs m_referenceDose; /** Indicates if the data of the model was modified, since the model was set. */ bool m_modified; }; #endif // QmitkIsoDoseLevelSetModel_h