00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2009-05-15 18:09:46 +0200 (Fr, 15 Mai 2009) $ 00006 Version: $Revision: 1.12 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef QmitkVtkHistogramWidget_H_ 00019 #define QmitkVtkHistogramWidget_H_ 00020 00021 #include "QmitkHistogram.h" 00022 #include "QmitkExtExports.h" 00023 #include "mitkImage.h" 00024 #include "mitkPlanarFigure.h" 00025 00026 #include <qlayout.h> 00027 #include <qtextedit.h> 00028 #include <qdialog.h> 00029 00030 #include <itkHistogram.h> 00031 00032 #include <vtkQtChartWidget.h> 00033 #include <vtkQtBarChart.h> 00034 00035 #include <QStandardItemModel> 00036 00037 00038 00039 00044 class QmitkExt_EXPORT QmitkVtkHistogramWidget : public QDialog 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 QmitkVtkHistogramWidget( QWidget * /*parent = 0 */); 00050 virtual ~QmitkVtkHistogramWidget(); 00051 00052 typedef mitk::Image::HistogramType HistogramType; 00053 typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType; 00054 00055 typedef itk::ImageRegion< 3 > RegionType; 00056 00057 enum 00058 { 00059 HISTOGRAM_MODE_DIRECT = 0, 00060 HISTOGRAM_MODE_ENTIREIMAGE, 00061 HISTOGRAM_MODE_MASKEDIMAGE, 00062 HISTOGRAM_MODE_IMAGEREGION, 00063 HISTOGRAM_MODE_PLANARFIGUREREGION 00064 }; 00065 00066 00068 void SetHistogram(const HistogramType* histogram); 00069 00071 void SetImage(const mitk::Image* image); 00072 00075 void SetImageMask(const mitk::Image* imageMask); 00076 00078 void SetImageRegion(const RegionType imageRegion); 00079 00082 void SetPlanarFigure(const mitk::PlanarFigure* planarFigure); 00083 00085 void SetHistogramMode(unsigned int histogramMode); 00086 00088 unsigned int GetHistogramMode(); 00089 00091 void SetHistogramModeToDirectHistogram(); 00092 00094 void SetHistogramModeToEntireImage(); 00095 00097 void SetHistogramModeToMaskedImage(); 00098 00100 void SetHistogramModeToImageRegion(); 00101 00103 void SetHistogramModeToPlanarFigureRegion(); 00104 00105 00107 void UpdateItemModelFromHistogram(); 00108 00110 void ClearItemModel(); 00111 00112 00113 protected slots: 00114 00115 00116 protected: 00117 00118 void ComputeHistogram(); 00119 00120 vtkQtChartWidget *m_ChartWidget; 00121 vtkQtBarChart *m_BarChart; 00122 00123 QStandardItemModel *m_ItemModel; 00124 00125 mitk::Image::ConstPointer m_Image; 00126 00127 mitk::Image::ConstPointer m_ImageMask; 00128 00129 RegionType m_ImageRegion; 00130 00131 mitk::PlanarFigure::ConstPointer m_PlanarFigure; 00132 00133 unsigned int m_HistogramMode; 00134 00135 00136 // Histogram set explicitly by user 00137 HistogramType::ConstPointer m_Histogram; 00138 00139 // Histogram derived from image (not set explicitly by user) 00140 HistogramType::ConstPointer m_DerivedHistogram; 00141 00142 00143 }; 00144 00145 #endif /* QmitkVtkHistogramWidget_H_ */