]> Creatis software - creaMaracasVisu.git/blob - lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / GUI / Qt / Viewers / qtvtkviewerwidget.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26 #include "qtvtkviewerwidget.h"
27 #include "ui_qtvtkviewerwidget.h"
28
29
30
31 QtVTKViewerWidget::QtVTKViewerWidget(QWidget *parent) :
32     QWidget(parent),
33     ui(new Ui::QtVTKViewerWidget)
34 {
35     ui->setupUi(this);
36
37     ui->m_VolumeRender->SetRenderer(this->getRenderer());
38     ui->m_VolumeRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor());
39
40     ui->m_SurfaceRender->SetRenderer(this->getRenderer());
41     ui->m_SurfaceRender->SetInteractor(ui->_qtvtkviewer->GetRenderWindow()->GetInteractor());
42
43 }
44
45 QtVTKViewerWidget::~QtVTKViewerWidget()
46 {
47
48 }
49
50 vtkRenderer* QtVTKViewerWidget::getRenderer(){
51     return ui->_qtvtkviewer->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
52 }
53
54 void QtVTKViewerWidget::setImage(vtkImageData* img){
55
56
57     ui->checkBoxShowPlanes->setChecked(true);
58     ui->_qtvtkviewer->setImage(img);
59     ui->m_VolumeRender->SetImageData(img);
60     ui->m_SurfaceRender->SetImageData(img);
61
62     int *extent = img->GetExtent();
63
64
65     ui->horizontalSliderX->setRange(extent[0], extent[1]);
66     ui->horizontalSliderY->setRange(extent[2], extent[3]);
67     ui->horizontalSliderZ->setRange(extent[4], extent[5]);
68
69 }
70
71 void QtVTKViewerWidget::SetLookupTable(vtkLookupTable *lookuptable){
72
73     ui->_qtvtkviewer->SetLookupTable(lookuptable);
74     ui->m_VolumeRender->SetLookUpTable(lookuptable);
75 }
76
77 void QtVTKViewerWidget::on_checkBoxShowPlanes_clicked(){
78
79     ui->_qtvtkviewer->showPlanes(ui->checkBoxShowPlanes->isChecked());
80 }
81
82 void QtVTKViewerWidget::SetOutputFormatToRGBA(){
83     ui->_qtvtkviewer->SetOutputFormatToRGBA();
84 }
85
86 void QtVTKViewerWidget::on_checkBoxShowImageActor_clicked(bool checked)
87 {
88     if(!(ui->_qtvtkviewer->showImageActors(checked))){
89         ui->checkBoxShowImageActor->setCheckState(Qt::Unchecked);
90     }
91 }
92
93 void QtVTKViewerWidget::on_horizontalSliderX_valueChanged(int value)
94 {
95
96     ui->lineEditX->setText(QString::number(value));
97     ui->_qtvtkviewer->setSliceXImageActor(value);
98
99 }
100
101 void QtVTKViewerWidget::on_horizontalSliderY_valueChanged(int value)
102 {
103     ui->lineEditY->setText(QString::number(value));
104     ui->_qtvtkviewer->setSliceYImageActor(value);
105 }
106
107 void QtVTKViewerWidget::on_horizontalSliderZ_valueChanged(int value)
108 {
109     ui->lineEditZ->setText(QString::number(value));
110     ui->_qtvtkviewer->setSliceZImageActor(value);
111 }