DGtalTools  1.5.beta
Data Structures | Public Types | Public Slots | Public Member Functions | Private Attributes
MainWindow Class Reference

#include <visualisation/sliceViewer.h>

Inherits QMainWindow.

Collaboration diagram for MainWindow:
Collaboration graph
[legend]

Data Structures

struct  ColorMapFunctor
 

Public Types

enum  ColorMapType { Id , GradientMapHot , GradientMapCool , HueshadeCM }
 
typedef DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > Image3D
 
typedef DGtal::ImageContainerBySTLVector< DGtal::Z2i::Domain, unsigned char > Image2D
 
typedef DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, DGtal::functors::IdentitySliceImageAdapter
 
typedef DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, ColorMapFunctorSliceImageAdapterFct
 

Public Slots

void updateSliceImageX ()
 
void updateSliceImageY ()
 
void updateSliceImageZ ()
 
void updateZoomImageX ()
 
void updateZoomImageY ()
 
void updateZoomImageZ ()
 
void setScale1_1_ImageX ()
 
void setScale1_1_ImageY ()
 
void setScale1_1_ImageZ ()
 
void changeNormalColorMap ()
 
void changeCoolColorMap ()
 
void changeHueColorMap ()
 
void changeHotColorMap ()
 

Public Member Functions

 MainWindow (DGtal::Viewer3D<> *viewer, DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > *myImage3D, const ColorMapFunctor &aFunctor, QWidget *parent=0, Qt::WindowFlags flags=0)
 
 ~MainWindow ()
 
void setImageProjX (const QPixmap &aPixMap)
 
void setImageProjY (const QPixmap &aPixMap)
 
void setImageProjZ (const QPixmap &aPixMap)
 
void updateSliceImageX (int sliceNumber, bool init)
 
void updateSliceImageY (int sliceNumber, bool init)
 
void updateSliceImageZ (int sliceNumber, bool init)
 
void updateZoomImageX (int sliceNumber, double gridSize)
 
void updateZoomImageY (int sliceNumber, double gridSize)
 
void updateZoomImageZ (int sliceNumber, double gridSize)
 
void updateAllDisplayedImages ()
 

Private Attributes

Ui::MainWindow * ui
 
DGtal::Viewer3DmyViewer
 
Image3DmyImage3D
 
ColorMapFunctor myColorMap
 

Detailed Description

Definition at line 48 of file sliceViewer.h.

Member Typedef Documentation

◆ Image2D

Definition at line 96 of file sliceViewer.h.

◆ Image3D

Definition at line 95 of file sliceViewer.h.

◆ SliceImageAdapter

Definition at line 98 of file sliceViewer.h.

◆ SliceImageAdapterFct

Definition at line 100 of file sliceViewer.h.

Member Enumeration Documentation

◆ ColorMapType

Enumerator
Id 
GradientMapHot 
GradientMapCool 
HueshadeCM 

Definition at line 54 of file sliceViewer.h.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( DGtal::Viewer3D<> *  viewer,
DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > *  myImage3D,
const ColorMapFunctor aFunctor,
QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)
explicit

Definition at line 133 of file sliceViewer.cpp.

