]> Creatis software - clitk.git/blob - vv/vvInfoPanel.cxx
Initial revision
[clitk.git] / vv / vvInfoPanel.cxx
1 /*=========================================================================
2
3  Program:   vv
4  Module:    $RCSfile: vvInfoPanel.cxx,v $
5  Language:  C++
6  Date:      $Date: 2010/01/06 13:31:57 $
7  Version:   $Revision: 1.1 $
8  Author :   Pierre Seroul (pierre.seroul@gmail.com)
9
10 Copyright (C) 2008
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS-LRMN http://www.creatis.insa-lyon.fr
13
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
26 =========================================================================*/
27 #include <QtGui>
28 #include <Qt>
29
30 #include "vvInfoPanel.h"
31
32 void vvInfoPanel::setFileName(QString text)
33 {
34     if (text.size() > 30)
35         imageLabel->setText("..." + text.right(27));
36     else
37         imageLabel->setText(text);
38 }
39
40 void vvInfoPanel::setDimension(QString text)
41 {
42     dimensionLabel->setText(text);
43 }
44
45 void vvInfoPanel::setSizeMM(QString text)
46 {
47     sizeMMLabel->setText(text);
48 }
49
50 void vvInfoPanel::setNPixel(QString text)
51 {
52     nPixelLabel->setText(text);
53 }
54
55 void vvInfoPanel::setSizePixel(QString text)
56 {
57     sizePixelLabel->setText(text);
58 }
59
60 void vvInfoPanel::setOrigin(QString text)
61 {
62     originLabel->setText(text);
63 }
64
65 void vvInfoPanel::setSpacing(QString text)
66 {
67     spacingLabel->setText(text);
68 }
69
70 void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value)
71 {
72     QString world = "";
73     QString mouse = "";
74     QString val = "";
75     if (visibility)
76     {
77         world += QString::number(x,'f',1) + " ";
78         world += QString::number(y,'f',1) + " ";
79         world += QString::number(z,'f',1) + " ";
80
81         mouse += QString::number(X,'f',1) + " ";
82         mouse += QString::number(Y,'f',1) + " ";
83         mouse += QString::number(Z,'f',1) + " ";
84
85         val += QString::number(value);
86     }
87     worldPosLabel->setText(world);
88     pixelPosLabel->setText(mouse);
89     valueLabel->setText(val);
90 }
91
92
93 void vvInfoPanel::setViews(int window, int view, int slice)
94 {
95     QString viewString;
96     switch (view)
97     {
98     case 0:
99     {
100         viewString = "Sagital,  ";
101         break;
102     }
103     case 1:
104     {
105         viewString = "Coronal, ";
106         break;
107     }
108     case 2:
109     {
110         viewString = "Axial,   ";
111         break;
112     }
113     }
114
115     QString text = viewString;
116     if (view != -1)
117     {
118         text += "current slice : ";
119         text += QString::number(slice);
120     }
121     else
122     {
123         text = "Disable";
124     }
125
126     switch (window)
127     {
128     case 0:
129     {
130         ULLabel->setText(text);
131         break;
132     }
133     case 1:
134     {
135         URLabel->setText(text);
136         break;
137     }
138     case 2:
139     {
140         DLLabel->setText(text);
141         break;
142     }
143     case 3:
144     {
145         DRLabel->setText(text);
146         break;
147     }
148     }
149 }