]> Creatis software - clitk.git/blob - vv/vvInfoPanel.cxx
Reformatted using new coding style
[clitk.git] / vv / vvInfoPanel.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #include <QtGui>
19 #include <Qt>
20
21 #include "vvInfoPanel.h"
22
23 void vvInfoPanel::setFileName(QString text)
24 {
25   if (text.size() > 30)
26     imageLabel->setText("..." + text.right(27));
27   else
28     imageLabel->setText(text);
29 }
30
31 void vvInfoPanel::setDimension(QString text)
32 {
33   dimensionLabel->setText(text);
34 }
35
36 void vvInfoPanel::setSizeMM(QString text)
37 {
38   sizeMMLabel->setText(text);
39 }
40
41 void vvInfoPanel::setNPixel(QString text)
42 {
43   nPixelLabel->setText(text);
44 }
45
46 void vvInfoPanel::setSizePixel(QString text)
47 {
48   sizePixelLabel->setText(text);
49 }
50
51 void vvInfoPanel::setOrigin(QString text)
52 {
53   originLabel->setText(text);
54 }
55
56 void vvInfoPanel::setSpacing(QString text)
57 {
58   spacingLabel->setText(text);
59 }
60
61 void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value)
62 {
63   QString world = "";
64   QString mouse = "";
65   QString val = "";
66   if (visibility) {
67     world += QString::number(x,'f',1) + " ";
68     world += QString::number(y,'f',1) + " ";
69     world += QString::number(z,'f',1) + " ";
70
71     mouse += QString::number(X,'f',1) + " ";
72     mouse += QString::number(Y,'f',1) + " ";
73     mouse += QString::number(Z,'f',1) + " ";
74
75     val += QString::number(value);
76   }
77   worldPosLabel->setText(world);
78   pixelPosLabel->setText(mouse);
79   valueLabel->setText(val);
80 }
81
82
83 void vvInfoPanel::setViews(int window, int view, int slice)
84 {
85   QString viewString;
86   switch (view) {
87   case 0: {
88     viewString = "Sagital,  ";
89     break;
90   }
91   case 1: {
92     viewString = "Coronal, ";
93     break;
94   }
95   case 2: {
96     viewString = "Axial,   ";
97     break;
98   }
99   }
100
101   QString text = viewString;
102   if (view != -1) {
103     text += "current slice : ";
104     text += QString::number(slice);
105   } else {
106     text = "Disable";
107   }
108
109   switch (window) {
110   case 0: {
111     ULLabel->setText(text);
112     break;
113   }
114   case 1: {
115     URLabel->setText(text);
116     break;
117   }
118   case 2: {
119     DLLabel->setText(text);
120     break;
121   }
122   case 3: {
123     DRLabel->setText(text);
124     break;
125   }
126   }
127 }