135  :
136  QMainWindow(parent),
137  ui(new Ui::MainWindow),
138  myViewer(aViewer),
139  myImage3D(anImage),
140  myColorMap(aFunctor)
141 {
142 
143  ui->setupUi(this);
144  ui->verticalLayout_5->addWidget(aViewer);
145 
146 
147  ui->_horizontalSliderZ->setMinimum(anImage->domain().lowerBound()[2]);
148  ui->_horizontalSliderZ->setMaximum(anImage->domain().upperBound()[2]);
149  ui->_horizontalSliderZ->setValue(anImage->domain().lowerBound()[2]);
150 
151  ui->_horizontalSliderY->setMinimum(anImage->domain().lowerBound()[1]);
152  ui->_horizontalSliderY->setMaximum(anImage->domain().upperBound()[1]);
153  ui->_horizontalSliderY->setValue(anImage->domain().lowerBound()[1]);
154 
155  ui->_horizontalSliderX->setMinimum(anImage->domain().lowerBound()[0]);
156  ui->_horizontalSliderX->setMaximum(anImage->domain().upperBound()[0]);
157  ui->_horizontalSliderX->setValue(anImage->domain().lowerBound()[0]);
158 
159  ui->_zoomXSlider->setMinimum( MIN_ZOOM_FACTOR);
160  ui->_zoomXSlider->setMaximum( MAX_ZOOM_FACTOR);
161  ui->_zoomXSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
162 
163  ui->_zoomYSlider->setMinimum(MIN_ZOOM_FACTOR);
164  ui->_zoomYSlider->setMaximum(MAX_ZOOM_FACTOR);
165  ui->_zoomYSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
166 
167  ui->_zoomZSlider->setMinimum(MIN_ZOOM_FACTOR);
168  ui->_zoomZSlider->setMaximum(MAX_ZOOM_FACTOR);
169  ui->_zoomZSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
170 
171  QObject::connect(ui->_horizontalSliderX, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageX()));
172  QObject::connect(ui->_horizontalSliderY, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageY()));
173  QObject::connect(ui->_horizontalSliderZ, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageZ()));
174  QObject::connect(ui->_zoomXSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageX()));
175  QObject::connect(ui->_zoomYSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageY()));
176  QObject::connect(ui->_zoomZSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageZ()));
177 
178  QObject::connect(ui->_scale1ButtonX, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageX()));
179  QObject::connect(ui->_scale1ButtonY, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageY()));
180  QObject::connect(ui->_scale1ButtonZ, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageZ()));
181 
182  QObject::connect(ui->_CoolButton, SIGNAL(clicked()), this, SLOT(changeCoolColorMap()));
183  QObject::connect(ui->_HotButton, SIGNAL(clicked()), this, SLOT(changeHotColorMap()));
184  QObject::connect(ui->_HueButton, SIGNAL(clicked()), this, SLOT(changeHueColorMap()));
185  QObject::connect(ui->_NormalButton, SIGNAL(clicked()), this, SLOT(changeNormalColorMap()));
186 
187 
188 }
void updateZoomImageX()
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()
void setScale1_1_ImageZ()
DGtal::Viewer3D * myViewer
Definition: sliceViewer.h:143
ColorMapFunctor myColorMap
Definition: sliceViewer.h:145
void updateSliceImageX()
void updateZoomImageZ()
void updateSliceImageZ()
void changeHueColorMap()
void changeHotColorMap()
void setScale1_1_ImageX()

References changeCoolColorMap(), changeHotColorMap(), changeHueColorMap(), changeNormalColorMap(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), setScale1_1_ImageX(), setScale1_1_ImageY(), setScale1_1_ImageZ(), ui, updateSliceImageX(), updateSliceImageY(), updateSliceImageZ(), updateZoomImageX(), updateZoomImageY(), and updateZoomImageZ().

◆ ~MainWindow()

MainWindow::~MainWindow ( )

Definition at line 190 of file sliceViewer.cpp.

191 {
192  delete ui;
193 }

References ui.

Member Function Documentation

◆ changeCoolColorMap

void MainWindow::changeCoolColorMap ( )
slot

Definition at line 205 of file sliceViewer.cpp.

205  {
208 }
void updateAllDisplayedImages()

References GradientMapCool, myColorMap, and updateAllDisplayedImages().

Referenced by MainWindow().

◆ changeHotColorMap

void MainWindow::changeHotColorMap ( )
slot

Definition at line 213 of file sliceViewer.cpp.

References GradientMapHot, myColorMap, and updateAllDisplayedImages().

Referenced by MainWindow().

◆ changeHueColorMap

void MainWindow::changeHueColorMap ( )
slot

Definition at line 209 of file sliceViewer.cpp.

