]> Creatis software - clitk.git/blob - vv/vvInfoPanel.cxx
add memory usage info in panel (need libstatgrab)
[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 #include "clitkMemoryUsage.h"
23
24 //------------------------------------------------------------------------------
25 void vvInfoPanel::setFileName(QString text)
26 {
27   if (text.size() > 30)
28     imageLabel->setText("..." + text.right(27));
29   else
30     imageLabel->setText(text);
31 }
32 //------------------------------------------------------------------------------
33
34
35 //------------------------------------------------------------------------------
36 void vvInfoPanel::setDimension(QString text)
37 {
38   dimensionLabel->setText(text);
39 }
40 //------------------------------------------------------------------------------
41
42
43 //------------------------------------------------------------------------------
44 void vvInfoPanel::setSizeMM(QString text)
45 {
46   sizeMMLabel->setText(text);
47 }
48 //------------------------------------------------------------------------------
49
50
51 //------------------------------------------------------------------------------
52 void vvInfoPanel::setNPixel(QString text)
53 {
54   nPixelLabel->setText(text);
55 }
56 //------------------------------------------------------------------------------
57
58
59 //------------------------------------------------------------------------------
60 void vvInfoPanel::setSizePixel(QString text)
61 {
62   sizePixelLabel->setText(text);
63 }
64 //------------------------------------------------------------------------------
65
66
67 //------------------------------------------------------------------------------
68 void vvInfoPanel::setOrigin(QString text)
69 {
70   originLabel->setText(text);
71 }
72 //------------------------------------------------------------------------------
73
74
75 //------------------------------------------------------------------------------
76 void vvInfoPanel::setSpacing(QString text)
77 {
78   spacingLabel->setText(text);
79 }
80 //------------------------------------------------------------------------------
81
82
83 //------------------------------------------------------------------------------
84 void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value)
85 {
86   QString world = "";
87   QString mouse = "";
88   QString val = "";
89   if (visibility) {
90     world += QString::number(x,'f',1) + " ";
91     world += QString::number(y,'f',1) + " ";
92     world += QString::number(z,'f',1) + " ";
93
94     mouse += QString::number(X,'f',1) + " ";
95     mouse += QString::number(Y,'f',1) + " ";
96     mouse += QString::number(Z,'f',1) + " ";
97
98     val += QString::number(value);
99   }
100   worldPosLabel->setText(world);
101   pixelPosLabel->setText(mouse);
102   valueLabel->setText(val);
103 }
104 //------------------------------------------------------------------------------
105
106
107 //------------------------------------------------------------------------------
108 void vvInfoPanel::setViews(int window, int view, int slice)
109 {
110   QString viewString;
111   switch (view) {
112   case 0: {
113     viewString = "Sagital,  ";
114     break;
115   }
116   case 1: {
117     viewString = "Coronal, ";
118     break;
119   }
120   case 2: {
121     viewString = "Axial,   ";
122     break;
123   }
124   }
125
126   QString text = viewString;
127   if (view != -1) {
128     text += "current slice : ";
129     text += QString::number(slice);
130   } else {
131     text = "Disable";
132   }
133
134   switch (window) {
135   case 0: {
136     ULLabel->setText(text);
137     break;
138   }
139   case 1: {
140     URLabel->setText(text);
141     break;
142   }
143   case 2: {
144     DLLabel->setText(text);
145     break;
146   }
147   case 3: {
148     DRLabel->setText(text);
149     break;
150   }
151   }
152 }
153 //------------------------------------------------------------------------------
154
155
156 //------------------------------------------------------------------------------
157 void vvInfoPanel::setMemoryInMb(QString text)
158 {
159   memoryUsageLabel->setText("Memory usage: "+text);
160 }
161 //------------------------------------------------------------------------------
162