GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoImageInfo.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __QGoImageInfo_h
36 #define __QGoImageInfo_h
37 
38 #include <QtCore/QVariant>
39 #include <QtGui/QAction>
40 #include <QtGui/QApplication>
41 #include <QtGui/QButtonGroup>
42 #include <QtGui/QGridLayout>
43 #include <QtGui/QHeaderView>
44 #include <QtGui/QLabel>
45 #include <QtGui/QScrollArea>
46 #include <QtGui/QWidget>
47 
48 #include "QGoGUILibConfigure.h"
49 
50 class QGOGUILIB_EXPORT QGoImageInfo:public QWidget
51 {
52  Q_OBJECT
53 public:
54  explicit QGoImageInfo(QWidget *parent = 0);
55  virtual ~QGoImageInfo();
56 public slots:
57  void setDimension(const unsigned int &);
58 
59  void setNumberOfChannels(const unsigned int &);
60 
61  void setMemory(const unsigned long &);
62 
63  void setSize(const std::vector< unsigned int > &);
64 
65  void setSpacing(const std::vector< float > &);
66 
67  void setPixelPosition(const std::vector< unsigned int > &);
68 
69  void setWorldPosition(const std::vector< float > &);
70 
71  void setTimePoint(const float &);
72 
73  void setValue(const std::vector< float > &);
74 
75 protected:
80 
107 
108  unsigned int m_Dimension;
109  unsigned int m_Channel;
110  unsigned long m_Memory;
111 
112  std::vector< unsigned int > m_Size;
113  std::vector< float > m_Spacing;
114  std::vector< unsigned int > m_PPos;
115  std::vector< float > m_WPos;
116  std::vector< float > m_Value;
117  float m_TimePoint;
118 
119  template< class TContainer >
120  QString ConvertToQString(const TContainer & iVector)
121  {
122  if ( iVector.empty() )
123  {
124  return QString();
125  }
126  else
127  {
128  size_t tsize = iVector.size();
129 
130  if ( tsize == 1 )
131  {
132  return QString("%1").arg( *iVector.begin() );
133  }
134  else
135  {
136  QString v("[ ");
137  unsigned int i = 0;
138  for ( typename TContainer::const_iterator it = iVector.begin();
139  it != iVector.end();
140  ++it, ++i )
141  {
142  if ( i == ( tsize - 1 ) )
143  {
144  v.append( QString("%1 ]").arg(*it) );
145  }
146  else
147  {
148  v.append( QString("%1 ; ").arg(*it) );
149  }
150  }
151  return v;
152  }
153  }
154  }
155 
156  void setupUi(QWidget *Form);
157 
158  void retranslateUi(QWidget *Form);
159 
160 private:
161  QGoImageInfo(const QGoImageInfo &);
162  void operator=(const QGoImageInfo &);
163 };
164 
165 #endif
QLabel * TPositionStaticLabel
Definition: QGoImageInfo.h:103
QLabel * ValueStaticLabel
Definition: QGoImageInfo.h:96
QString & append(QChar ch)
void setupUi(QWidget *widget)
QGridLayout * gridLayout
Definition: QGoImageInfo.h:79
QLabel * ChannelLabel
Definition: QGoImageInfo.h:86
QLabel * TImageStaticlabel
Definition: QGoImageInfo.h:81
QLabel * SizeStaticLabel
Definition: QGoImageInfo.h:98
QLabel * ValueLabel
Definition: QGoImageInfo.h:97
QLabel * DimensionStaticLabel
Definition: QGoImageInfo.h:83
QLabel * MemoryLabel
Definition: QGoImageInfo.h:105
unsigned int m_Dimension
Definition: QGoImageInfo.h:108
QLabel * TValueStaticLabel
Definition: QGoImageInfo.h:94
QLabel * SpacingStaticLabel
Definition: QGoImageInfo.h:87
QLabel * TPositionLabel
Definition: QGoImageInfo.h:102
unsigned int m_Channel
Definition: QGoImageInfo.h:109
QVBoxLayout * verticalLayout
Definition: QGoImageInfo.h:76
QLabel * TimeLabel
Definition: QGoImageInfo.h:101
QString ConvertToQString(const TContainer &iVector)
Definition: QGoImageInfo.h:120
std::vector< float > m_Spacing
Definition: QGoImageInfo.h:113
QLabel * ChannelStaticLabel
Definition: QGoImageInfo.h:85
QLabel * SizeLabel
Definition: QGoImageInfo.h:99
unsigned long m_Memory
Definition: QGoImageInfo.h:110
QLabel * PPositionLabel
Definition: QGoImageInfo.h:89
QLabel * DimensionLabel
Definition: QGoImageInfo.h:84
QLabel * PPositionStaticLabel
Definition: QGoImageInfo.h:106
QLabel * TImageLabel
Definition: QGoImageInfo.h:82
QLabel * TimeStaticLabel
Definition: QGoImageInfo.h:100
QLabel * TTimeLabel
Definition: QGoImageInfo.h:93
QLabel * SpacingLabel
Definition: QGoImageInfo.h:88
QLabel * WPositionLabel
Definition: QGoImageInfo.h:91
QLabel * WPositionStaticLabel
Definition: QGoImageInfo.h:90
std::vector< unsigned int > m_PPos
Definition: QGoImageInfo.h:114
QLabel * TValueLabel
Definition: QGoImageInfo.h:95
std::vector< float > m_Value
Definition: QGoImageInfo.h:116
QWidget * scrollAreaWidgetContents
Definition: QGoImageInfo.h:78
std::vector< float > m_WPos
Definition: QGoImageInfo.h:115
QScrollArea * scrollArea
Definition: QGoImageInfo.h:77
std::vector< unsigned int > m_Size
Definition: QGoImageInfo.h:112
float m_TimePoint
Definition: QGoImageInfo.h:117
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QLabel * MemoryStaticLabel
Definition: QGoImageInfo.h:104
QLabel * TTimeStaticLabel
Definition: QGoImageInfo.h:92