References HueshadeCM, myColorMap, and updateAllDisplayedImages().

Referenced by MainWindow().

◆ changeNormalColorMap

void MainWindow::changeNormalColorMap ( )
slot

Definition at line 200 of file sliceViewer.cpp.

200  {
203 }

References Id, myColorMap, and updateAllDisplayedImages().

Referenced by MainWindow().

◆ setImageProjX()

void MainWindow::setImageProjX ( const QPixmap &  aPixMap)

Definition at line 219 of file sliceViewer.cpp.

219  {
220  ui->ImageProjX->setPixmap(aPixMap);
221 }

References ui.

Referenced by updateSliceImageX(), and updateZoomImageX().

◆ setImageProjY()

void MainWindow::setImageProjY ( const QPixmap &  aPixMap)

Definition at line 222 of file sliceViewer.cpp.

222  {
223  ui->ImageProjY->setPixmap(aPixMap);
224 }

References ui.

Referenced by updateSliceImageY(), and updateZoomImageY().

◆ setImageProjZ()

void MainWindow::setImageProjZ ( const QPixmap &  aPixMap)

Definition at line 225 of file sliceViewer.cpp.

225  {
226  ui->ImageProjZ->setPixmap(aPixMap);
227 }

References ui.

Referenced by updateSliceImageZ(), and updateZoomImageZ().

◆ setScale1_1_ImageX

void MainWindow::setScale1_1_ImageX ( )
slot

Definition at line 243 of file sliceViewer.cpp.

243  {
244  ui->_zoomXSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
246 }

References ui, and updateZoomImageX().

Referenced by MainWindow().

◆ setScale1_1_ImageY

void MainWindow::setScale1_1_ImageY ( )
slot

Definition at line 248 of file sliceViewer.cpp.

248  {
249  ui->_zoomYSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
251 }

References ui, and updateZoomImageY().

Referenced by MainWindow().

◆ setScale1_1_ImageZ

void MainWindow::setScale1_1_ImageZ ( )
slot

Definition at line 253 of file sliceViewer.cpp.

253  {
254  ui->_zoomZSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);
256 }

References ui, and updateZoomImageZ().

Referenced by MainWindow().

◆ updateAllDisplayedImages()

void MainWindow::updateAllDisplayedImages ( )

◆ updateSliceImageX [1/2]

void MainWindow::updateSliceImageX ( )
slot

Definition at line 230 of file sliceViewer.cpp.

230  {
231  updateSliceImageX(ui->_horizontalSliderX->value(), false);
232 }

References ui.

Referenced by MainWindow(), and updateAllDisplayedImages().

◆ updateSliceImageX() [2/2]

void MainWindow::updateSliceImageX ( int  sliceNumber,
bool  init 
)

Definition at line 324 of file sliceViewer.cpp.

324  {
326  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
327  invFunctor(myImage3D->domain().upperBound()));
328  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(0);
329  const functors::Identity identityFunctor{};
330  SliceImageAdapter sliceImage ( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
331 
332  double gridSize = ((double)INIT_SCALE1_ZOOM_FACTOR)/ui->_zoomXSlider->value();
333  QImage anImage = getImage(sliceImage, gridSize,myColorMap);
334  setImageProjX(QPixmap::fromImage(anImage));
335  Z3i::Point imageOrigin = myImage3D->domain().lowerBound();
336  if(init){
339  imageOrigin[1], imageOrigin[2]);
340  (*myViewer) << Viewer3D<>::updateDisplay;
341  }else{
343  (*myViewer) << DGtal::UpdateImagePosition< Space, KSpace >(0, DGtal::Viewer3D<>::xDirection, sliceNumber, imageOrigin[1],
344  imageOrigin[2]);
345 
346  (*myViewer).updateList(init);
347  (*myViewer).update();
348  }
349 
350 
351 }
const Domain & domain() const
void setImageProjX(const QPixmap &aPixMap)
DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, DGtal::functors::Identity > SliceImageAdapter
Definition: sliceViewer.h:98
void initRemoveOneDim(const Dimension &dimRemoved)

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, setImageProjX(), and ui.

