1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "qtvtkviewerwidget.h"
27 #include "ui_qtvtkviewerwidget.h"
31 QtVTKViewerWidget::QtVTKViewerWidget(QWidget *parent) :
33 ui(new Ui::QtVTKViewerWidget)
37 ui->m_VolumeRender->SetRenderer(this->getRenderer());
38 ui->m_VolumeRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor());
40 ui->m_SurfaceRender->SetRenderer(this->getRenderer());
41 ui->m_SurfaceRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor());
45 QtVTKViewerWidget::~QtVTKViewerWidget()
50 vtkRenderer* QtVTKViewerWidget::getRenderer(){
51 return ui->_qtvtkviewer->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
54 void QtVTKViewerWidget::setImage(vtkImageData* img){
57 ui->checkBoxShowPlanes->setChecked(true);
58 ui->_qtvtkviewer->setImage(img);
59 ui->m_VolumeRender->SetImageData(img);
60 ui->m_SurfaceRender->SetImageData(img);
62 int *extent = img->GetExtent();
65 ui->horizontalSliderX->setRange(extent[0], extent[1]);
66 ui->horizontalSliderY->setRange(extent[2], extent[3]);
67 ui->horizontalSliderZ->setRange(extent[4], extent[5]);
71 void QtVTKViewerWidget::SetLookupTable(vtkLookupTable *lookuptable){
73 ui->_qtvtkviewer->SetLookupTable(lookuptable);
74 ui->m_VolumeRender->SetLookUpTable(lookuptable);
77 void QtVTKViewerWidget::on_checkBoxShowPlanes_clicked(){
79 ui->_qtvtkviewer->showPlanes(ui->checkBoxShowPlanes->isChecked());
82 void QtVTKViewerWidget::SetOutputFormatToRGBA(){
83 ui->_qtvtkviewer->SetOutputFormatToRGBA();
86 void QtVTKViewerWidget::on_checkBoxShowImageActor_clicked(bool checked)
88 if(!(ui->_qtvtkviewer->showImageActors(checked))){
89 ui->checkBoxShowImageActor->setCheckState(Qt::Unchecked);
93 void QtVTKViewerWidget::on_horizontalSliderX_valueChanged(int value)
96 ui->lineEditX->setText(QString::number(value));
97 ui->_qtvtkviewer->setSliceXImageActor(value);
101 void QtVTKViewerWidget::on_horizontalSliderY_valueChanged(int value)
103 ui->lineEditY->setText(QString::number(value));
104 ui->_qtvtkviewer->setSliceYImageActor(value);
107 void QtVTKViewerWidget::on_horizontalSliderZ_valueChanged(int value)
109 ui->lineEditZ->setText(QString::number(value));
110 ui->_qtvtkviewer->setSliceZImageActor(value);