anatomist 6.0.4
3D neuroimaging data viewer
window3D.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 ANA_WINDOW3D_WINDOW3D_H
36#define ANA_WINDOW3D_WINDOW3D_H
37
38
44
45
46namespace aims
47{
48 class Quaternion;
49}
50
51namespace anatomist
52{
53 class Light;
54 class GLWidgetManager;
56
57 namespace internal
58 {
59 class AGraphicsView;
60 }
61
62}
63
64#ifdef ANA_USE_QOPENGLWIDGET
65class QOpenGLWidget;
66#else
67class QGLWidget;
68#endif
69class QSlider;
70
71
75{
76 Q_OBJECT
77
78public:
87
96
103
106 {
107 public:
111 AWindow3D *window() { return _window; }
112
113 private:
114 AWindow3D *_window;
115 };
116
117
118 AWindow3D( ViewType t = Oblique, QWidget* parent = 0,
119 carto::Object params = carto::none(),
120 Qt::WindowFlags f = Qt::WindowFlags() );
121 virtual ~AWindow3D();
122
124 virtual Type type() const;
125 virtual SubType subtype() const;
127 bool temporaryObject = false,
128 int position = -1 );
130 virtual bool positionFromCursor( int x, int y, Point3df & pos );
134 virtual std::list<anatomist::AObject*> *objectsAtCursorPosition( int x, int y, int tolerenceRadius );
136 virtual int polygonAtCursorPosition( int x, int y,const anatomist::AObject* obj );
137
140 const anatomist::ViewState & vs, int poly,
141 const anatomist::GLComponent* glc,
142 const Point3df & position, Point3df & positionNearestVertex );
143 void getInfos3DFromClickPoint( int x, int y, Point3df & position, int *poly,
144 anatomist::AObject *objselect, std::string & objtype,
145 std::vector<float> &texvalue, std::string & textype,
146 Point3df & positionNearestVertex, int* indexNearestVertex,
147 std::vector<std::string> & texlabels );
153 void getInfos3DFromPosition( const std::vector<float> & position, int poly,
154 anatomist::AObject *objselect, std::string & objtype,
155 std::vector<float> &texvalue, std::string & textype,
156 Point3df & positionNearestVertex, int* indexNearestVertex,
157 std::vector<std::string> & texlabels );
158
163
165 const std::vector<std::string> & constraintList, int constraintType,
166 anatomist::AObject *texConstraint );
167 std::vector<std::string> getConstraintList();
168 int getConstraintType() const;
170
172 void displayInfoAtClickPosition( int x, int y );
173 std::string displayInfoAtClickPositionAsText( int x, int y,
174 bool html = false );
175 virtual void displayClickPoint();
177 void setViewPoint( float *quaternion,
178 const float zoom );
182 void setOrientationCube( bool state );
183 bool hasOrientationCube() const;
185 void setBoundingFrame( bool state );
186 bool hasBoundingFrame() const;
190
191 virtual const std::set<unsigned> & typeCount() const;
192 virtual std::set<unsigned> & typeCount();
193 virtual const std::string & baseTitle() const;
194 virtual void setPosition( const Point3df& position,
195 const anatomist::Referential* orgref );
196 virtual void setPosition( const std::vector<float> & position,
197 const anatomist::Referential* orgref );
198 virtual void updateWindowGeometry();
199
200 static anatomist::Geometry
202 & objects,
203 const aims::Quaternion & slicequat,
204 const anatomist::Referential *wref = 0,
205#ifdef ANA_USE_QOPENGLWIDGET
206 QOpenGLWidget* glw = 0, bool with3d = false );
207#else
208 QGLWidget* glw = 0, bool with3d = false );
209#endif
210
212 virtual const anatomist::View* view() const;
213
215 virtual void setViewType( ViewType t );
217 bool isViewOblique() const;
218
219 bool perspectiveEnabled() const;
220 void enablePerspective( bool );
221
224 void setSliceOrientation( const Point3df & normal );
226 void resizeView( int w, int h );
228 bool boundingBox( std::vector<float> & bmin,
229 std::vector<float> & bmax ) const;
232 float clipDistance() const;
233 void setClipDistance( float d );
235 void enableTransparentZ( bool );
236 bool cullingEnabled() const;
237 void setCulling( bool );
238 bool flatShading() const;
239 void setFlatShading( bool );
240 bool smoothing() const;
241 void setSmoothing( bool );
242 void setFog( bool );
243 bool fog() const;
245 virtual void update( const Observable* obs, void * );
252 virtual void showToolBars( int state = 2 );
253 virtual void showStatusBar( int state = 2 );
254
255 typedef anatomist::GLWidgetManager* (*GLWidgetCreator)
256 ( anatomist::AWindow* win, QWidget* parent, const char* name,
257#ifdef ANA_USE_QOPENGLWIDGET
258 const QOpenGLWidget * shareWidget, Qt::WindowFlags f );
259#else
260 const QGLWidget * shareWidget, Qt::WindowFlags f );
261#endif
264
265 QSlider* getSliceSlider (void) const;
266
281 std::list<anatomist::AObject *>::iterator processRenderingOrder(
282 std::list<anatomist::AObject *> & opaque ) const;
283
289 virtual void sortPolygons( bool force = false );
290 bool positionToVertex( const anatomist::AObject* obj, unsigned vert );
291 bool positionToPolygon( const anatomist::AObject* obj, unsigned poly );
292 bool positionToTexture( const anatomist::AObject* obj, float texval );
293
294
295signals:
296 void refreshed();
297 void sliderChanged( int dim, int slice );
299
300public slots:
301 virtual void polish();
303 void changeSlice( int );
304 void changeTime( int );
305 void changeTimeSliders( int, int );
307 void muteAxial();
311 void mute3D();
312 void lightView();
314 void tools();
315 void syncViews( bool keepextrema = false );
316 void focusView();
318 //void painttoolsWinDestroyed();
321 virtual void Refresh();
323 virtual void refreshNow();
333 void askZoom();
334 // Gets the window zoom factor
335 float getZoom() const;
336
337 // Necessary for the movie action
340
343
344 void setSliceSliderPosition( int position ) ;
345 void setTimeSliderPosition( int position ) ;
351 bool toopTipsEnabled() const;
352 void enableToolTips( bool );
353 // Refreshs the window when resized
354 void resizeEvent( QResizeEvent * ) ;
355
359 QImage snapshotImage( int width=0, int height=0, int bufmode=0 );
362
364
365protected slots:
369
370
371protected:
373
374 // Updates left/right annotations
376
378 void displayClickPos( Point3df clickPos );
379 void setupTimeSlider( const std::vector<float> & bmin,
380 const std::vector<float> & bmax );
381 void setupSliceSlider( float mins, float maxs );
405 bool inAutoFusion( const anatomist::AObject *obj ) const;
407
409 static std::set<unsigned> _count3d;
410 static std::string _baseTitle;
411
412public :
414 const anatomist::AObject *selectedobject = 0 );
415
416private:
417 struct Private;
418
419 Private *d;
420};
421
422
423#endif
#define slots
Functions that can modify on-the-fly display primitives of an object.
Definition window3D.h:106
ObjectModifier(AWindow3D *w)
virtual void modify(anatomist::AObject *, anatomist::GLPrimitives &)=0
virtual void showToolBars(int state=2)
Shows or hides all tools (menu, toolbars) around the main view area.
void showReferential()
const aims::Quaternion & sliceQuaternion() const
void pointsOfView()
void setVisibleSurfpaint(bool b)
bool isViewOblique() const
void refreshTemp()
Redraws temporary objects only.
void muteOblique()
static void setGLWidgetCreator(GLWidgetCreator)
hook to create inherited QAGLWidgets (Vtk-enabled for instance)
void updateTimeSliders()
void setFlatShading(bool)
void sliderChanged(int dim, int slice)
virtual const std::set< unsigned > & typeCount() const
void tools()
virtual const anatomist::View * view() const
bool smoothing() const
float clipDistance() const
void setClipMode(ClipMode m)
int getSliceSliderPosition()
void openStereoView()
ViewType viewType() const
void setOrientationCube(bool state)
Compass handling methods.
void muteCoronal()
void syncViews(bool keepextrema=false)
void askZoom()
anatomist::AObject * getConstraintTexture()
void freeResize()
void registerObjectModifier(ObjectModifier *mod)
Allows changing display lists from normal objects DLists.
void findPrimitive()
bool cullingEnabled() const
virtual void unregisterObject(anatomist::AObject *obj)
bool hasBoundingFrame() const
bool constraintEditorIsActive()
void enablePerspective(bool)
void setRenderingMode(RenderingMode mode)
Rendering mode (normal, wireframe, fast)
void renderSelectionBuffer(anatomist::ViewState::glSelectRenderMode mode, const anatomist::AObject *selectedobject=0)
QImage snapshotImage(int width=0, int height=0, int bufmode=0)
Get a snapshot of the window, after a refresh if needed.
void lightWinDestroyed()
void resizeView()
virtual void registerObject(anatomist::AObject *obj, bool temporaryObject=false, int position=-1)
int getConstraintType() const
AWindow3D * rightEyeWindow()
void updateObject(anatomist::AObject *obj, anatomist::PrimList *pl=0, anatomist::ViewState::glSelectRenderMode selectmode=anatomist::ViewState::glSELECTRENDER_NONE)
bool surfpaintIsVisible()
int getSliceSliderMaxPosition()
virtual carto::rc_ptr< anatomist::ViewState > viewState(bool slice=false)
virtual void setPosition(const std::vector< float > &position, const anatomist::Referential *orgref)
void setFog(bool)
void muteSagittal()
bool fog() const
int getTimeSliderMaxPosition()
void enableToolTips(bool)
void changeTime(int)
virtual std::list< anatomist::AObject * > * objectsAtCursorPosition(int x, int y, int tolerenceRadius)
pick several objects at the cursor 2D position
void updateObject2D(anatomist::AObject *obj, anatomist::PrimList *pl=0, anatomist::ViewState::glSelectRenderMode selectmode=anatomist::ViewState::glSELECTRENDER_NONE)
virtual int polygonAtCursorPosition(int x, int y, const anatomist::AObject *obj)
pick a polygon on a selected object at the cursor 2D position
QSlider * getSliceSlider(void) const
bool hasOrientationCube() const
void setPolygonsSortingEnabled(bool)
virtual void Refresh()
void setActiveConstraintEditor(bool b)
static anatomist::Geometry setupWindowGeometry(const std::list< carto::shared_ptr< anatomist::AObject > > &objects, const aims::Quaternion &slicequat, const anatomist::Referential *wref=0, QGLWidget *glw=0, bool with3d=false)
void saveSnapshotWithCustomSize()
void switchToolbox()
virtual void polish()
AWindow3D * leftEyeWindow()
bool inAutoFusion(const anatomist::AObject *obj) const
void resizeEvent(QResizeEvent *)
void loadConstraintData(const std::vector< std::string > &constraintList, int constraintType, anatomist::AObject *texConstraint)
void lightView()
void unregisterObjectModifier(ObjectModifier *mod)
void renderAfter(anatomist::AObject *obj, anatomist::AObject *afterthis)
adds a rendering order constraint: obj will be rendered immediately after afterthis.
void printPositionAndValue()
virtual void sortPolygons(bool force=false)
AWindow3D(ViewType t=Oblique, QWidget *parent=0, carto::Object params=carto::none(), Qt::WindowFlags f=Qt::WindowFlags())
void getInfos3DFromClickPoint(int x, int y, Point3df &position, int *poly, anatomist::AObject *objselect, std::string &objtype, std::vector< float > &texvalue, std::string &textype, Point3df &positionNearestVertex, int *indexNearestVertex, std::vector< std::string > &texlabels)
virtual void setPosition(const Point3df &position, const anatomist::Referential *orgref)
Set position of cursor.
virtual void setReferential(anatomist::Referential *ref)
void setSmoothing(bool)
float getZoom() const
void toolsWinDestroyed()
void toggleStatusBarVisibility()
int computeNearestVertexFromPolygonPoint(const anatomist::ViewState &vs, int poly, const anatomist::GLComponent *glc, const Point3df &position, Point3df &positionNearestVertex)
print all infos about vertex picked on a polygon selected
void orientationChanged()
virtual SubType subtype() const
void setBoundingFrame(bool state)
Frame handling methods.
void muteAxial()
void setRightEyeWindow(AWindow3D *)
void saveObject()
int getTimeSliderPosition()
virtual void updateWindowGeometry()
adapts geometry to the current contents and referential
void saveSnapshot()
void changeTimeSliders(int, int)
void renderBefore(anatomist::AObject *obj, anatomist::AObject *beforethis)
adds a rendering order constraint: obj will be rendered immediately before beforethis.
void updateSaveButtonStatus()
virtual void setViewType(ViewType t)
Mute into a new view type (Axial, Sagittal, Coronal or Oblique)
bool toopTipsEnabled() const
void setPolygonsSortingDirection(bool dir)
void focusView()
void setTimeSliderPosition(int position)
void updateObject3D(anatomist::AObject *obj, anatomist::PrimList *pl=0, anatomist::ViewState::glSelectRenderMode selectmode=anatomist::ViewState::glSELECTRENDER_NONE)
virtual void update(const Observable *obs, void *)
static std::string _baseTitle
Definition window3D.h:410
anatomist::GLPrimitives cursorGLL() const
bool polygonsSortingEnabled() const
void setAutoRotationCenter()
void setViewPoint(float *quaternion, const float zoom)
set the view of the scene
ClipMode clipMode() const
virtual void showStatusBar(int state=2)
virtual std::set< unsigned > & typeCount()
std::string displayInfoAtClickPositionAsText(int x, int y, bool html=false)
void displayClickPos(Point3df clickPos)
Display the click point.
void getInfos3DFromPosition(const std::vector< float > &position, int poly, anatomist::AObject *objselect, std::string &objtype, std::vector< float > &texvalue, std::string &textype, Point3df &positionNearestVertex, int *indexNearestVertex, std::vector< std::string > &texlabels)
same as above but from a 3+D position.
bool linkedCursorOnSliderChange() const
virtual const std::string & baseTitle() const
anatomist::GLWidgetManager *(* GLWidgetCreator)(anatomist::AWindow *win, QWidget *parent, const char *name, const QGLWidget *shareWidget, Qt::WindowFlags f)
Definition window3D.h:256
void resizeView(int w, int h)
Tries to resize the viewing area to given size.
virtual Type type() const
Get the window type (2D, 3D or control)
virtual bool positionFromCursor(int x, int y, Point3df &pos)
Translates mouse position to Anatomist geometry position.
std::list< anatomist::AObject * >::iterator processRenderingOrder(std::list< anatomist::AObject * > &opaque) const
calculates the objects rendering order, according to various constraints (opaque/transparent,...
void setClipDistance(float d)
void setCulling(bool)
void setLinkedCursorPos()
void setSliceQuaternion(const aims::Quaternion &q)
void refreshTempNow()
virtual anatomist::View * view()
bool perspectiveEnabled() const
void mute3D()
bool positionToVertex(const anatomist::AObject *obj, unsigned vert)
void setupTimeSlider(const std::vector< float > &bmin, const std::vector< float > &bmax)
void setSliceSliderPosition(int position)
void refreshed()
void setLeftEyeWindow(AWindow3D *)
void displayInfoAtClickPosition(int x, int y)
bool flatShading() const
void setLinkedCursorOnSliderChange(bool x)
void setupSliceSlider(float mins, float maxs)
void enableTransparentZ(bool)
void changeSlice(int)
bool boundingBox(std::vector< float > &bmin, std::vector< float > &bmax) const
Get bounding box in N-dimension mode (new in anatomist 4.6)
anatomist::Light * light()
int updateSliceSlider()
RenderingMode renderingMode() const
void updateViewTypeToolBar()
virtual anatomist::AObject * objectAtCursorPosition(int x, int y)
pick the object at the cursor 2D position
virtual void refreshNow()
Refresh the window (redraw the contained objects).
bool positionToPolygon(const anatomist::AObject *obj, unsigned poly)
void refreshLightViewNow()
@ Wireframe
Definition window3D.h:91
@ HiddenWireframe
Definition window3D.h:93
virtual ~AWindow3D()
std::vector< std::string > getConstraintList()
void updateLeftRightAnnotations()
void setLight(const anatomist::Light &light)
bool positionToTexture(const anatomist::AObject *obj, float texval)
bool transparentZEnabled() const
void changeReferential()
void setSliceOrientation(const Point3df &normal)
void povWinDestroyed()
void refreshLightView()
Only redraws existing objects (in most cases, just calls existing OpenGL lists, except for observer-d...
void setupSliceSlider()
virtual void displayClickPoint()
bool polygonsSortingDirection() const
returns false for back-to-front, true for front-to-back
void removeFromAutoFusion2D(anatomist::AObject *obj)
delete or modify the auto Fusion2D object when removing an object
bool autoFusion2D(anatomist::AObject *obj)
build or modify the auto Fusion2D object when adding a new object.
static std::set< unsigned > _count3d
3D windows static counter
Definition window3D.h:409
ControlledWindow(QWidget *parent=0, const char *name=0, carto::Object options=carto::none(), Qt::WindowFlags f=Qt::WindowFlags())
Base Anatomist object (abstract)
Definition Object.h:97
Abstract base class Anatomist window.
Definition Window.h:59
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition glcomponent.h:67
Base class for OpenGL-rendering widget.
Light used for OpenGL in 3D windows.
Definition Light.h:48
friend class Observable
Definition Observer.h:90
Referential: marker for transformations, with an associated color.
Definition Referential.h:56
see http://doc.qt.digia.com/qq/qq26-openglcanvas.html
friend friend class ref
std::list< carto::rc_ptr< GLItem > > PrimList
Definition Object.h:74
std::list< RefGLItem > GLPrimitives
Definition primitive.h:156
Object none()
ViewState holds information about how a view wants to see an object.
Definition viewstate.h:67
@ glSELECTRENDER_NONE
no selection
Definition viewstate.h:71
AimsVector< float, 3 > Point3df