◆ updateSliceImageY [1/2]

void MainWindow::updateSliceImageY ( )
slot

Definition at line 234 of file sliceViewer.cpp.

234  {
235  updateSliceImageY(ui->_horizontalSliderY->value(), false);
236 }

References ui.

Referenced by MainWindow(), and updateAllDisplayedImages().

◆ updateSliceImageY() [2/2]

void MainWindow::updateSliceImageY ( int  sliceNumber,
bool  init 
)

Definition at line 354 of file sliceViewer.cpp.

354  {
355 
357  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
358  invFunctor(myImage3D->domain().upperBound()));
359  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(1);
360  const functors::Identity identityFunctor{};
361  SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
362 
363  double gridSize = ((double)INIT_SCALE1_ZOOM_FACTOR)/ui->_zoomYSlider->value();
364  QImage anImage = getImage(sliceImage, gridSize, myColorMap);
365  setImageProjY(QPixmap::fromImage(anImage));
366  Z3i::Point imageOrigin = myImage3D->domain().lowerBound();
367  if(init){
370  sliceNumber, imageOrigin[2]);
371  (*myViewer) << Viewer3D<>::updateDisplay;
372  }else{
375  sliceNumber, imageOrigin[2]);
376  (*myViewer).updateList(init);
377  (*myViewer).update();
378  }
379 
380 }
void setImageProjY(const QPixmap &aPixMap)

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, setImageProjY(), and ui.

◆ updateSliceImageZ [1/2]

void MainWindow::updateSliceImageZ ( )
slot

Definition at line 238 of file sliceViewer.cpp.

238  {
239  updateSliceImageZ(ui->_horizontalSliderZ->value(), false);
240 }

References ui.

Referenced by MainWindow(), and updateAllDisplayedImages().

◆ updateSliceImageZ() [2/2]

void MainWindow::updateSliceImageZ ( int  sliceNumber,
bool  init 
)

Definition at line 383 of file sliceViewer.cpp.

383  {
384 
386  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
387  invFunctor(myImage3D->domain().upperBound()));
388  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(2);
389  const functors::Identity identityFunctor{};
390  SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
391  double gridSize = (double)INIT_SCALE1_ZOOM_FACTOR/ui->_zoomZSlider->value();
392  QImage anImage = getImage(sliceImage, gridSize, myColorMap);
393  setImageProjZ(QPixmap::fromImage(anImage));
394  Z3i::Point imageOrigin = myImage3D->domain().lowerBound();
395  if(init){
398  imageOrigin[1], sliceNumber);
399 
400  (*myViewer) << Viewer3D<>::updateDisplay;
401  }else{
403  myColorMap);
405  imageOrigin[1], sliceNumber);
406  (*myViewer).updateList(init);
407  (*myViewer).update();
408  }
409 
410 
411 }
void setImageProjZ(const QPixmap &aPixMap)

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, setImageProjZ(), and ui.

◆ updateZoomImageX [1/2]

void MainWindow::updateZoomImageX ( )
slot

Definition at line 260 of file sliceViewer.cpp.

260  {
261  double gridSize = (double)INIT_SCALE1_ZOOM_FACTOR/ui->_zoomXSlider->value();
262  updateZoomImageX(ui->_horizontalSliderX->value(), gridSize );
263  QString gridStr = QString::number(gridSize, 'f', 3);
264  QString scaleStr = QString::number(1.0/gridSize, 'f', 3);
265  ui->_groupBoxX->setTitle(QString("Slice View X: sampling grid size: ").append(gridStr).
266  append(QString(" (zoom x "). append(scaleStr).append(QString(")") )));
267 }

References ui.

Referenced by MainWindow(), and setScale1_1_ImageX().

◆ updateZoomImageX() [2/2]

