anatomist  5.0.5
3D neuroimaging data viewer
qwObjPalette.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANAQT_COLOR_QWOBJPALETTE_H
36 #define ANAQT_COLOR_QWOBJPALETTE_H
37 
38 
40 #include <cartobase/smart/rcptr.h>
41 #include <qwidget.h>
42 #include <qaction.h>
43 
44 class QListWidgetItem;
45 
46 namespace anatomist
47 {
48  class AObjectPalette;
49  class APalette;
50  class APaletteExtensionAction;
51 }
52 
53 
54 class QAPaletteWin : public QWidget, public anatomist::APaletteWin
55 {
56  Q_OBJECT
57 
58 public:
59  QAPaletteWin( const std::set<anatomist::AObject *> & obj );
60  virtual ~QAPaletteWin();
61 
62  virtual void update( const anatomist::Observable* obs, void* arg );
63 
64  static anatomist::APaletteWin*
65  createPalWin( const std::set<anatomist::AObject* > & obj );
71  static void addExtensionAction( anatomist::APaletteExtensionAction* action );
72 
73 signals:
74 
75 protected slots:
76  void palette1Changed();
77  void palette2Changed( const QString & );
78  void min1Changed( int value );
79  void max1Changed( int value );
80  void min2Changed( int value );
81  void max2Changed( int value );
82  void responsiveToggled( bool val );
83  void updateClicked();
84  void dimChanged( int );
85  void mixMethodChanged( const QString & );
86  void palette1DMappingMethodChanged( const QString & );
87  void enablePalette2( bool );
88  void mixFactorChanged( int );
89  void min1EditChanged();
90  void max1EditChanged();
91  void min2EditChanged();
92  void max2EditChanged();
93  void resetValues1();
94  void resetValues2();
95  void resetBounds1();
96  void resetBounds2();
97  void chooseObject();
98  void objectsChosen( const std::set<anatomist::AObject *> & );
99  void extensionActionTriggered( QAction* action );
100  void zeroCentered1Changed( int state );
101  void zeroCentered2Changed( int state );
102 
103 
104 protected:
105  struct DimBox;
106 
107  virtual void closeEvent( QCloseEvent* );
108  void updateInterface();
109 
110  virtual void unregisterObservable( anatomist::Observable* );
111 
112  void fillPalettes();
113  void fillPalette1();
114  void fillPalette2();
115  void fillPalette( const carto::rc_ptr<anatomist::APalette> pal,
116  QPixmap & pix );
117  void fillObjPal();
118  anatomist::AObjectPalette* objPalette();
119  virtual QWidget* makeDimBox( const QString & title, QWidget* parent,
120  DimBox* dbox );
121  virtual void setValues( DimBox* dimBox, float min, float max,
122  float objMin, float objMax );
123  virtual void setValues1();
124  virtual void setValues2();
125  virtual void updateObjects();
126  virtual void updateObjPal();
127  void fillMixMethods();
128  void fillPalette1DMappingMethods() ;
129  void fillPalette2List();
130  void runCommand();
131  void fillToolBar();
132 
133 private:
134  struct Private;
135  Private *d;
136 };
137 
138 
139 namespace anatomist
140 {
141 
142  class APaletteExtensionAction : public QAction
143  {
144  Q_OBJECT
145 
146  public:
147  friend class ::QAPaletteWin;
148 
149  APaletteExtensionAction( QObject* parent );
150  APaletteExtensionAction( const QString & text, QObject * parent );
151  APaletteExtensionAction( const QIcon & icon, const QString & text,
152  QObject * parent );
153  virtual ~APaletteExtensionAction();
154 
155  virtual void extensionTriggered(
156  const std::set<anatomist::AObject *> & ) = 0;
157  };
158 
159 
160  namespace internal
161  {
162 
163  // static class
164  class PaletteWinExtensionActions : public QObject
165  {
166  Q_OBJECT
167 
168  public:
169  virtual ~PaletteWinExtensionActions() { _instance() = 0; }
170 
171  static PaletteWinExtensionActions *instance();
172 
173  private:
174  PaletteWinExtensionActions( QObject * parent ) : QObject( parent ) {}
175  static PaletteWinExtensionActions *& _instance();
176  };
177 
178  }
179 
180 }
181 
182 #endif
T max(const Volume< T > &vol)
This class can be subclassed to represent an object that the programmer wants to have observed...
Definition: Observable.h:67
#define slots
T min(const Volume< T > &vol)
Object color palette window.
Definition: wObjPalette.h:48