X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FGUI%2FQt%2FViewers%2Fqtvtkviewerwidget.cxx;h=2f15008dd53badfb53fe6310fd198fad5d0b7cbd;hb=1f175c3825a4a4c2f79f1923a2c39da77a393c6d;hp=081107f7a4e05ffb597127915164c87095e66ae4;hpb=649fc25e246b85f708b3e2ae8bb99ebc4941bf62;p=creaMaracasVisu.git diff --git a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx index 081107f..2f15008 100644 --- a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx +++ b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx @@ -1,19 +1,45 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + #include "qtvtkviewerwidget.h" #include "ui_qtvtkviewerwidget.h" QtVTKViewerWidget::QtVTKViewerWidget(QWidget *parent) : - QWidget(parent) + QWidget(parent), + ui(new Ui::QtVTKViewerWidget) { - setupUi(this); + ui->setupUi(this); + ui->m_VolumeRender->SetRenderer(this->getRenderer()); + ui->m_VolumeRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor()); - this->m_VolumeRender->SetRenderer(this->getRenderer()); - this->m_VolumeRender->SetInteractor(this->_qtvtkviewer->GetRenderWindow()->GetInteractor()); + ui->m_SurfaceRender->SetRenderer(this->getRenderer()); + ui->m_SurfaceRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor()); - this->m_SurfaceRender->setRenderer(this->getRenderer()); - this->m_SurfaceRender->setInteractor(this->_qtvtkviewer->GetRenderWindow()->GetInteractor()); } QtVTKViewerWidget::~QtVTKViewerWidget() @@ -22,23 +48,64 @@ QtVTKViewerWidget::~QtVTKViewerWidget() } vtkRenderer* QtVTKViewerWidget::getRenderer(){ - return this->_qtvtkviewer->GetRenderWindow()->GetRenderers()->GetFirstRenderer(); + return ui->_qtvtkviewer->GetRenderWindow()->GetRenderers()->GetFirstRenderer(); } void QtVTKViewerWidget::setImage(vtkImageData* img){ - this->_qtvtkviewer->setImage(img); - this->m_VolumeRender->SetImageData(img); - this->m_SurfaceRender->SetImageData(img); + + + ui->checkBoxShowPlanes->setChecked(true); + ui->_qtvtkviewer->setImage(img); + ui->m_VolumeRender->SetImageData(img); + ui->m_SurfaceRender->SetImageData(img); + + int *extent = img->GetExtent(); + + + ui->horizontalSliderX->setRange(extent[0], extent[1]); + ui->horizontalSliderY->setRange(extent[2], extent[3]); + ui->horizontalSliderZ->setRange(extent[4], extent[5]); } void QtVTKViewerWidget::SetLookupTable(vtkLookupTable *lookuptable){ - this->_qtvtkviewer->SetLookupTable(lookuptable); - this->m_VolumeRender->SetLookUpTable(lookuptable); + ui->_qtvtkviewer->SetLookupTable(lookuptable); + ui->m_VolumeRender->SetLookUpTable(lookuptable); } void QtVTKViewerWidget::on_checkBoxShowPlanes_clicked(){ - this->_qtvtkviewer->showPlanes(checkBoxShowPlanes->isChecked()); + ui->_qtvtkviewer->showPlanes(ui->checkBoxShowPlanes->isChecked()); +} + +void QtVTKViewerWidget::SetOutputFormatToRGBA(){ + ui->_qtvtkviewer->SetOutputFormatToRGBA(); +} + +void QtVTKViewerWidget::on_checkBoxShowImageActor_clicked(bool checked) +{ + if(!(ui->_qtvtkviewer->showImageActors(checked))){ + ui->checkBoxShowImageActor->setCheckState(Qt::Unchecked); + } +} + +void QtVTKViewerWidget::on_horizontalSliderX_valueChanged(int value) +{ + + ui->lineEditX->setText(QString::number(value)); + ui->_qtvtkviewer->setSliceXImageActor(value); + +} + +void QtVTKViewerWidget::on_horizontalSliderY_valueChanged(int value) +{ + ui->lineEditY->setText(QString::number(value)); + ui->_qtvtkviewer->setSliceYImageActor(value); +} + +void QtVTKViewerWidget::on_horizontalSliderZ_valueChanged(int value) +{ + ui->lineEditZ->setText(QString::number(value)); + ui->_qtvtkviewer->setSliceZImageActor(value); }