void MainWindow::updateZoomImageX ( int  sliceNumber,
double  gridSize 
)

Definition at line 288 of file sliceViewer.cpp.

288  {
290  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
291  invFunctor(myImage3D->domain().upperBound()));
292  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(0);
293  const functors::Identity identityFunctor{};
294  SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
295  QImage anImage = getImage(sliceImage, gridSize, myColorMap);
296  setImageProjX(QPixmap::fromImage(anImage));
297 }

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, and setImageProjX().

◆ updateZoomImageY [1/2]

void MainWindow::updateZoomImageY ( )
slot

Definition at line 268 of file sliceViewer.cpp.

268  {
269  double gridSize = (double)INIT_SCALE1_ZOOM_FACTOR/ui->_zoomYSlider->value();
270  updateZoomImageY(ui->_horizontalSliderY->value(), gridSize );
271  QString gridStr = QString::number(gridSize, 'f', 3);
272  QString scaleStr = QString::number(1.0/gridSize, 'f', 3);
273  ui->_groupBoxY->setTitle(QString("Slice View Y: sampling grid size: ").append(gridStr).
274  append(QString(" (zoom x "). append(scaleStr).append(QString(")") )));
275 
276 }

References ui.

Referenced by MainWindow(), and setScale1_1_ImageY().

◆ updateZoomImageY() [2/2]

void MainWindow::updateZoomImageY ( int  sliceNumber,
double  gridSize 
)

Definition at line 299 of file sliceViewer.cpp.

299  {
301  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
302  invFunctor(myImage3D->domain().upperBound()));
303  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(1);
304  const functors::Identity identityFunctor{};
305  SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
306 
307  QImage anImage = getImage(sliceImage, gridSize, myColorMap);
308  setImageProjY(QPixmap::fromImage(anImage));
309 }

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, and setImageProjY().

◆ updateZoomImageZ [1/2]

void MainWindow::updateZoomImageZ ( )
slot

Definition at line 277 of file sliceViewer.cpp.

277  {
278  double gridSize = (double)INIT_SCALE1_ZOOM_FACTOR/ui->_zoomZSlider->value();
279  updateZoomImageZ(ui->_horizontalSliderZ->value(), gridSize );
280  QString gridStr = QString::number(gridSize, 'f', 3);
281  QString scaleStr = QString::number(1.0/gridSize, 'f', 3);
282  ui->_groupBoxZ->setTitle(QString("Slice View Z: sampling grid size: ").append(gridStr).
283  append(QString(" (zoom x "). append(scaleStr).append(QString(")") )));
284 
285 }

References ui.

Referenced by MainWindow(), and setScale1_1_ImageZ().

◆ updateZoomImageZ() [2/2]

void MainWindow::updateZoomImageZ ( int  sliceNumber,
double  gridSize 
)

Definition at line 312 of file sliceViewer.cpp.

312  {
314  DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
315  invFunctor(myImage3D->domain().upperBound()));
316  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctor(sliceNumber); aSliceFunctor.initAddOneDim(2);
317  const functors::Identity identityFunctor{};
318  SliceImageAdapter sliceImage( *myImage3D, domain2D, aSliceFunctor, identityFunctor );
319  QImage anImage = getImage(sliceImage, gridSize, myColorMap );
320  setImageProjZ(QPixmap::fromImage(anImage));
321 }

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::domain(), DGtal::functors::Projector< S >::initAddOneDim(), DGtal::functors::Projector< S >::initRemoveOneDim(), myColorMap, myImage3D, and setImageProjZ().

Field Documentation

◆ myColorMap

ColorMapFunctor MainWindow::myColorMap
private

◆ myImage3D

Image3D* MainWindow::myImage3D
private

◆ myViewer

DGtal::Viewer3D* MainWindow::myViewer
private

Definition at line 143 of file sliceViewer.h.

◆ ui

Ui::MainWindow* MainWindow::ui
private

The documentation for this class was generated from the following files: