DGtalTools  1.2.0
sliceViewer.h
1 
29 #ifndef MAINWINDOW_H
30 #define MAINWINDOW_H
31 #ifndef Q_MOC_RUN
32 #include "DGtal/io/viewers/Viewer3D.h"
33 #include "DGtal/images/ImageContainerBySTLVector.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "DGtal/images/ConstImageAdapter.h"
36 #include "DGtal/io/colormaps/GradientColorMap.h"
37 #include "DGtal/io/colormaps/HueShadeColorMap.h"
38 #endif
39 
40 
41 #include <QMainWindow>
42 
43 namespace Ui {
44  class MainWindow;
45 
46 }
47 
48 class MainWindow : public QMainWindow
49 {
50  Q_OBJECT
51 
52 
53 public:
55 
57  ColorMapFunctor (const ColorMapType type): myType(type), hueShade(DGtal::HueShadeColorMap<unsigned char>(0,255)),
58  gradShadeCool(DGtal::GradientColorMap<unsigned char, DGtal::CMAP_COOL> (0,255)),
59  gradShadeHot(DGtal::GradientColorMap<unsigned char, DGtal::CMAP_HOT> (0,255))
60 
61 
62  {
63  };
64  inline
65  unsigned int operator() (unsigned char aVal) const
66  {
67  DGtal::Color col;
68  if(myType == HueshadeCM)
69  {
70  col = hueShade((unsigned int)aVal);
71  }
72  else if(myType == GradientMapHot)
73  {
74  col = gradShadeHot((unsigned int)aVal);
75  }
76  else if(myType == GradientMapCool)
77  {
78  col = gradShadeCool((unsigned int)aVal);
79  }
80  else
81  {
82  col = DGtal::Color(aVal);
83  }
84  return (((unsigned int) col.red()) << 16)| (((unsigned int) col.green()) << 8)|((unsigned int) col.blue());
85  }
87  DGtal::HueShadeColorMap<unsigned char> hueShade;
88  DGtal::GradientColorMap<unsigned char, DGtal::CMAP_COOL> gradShadeCool;
89  DGtal::GradientColorMap<unsigned char, DGtal::CMAP_HOT> gradShadeHot;
90 
91  };
92 
93 
94 
95  typedef DGtal::ImageContainerBySTLVector < DGtal::Z3i::Domain, unsigned char > Image3D;
96  typedef DGtal::ImageContainerBySTLVector < DGtal::Z2i::Domain, unsigned char > Image2D;
97  typedef DGtal::ConstImageAdapter<Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space>,
98  Image3D::Value, DGtal::functors::Identity > SliceImageAdapter;
99  typedef DGtal::ConstImageAdapter<Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space>,
101 
102 public:
103  explicit MainWindow(DGtal::Viewer3D<> *viewer, DGtal::ImageContainerBySTLVector < DGtal::Z3i::Domain,
104  unsigned char > *myImage3D, const ColorMapFunctor &aFunctor, QWidget *parent = 0, Qt::WindowFlags flags=0);
105  ~MainWindow();
106  void setImageProjX(const QPixmap &aPixMap);
107  void setImageProjY(const QPixmap &aPixMap);
108  void setImageProjZ(const QPixmap &aPixMap);
109 
110 
111  void updateSliceImageX( int sliceNumber, bool init);
112  void updateSliceImageY( int sliceNumber, bool init);
113  void updateSliceImageZ( int sliceNumber, bool init);
114 
115  void updateZoomImageX(int sliceNumber, double gridSize);
116  void updateZoomImageY(int sliceNumber, double gridSize);
117  void updateZoomImageZ(int sliceNumber, double gridSize);
118  void updateAllDisplayedImages();
119 
120 
121 public slots:
122  void updateSliceImageX();
123  void updateSliceImageY();
124  void updateSliceImageZ();
125 
126  void updateZoomImageX();
127  void updateZoomImageY();
128  void updateZoomImageZ();
129 
130  void setScale1_1_ImageX();
131  void setScale1_1_ImageY();
132  void setScale1_1_ImageZ();
133 
134  void changeNormalColorMap();
135  void changeCoolColorMap();
136  void changeHueColorMap();
137  void changeHotColorMap();
138 
139 
140 
141 private:
142  Ui::MainWindow *ui;
143  DGtal::Viewer3D<> *myViewer;
146 };
147 
148 #endif // MAINWINDOW_H
149 
void setImageProjY(const QPixmap &aPixMap)
void updateAllDisplayedImages()
void updateZoomImageX()
DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, ColorMapFunctor > SliceImageAdapterFct
Definition: sliceViewer.h:100
void changeNormalColorMap()
void updateSliceImageY()
Ui::MainWindow * ui
Definition: sliceViewer.h:142
Image3D * myImage3D
Definition: sliceViewer.h:144
void updateZoomImageY()
void setScale1_1_ImageY()
void changeCoolColorMap()
DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > Image3D
Definition: sliceViewer.h:95
void setScale1_1_ImageZ()
DGtal::Viewer3D * myViewer
Definition: sliceViewer.h:143
ColorMapFunctor myColorMap
Definition: sliceViewer.h:145
void updateSliceImageX()
void setImageProjX(const QPixmap &aPixMap)
void updateZoomImageZ()
MainWindow(DGtal::Viewer3D<> *viewer, DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > *myImage3D, const ColorMapFunctor &aFunctor, QWidget *parent=0, Qt::WindowFlags flags=0)
void updateSliceImageZ()
@ GradientMapCool
Definition: sliceViewer.h:54
@ GradientMapHot
Definition: sliceViewer.h:54
void changeHueColorMap()
void changeHotColorMap()
DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, DGtal::functors::Identity > SliceImageAdapter
Definition: sliceViewer.h:98
void setScale1_1_ImageX()
DGtal::ImageContainerBySTLVector< DGtal::Z2i::Domain, unsigned char > Image2D
Definition: sliceViewer.h:96
void setImageProjZ(const QPixmap &aPixMap)
Definition: ATu0v1.h:57
Definition: sliceViewer.h:43
DGtal::GradientColorMap< unsigned char, DGtal::CMAP_HOT > gradShadeHot
Definition: sliceViewer.h:89
unsigned int operator()(unsigned char aVal) const
Definition: sliceViewer.h:65
DGtal::GradientColorMap< unsigned char, DGtal::CMAP_COOL > gradShadeCool
Definition: sliceViewer.h:88
ColorMapFunctor(const ColorMapType type)
Definition: sliceViewer.h:57
DGtal::HueShadeColorMap< unsigned char > hueShade
Definition: sliceViewer.h:87