Skip to content

Commit

Permalink
Merge pull request #256 from rolanddenis/fix_sliceViewer
Browse files Browse the repository at this point in the history
Fix sliceViewer
  • Loading branch information
kerautret committed Mar 22, 2016
2 parents 3dd1d2b + 7f2a8ce commit 695b10a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- fix uses of temporaries when ConstAlias is needed.
(Roland Denis, [#253](https://github.com/DGtal-team/DGtalTools/pull/253))

- *visualisation*:
- sliceViewer: fix bug when imported image domain doesn't contain (0,0,0) point.
(Roland Denis, [#256](https://github.com/DGtal-team/DGtalTools/pull/256))

- *volumetric*:
- fix reading options bug in volCComponentCounter and sdp2vol.
(Bertrand Kerautret,
Expand Down
47 changes: 25 additions & 22 deletions visualisation/sliceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,18 @@ MainWindow::MainWindow(DGtal::Viewer3D<> *aViewer,
ui->setupUi(this);
ui->verticalLayout_5->addWidget(aViewer);

QObject::connect(ui->_horizontalSliderX, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageX()));
QObject::connect(ui->_horizontalSliderY, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageY()));
QObject::connect(ui->_horizontalSliderZ, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageZ()));
QObject::connect(ui->_zoomXSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageX()));
QObject::connect(ui->_zoomYSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageY()));
QObject::connect(ui->_zoomZSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageZ()));

QObject::connect(ui->_scale1ButtonX, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageX()));
QObject::connect(ui->_scale1ButtonY, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageY()));
QObject::connect(ui->_scale1ButtonZ, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageZ()));

QObject::connect(ui->_CoolButton, SIGNAL(clicked()), this, SLOT(changeCoolColorMap()));
QObject::connect(ui->_HotButton, SIGNAL(clicked()), this, SLOT(changeHotColorMap()));
QObject::connect(ui->_HueButton, SIGNAL(clicked()), this, SLOT(changeHueColorMap()));
QObject::connect(ui->_NormalButton, SIGNAL(clicked()), this, SLOT(changeNormalColorMap()));

ui->_horizontalSliderZ->setMinimum(anImage->domain().lowerBound()[2]);
ui->_horizontalSliderZ->setMaximum(anImage->domain().upperBound()[2]);
ui->_horizontalSliderZ->setValue(anImage->domain().lowerBound()[2]);

ui->_horizontalSliderY->setMinimum(anImage->domain().lowerBound()[1]);
ui->_horizontalSliderY->setMaximum(anImage->domain().upperBound()[1]);
ui->_horizontalSliderY->setValue(anImage->domain().lowerBound()[1]);

ui->_horizontalSliderX->setMinimum(anImage->domain().lowerBound()[0]);
ui->_horizontalSliderX->setMaximum(anImage->domain().upperBound()[0]);
ui->_horizontalSliderX->setValue(anImage->domain().lowerBound()[0]);

ui->_zoomXSlider->setMinimum( MIN_ZOOM_FACTOR);
ui->_zoomXSlider->setMaximum( MAX_ZOOM_FACTOR);
Expand All @@ -146,6 +134,21 @@ MainWindow::MainWindow(DGtal::Viewer3D<> *aViewer,
ui->_zoomZSlider->setMaximum(MAX_ZOOM_FACTOR);
ui->_zoomZSlider->setValue(INIT_SCALE1_ZOOM_FACTOR);

QObject::connect(ui->_horizontalSliderX, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageX()));
QObject::connect(ui->_horizontalSliderY, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageY()));
QObject::connect(ui->_horizontalSliderZ, SIGNAL(valueChanged(int)), this, SLOT(updateSliceImageZ()));
QObject::connect(ui->_zoomXSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageX()));
QObject::connect(ui->_zoomYSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageY()));
QObject::connect(ui->_zoomZSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomImageZ()));

QObject::connect(ui->_scale1ButtonX, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageX()));
QObject::connect(ui->_scale1ButtonY, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageY()));
QObject::connect(ui->_scale1ButtonZ, SIGNAL(clicked()), this, SLOT(setScale1_1_ImageZ()));

QObject::connect(ui->_CoolButton, SIGNAL(clicked()), this, SLOT(changeCoolColorMap()));
QObject::connect(ui->_HotButton, SIGNAL(clicked()), this, SLOT(changeHotColorMap()));
QObject::connect(ui->_HueButton, SIGNAL(clicked()), this, SLOT(changeHueColorMap()));
QObject::connect(ui->_NormalButton, SIGNAL(clicked()), this, SLOT(changeNormalColorMap()));


}
Expand Down Expand Up @@ -248,7 +251,7 @@ void MainWindow::updateZoomImageZ(){
}


void MainWindow::updateZoomImageX(unsigned int sliceNumber, double gridSize){
void MainWindow::updateZoomImageX(int sliceNumber, double gridSize){
DGtal::functors::Projector<DGtal::Z2i::Space> invFunctor; invFunctor.initRemoveOneDim(0);
DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
invFunctor(myImage3D->domain().upperBound()));
Expand All @@ -259,7 +262,7 @@ void MainWindow::updateZoomImageX(unsigned int sliceNumber, double gridSize){
setImageProjX(QPixmap::fromImage(anImage));
}

void MainWindow::updateZoomImageY(unsigned int sliceNumber, double gridSize){
void MainWindow::updateZoomImageY(int sliceNumber, double gridSize){
DGtal::functors::Projector<DGtal::Z2i::Space> invFunctor; invFunctor.initRemoveOneDim(1);
DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
invFunctor(myImage3D->domain().upperBound()));
Expand All @@ -272,7 +275,7 @@ void MainWindow::updateZoomImageY(unsigned int sliceNumber, double gridSize){
}


void MainWindow::updateZoomImageZ(unsigned int sliceNumber, double gridSize){
void MainWindow::updateZoomImageZ(int sliceNumber, double gridSize){
DGtal::functors::Projector<DGtal::Z2i::Space> invFunctor; invFunctor.initRemoveOneDim(2);
DGtal::Z2i::Domain domain2D(invFunctor(myImage3D->domain().lowerBound()),
invFunctor(myImage3D->domain().upperBound()));
Expand Down Expand Up @@ -464,15 +467,15 @@ int main( int argc, char** argv )
usegc? MainWindow::GradientMapCool:
MainWindow::Id), 0,0);
w.setWindowTitle ( QString("sliceViewer"));
w.updateSliceImageX(0, true);
w.updateSliceImageY(0, true);
w.updateSliceImageZ(0, true);
w.updateSliceImageX( image.domain().lowerBound()[0], true);
w.updateSliceImageY( image.domain().lowerBound()[1], true);
w.updateSliceImageZ( image.domain().lowerBound()[2], true);
w.show();
Z3i::Point size = image.domain().upperBound() - image.domain().lowerBound();
Z3i::Point center = image.domain().lowerBound()+size/2;
unsigned int maxDist = std::max(std::max(size[2], size[1]), size[2]);
viewer->camera()->setPosition(qglviewer::Vec(center[0],center[1],
2.0*maxDist));
center[2] + 2.0*maxDist));
viewer->camera()->setSceneCenter(qglviewer::Vec(center[0],center[1],center[2]));
application.exec();
delete viewer;
Expand Down
6 changes: 3 additions & 3 deletions visualisation/sliceViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class MainWindow : public QMainWindow
void updateSliceImageY( int sliceNumber, bool init);
void updateSliceImageZ( int sliceNumber, bool init);

void updateZoomImageX(unsigned int sliceNumber, double gridSize);
void updateZoomImageY(unsigned int sliceNumber, double gridSize);
void updateZoomImageZ(unsigned int sliceNumber, double gridSize);
void updateZoomImageX(int sliceNumber, double gridSize);
void updateZoomImageY(int sliceNumber, double gridSize);
void updateZoomImageZ(int sliceNumber, double gridSize);
void updateAllDisplayedImages();


Expand Down

0 comments on commit 695b10a

Please sign in to comment.