anatomist  5.1.2
3D neuroimaging data viewer
Anatomist.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 ANATOMIST_APPLICATION_ANATOMIST
36 #define ANATOMIST_APPLICATION_ANATOMIST
37 
39 #include <aims/getopt/getopt2.h>
40 #include <qwidget.h>
41 #include <set>
42 #include <map>
43 
44 class ReferentialWindow;
45 class ControlWindow;
46 
47 
48 namespace anatomist
49 {
50 
51  class AObject;
52  class MObject;
53  class PaletteList;
54  class Transformation;
55  class AWindow;
56  class Referential;
57  class GlobalConfiguration;
58  class CommandWriter;
59 
60  namespace internal
61  {
62  class AnatomistPrivate;
63  }
64 
72  {
73 
74  public:
75  enum Cursor
76  {
78  Working
79  };
80 
81  Anatomist( int argc, const char **argv,
82  const std::string &documentation );
83  virtual ~Anatomist();
84 
85  virtual void initialize();
87  static std::string versionString();
89  static std::string libraryVersionString();
90 
92  const PaletteList & palettes() const;
93 
94  virtual void Refresh();
95 
98 
99  virtual void createControlWindow();
102  QWidget* getQWidgetAncestor() const;
103 
105  virtual void createReferentialWindow();
107 
108  bool hasWindow( const AWindow* win ) const;
110  int groupWindows( std::set<AWindow*> & winL, int groupnum = -1 );
112  void ungroupWindows( int group );
114  std::set<AWindow*> getWindowsInGroup( int group );
116 
122  int destroyObject( AObject*, bool verbose = true );
126  std::set<AObject *> destroyObjects( const std::set<AObject* > &,
127  bool verbose = true );
128  bool hasObject( const AObject* obj ) const;
130  void mapObject( AObject* obj );
132  void unmapObject( AObject* obj );
133 
134  virtual void UpdateInterface();
135 
137  std::string makeObjectName( const std::string & name );
138  std::set<AObject* > getObjects() const;
139  std::set<AWindow*> getWindows() const;
140  const std::set<Referential*> & getReferentials() const;
141  bool hasReferential( const Referential * );
143  const Referential* );
145  const Referential* ) const;
146 
147  std::list<AObject *> loadObject( const std::string & filename,
148  const std::string & objname = "",
149  carto::Object options = carto::none() );
150 
151  void registerObject( AObject* obj, int inctrl=1 );
152  void unregisterObject( AObject* obj );
158  void releaseObject( AObject* obj );
160  void takeObjectRef( AObject* obj );
162  void registerSubObject( MObject* parent, AObject* obj );
165  void registerWindow( AWindow* win );
166  void unregisterWindow( AWindow* win );
172  void releaseWindow( AWindow* win );
174  void takeWindowRef( AWindow* obj );
175  void registerObjectName( const std::string& name, AObject* obj );
176  void unregisterObjectName( const std::string& name );
177 
178  bool initialized() const;
179 
180  const CommandWriter & historyWriter() const;
183 
185  void setCursor( Cursor c );
186 
187  const std::string & objectsFileFilter() const;
188  void addObjectsFileFilter( const std::string & filter );
189 
190  virtual bool glMakeCurrent();
192  std::string language() const;
200  int userLevel() const;
201  void setUserLevel( int );
202  void setLastPosition( const Point3df & pos, Referential * fromref = 0 );
203  void setLastPosition( const std::vector<float> & pos,
204  Referential * fromref = 0 );
205  Point3df lastPosition( const Referential* toref = 0 ) const;
206  std::vector<float> lastFullPosition( const Referential* toref = 0 ) const;
208  bool destroying() const;
212  void lockObjects( bool locked=true );
213 
214  private:
215  // friend ~ReferentialWindow would be enough but needs to include its .h
216  friend class ::ReferentialWindow;
217  friend class anatomist::internal::AnatomistPrivate;
218  struct Anatomist_privateData;
219 
220  void unregisterReferentialWindow();
221 
222  Anatomist_privateData *_privData;
223  };
224 
225 }
226 
227 
230 
231 
232 #endif
anatomist::Anatomist *ANATOMIST_API theAnatomist
Pointer to the Anatomist application.
#define ANATOMIST_API
The ControlWindow class is the Anatomist control window.
Definition: wControl.h:61
Window displaying referentials and transformations between them.
Definition: wReferential.h:56
Base Anatomist object (abstract)
Definition: Object.h:96
Abstract base class Anatomist window.
Definition: Window.h:58
The Anatomist class holds information about all data handled by Anatomist: the objects,...
Definition: Anatomist.h:72
std::set< AWindow * > getWindows() const
int groupWindows(std::set< AWindow * > &winL, int groupnum=-1)
Links the given windows, and returns the new group number.
void unregisterObjectName(const std::string &name)
void registerReferential(Referential *ref)
Point3df lastPosition(const Referential *toref=0) const
void registerSubObject(MObject *parent, AObject *obj)
ControlWindow * getControlWindow() const
virtual bool glMakeCurrent()
bool hasReferential(const Referential *)
Transformation * getTransformation(const Referential *, const Referential *)
std::string makeObjectName(const std::string &name)
Builds a unique object name.
void registerObject(AObject *obj, int inctrl=1)
void NotifyWindowChange(AWindow *win)
bool hasObject(const AObject *obj) const
const std::set< Referential * > & getReferentials() const
void NotifyMapWindow(AWindow *)
CommandWriter & historyWriter()
void unmapObject(AObject *obj)
Makes an object unvisible (ie not seen in control window(s))
void lockObjects(bool locked=true)
lock / unlock the objects list mutex, used in threaded load operations
void NotifyObjectChange(AObject *obj)
const CommandWriter & historyWriter() const
virtual void Refresh()
std::string language() const
const PaletteList & palettes() const
int userLevel() const
The user level drives the GUI to show or hide some features for simplicity or richness.
bool destroying() const
returns true if the Anatomist application is currently being destroyed
void registerObjectName(const std::string &name, AObject *obj)
void releaseWindow(AWindow *win)
releases the reference counter kept in Anatomist application for the given window,...
const std::string & objectsFileFilter() const
const Transformation * getTransformation(const Referential *, const Referential *) const
static std::string versionString()
full version ("1.30.3" or "1.31beta")
void unregisterObject(AObject *obj)
void takeObjectRef(AObject *obj)
change object reference type to WeakShared (standard in anatomist)
ReferentialWindow * getReferentialWindow() const
void setCursor(Cursor c)
Sets the shape of the mouse cursor on every window.
PaletteList & palettes()
void takeWindowRef(AWindow *obj)
change window reference type to WeakShared (standard in anatomist)
void registerWindow(AWindow *win)
std::set< AObject * > getObjects() const
void addObjectsFileFilter(const std::string &filter)
void ungroupWindows(int group)
Unlinks the windows with the given group number.
virtual void createControlWindow()
bool hasWindow(const AWindow *win) const
virtual void initialize()
QWidget * getQWidgetAncestor() const
Gets an empty QWidget that is created in Anatomist application to become a default parent for all Ana...
void updateFileDialogObjectsFilter()
setup/update extensions list for readable files
Referential * centralReferential() const
void releaseObject(AObject *obj)
releases the reference counter kept in Anatomist application for the given object,...
void mapObject(AObject *obj)
Makes an object visible (ie seen in control window(s))
void setLastPosition(const Point3df &pos, Referential *fromref=0)
int destroyObject(AObject *, bool verbose=true)
Destroys an object if possible.
void unregisterWindow(AWindow *win)
static std::string libraryVersionString()
shorter version matching the library number (2 numbers: "1.31")
void unregisterReferential(Referential *ref)
std::list< AObject * > loadObject(const std::string &filename, const std::string &objname="", carto::Object options=carto::none())
Anatomist(int argc, const char **argv, const std::string &documentation)
virtual void UpdateInterface()
void NotifyUnmapWindow(AWindow *)
std::set< AWindow * > getWindowsInGroup(int group)
Retruns the set of windows in a given group.
virtual void createReferentialWindow()
Create the referential window and update it.
GlobalConfiguration * config()
std::vector< float > lastFullPosition(const Referential *toref=0) const
void setLastPosition(const std::vector< float > &pos, Referential *fromref=0)
bool initialized() const
std::set< AObject * > destroyObjects(const std::set< AObject * > &, bool verbose=true)
Destroys an object if possible.
CommandWriter is a helper class logging commands into a history file.
Definition: Writer.h:62
This class stores global configuration settings, read by default from $HOME/.anatomist/config/setting...
Definition: globalConfig.h:53
Multi-object : base abstract class for objects that contain others.
Definition: MObject.h:235
Referential: marker for transformations, with an associated color.
Definition: Referential.h:55
Transformation between two referentials.
Object none()