GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vtkViewImage2DCollection.h
Go to the documentation of this file.
1 /*========================================================================
2  Copyright (c) INRIA - ASCLEPIOS Project (http://www-sop.inria.fr/asclepios).
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  * Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  * Neither the name of INRIA or ASCLEPIOS, nor the names of any contributors
16  may be used to endorse or promote products derived from this software
17  without specific prior written permission.
18 
19  * Modified source versions must be plainly marked as such, and must not be
20  misrepresented as being the original software.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
23  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  =========================================================================*/
33 
34 /*=========================================================================
35  Modifications were made by the GoFigure Dev. Team.
36  while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
37 
38  Copyright (c) 2009-11, President and Fellows of Harvard College.
39  All rights reserved.
40 
41  Redistribution and use in source and binary forms, with or without
42  modification, are permitted provided that the following conditions are met:
43 
44  Redistributions of source code must retain the above copyright notice,
45  this list of conditions and the following disclaimer.
46  Redistributions in binary form must reproduce the above copyright notice,
47  this list of conditions and the following disclaimer in the documentation
48  and/or other materials provided with the distribution.
49  Neither the name of the President and Fellows of Harvard College
50  nor the names of its contributors may be used to endorse or promote
51  products derived from this software without specific prior written
52  permission.
53 
54  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
56  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
58  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
59  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
60  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
61  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
62  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
63  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
64  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 
66  =========================================================================*/
67 
68 #ifndef _vtkViewImage2DCollection_h_
69 #define _vtkViewImage2DCollection_h_
70 
71 #include "vtkCollection.h"
72 #include "vtkCommand.h"
73 
74 #include "vtkViewImage2D.h"
75 #include "MegaVTK2Configure.h"
76 
77 #include <vector>
78 
85 //BTX
86 #define vtkSyncSetMacro(name, type, base) \
87  virtual void SyncSet ## name (type _arg) \
88  { \
89  this->InitTraversal(); \
90  base *item = this->GetNextItem(); \
91  while ( item ) \
92  { \
93  item->Set ## name (_arg); \
94  item = this->GetNextItem(); \
95  } \
96  }
97 
100 #define vtkSyncSetObjectMacro(name, type, base) \
101  virtual void SyncSet ## name (type * _arg) \
102  { \
103  this->InitTraversal(); \
104  base *item = this->GetNextItem(); \
105  while ( item ) \
106  { \
107  item->Set ## name (_arg); \
108  item = this->GetNextItem(); \
109  } \
110  }
111 
113 
114 class vtkScalarBarActor;
115 class vtkLookupTable;
116 class vtkTextProperty;
117 class vtkCornerAnnotation;
119 class vtkPlane;
120 class vtkActor;
121 class vtkDataSet;
122 class vtkPolyData;
123 class vtkProperty;
124 class vtkDataSetCollection;
125 class vtkMatrixToLinearTransform;
127 
133 class VTK_RENDERINGADDON2_EXPORT vtkViewImage2DCollection:public vtkCollection
134 {
135 public:
136 
140  static vtkViewImage2DCollection * New();
141 
142  vtkTypeRevisionMacro(vtkViewImage2DCollection, vtkCollection);
143 
144  /*
145  * \bief Get the next vtkViewImage2D in the list. Return NULL when at the end of
146  * the list
147  * \return vtkViewImage2D pointer to the next vtkViewImage2D in the collection
148  */
150  {
151  return static_cast< vtkViewImage2D * >( this->GetNextItemAsObject() );
152  }
153 
154  /*
155  * \bief Get the next vtkViewImage2D2D in the list. Return NULL when at the end of
156  * the list
157  * \param[in] i index of the element we are looking for in the collection
158  * \return vtkViewImage2D pointer to the selected element
159  */
161  {
162  return static_cast< vtkViewImage2D * >( this->GetItemAsObject(i) );
163  }
164 
165  /*
166  * \bief Add an object to the list. Does not prevent duplicate entries.
167  * \param[in] vtkViewImage2D pointer to the element to be added in the collection
168  */
169  void AddItem(vtkViewImage2D *);
170 
171  /*
172  * \bief Replace the i'th item in the collection with another 2D image
173  * \param[in] i index of the element we want to remplace
174  * \param[in] vtkViewImage2D pointer to the element to be added in the collection
175  */
176  void ReplaceItem(int i, vtkViewImage2D *);
177 
178  /*
179  * \brief Remove the i'th item in the list.
180  * \param[in] i index of the element we want to removed
181  *
182  * Be careful if using this function during traversal of the list using
183  * GetNextItemAsObject (or GetNextItem in derived class). The list WILL
184  * be shortened if a valid index is given! If this->Current is equal to the
185  * element being removed, have it point to then next element in the list.
186  */
187  void RemoveItem(int i);
188 
189  /*
190  * \brief Remove an object from the list.
191  * \param[in] vtkViewImage2D pointer to the element to be removed
192  * Removes the first object found, not
193  * all occurrences. If no object found, list is unaffected. See warning
194  * in description of RemoveItem(int).
195  */
196  void RemoveItem(vtkViewImage2D *);
197 
198  /*
199  * \brief Remove all objects from the collection.
200  */
201  void RemoveAllItems();
202 
203  /*
204  * \brief Initialize the planes actors in all the views
205  */
206  void Initialize();
207 
208  /*
209  * \brief Initialize the the observers.
210  */
211  void InitializeAllObservers();
212 
213  /*
214  * \brief Get the callbacks associated to the collection
215  * \return vtkViewImage2DCollectionCommand pointer
216  */
217  vtkGetObjectMacro (Command, vtkViewImage2DCollectionCommand);
218 
219  /*
220  * \brief Get the ExtraRenderWindow associated to the collection (3D)
221  * \return vtkRenderWindow pointer to the ExtraRenderWindow
222  */
223  vtkGetObjectMacro (ExtraRenderWindow, vtkRenderWindow);
224 
225  /*
226  * \brief Add an extra window of a different type to the collection
227  * \param[in] wim Render Window associated to the extra window
228  */
229  void SetExtraRenderWindow(vtkRenderWindow *win)
230  { this->ExtraRenderWindow = win; }
231 
232  vtkSyncSetMacro (Slice, int, vtkViewImage2D);
233  vtkSyncSetMacro (SliceOrientation, int, vtkViewImage2D);
234  vtkSyncSetMacro (ShowAnnotations, bool, vtkViewImage2D);
235  vtkSyncSetMacro (ShowScalarBar, bool, vtkViewImage2D);
236 
237  vtkSyncSetMacro (ColorWindow, double, vtkViewImage2D);
238  vtkSyncSetMacro (ColorLevel, double, vtkViewImage2D);
239 
240  vtkSyncSetObjectMacro (OrientationMatrix, vtkMatrix4x4, vtkViewImage2D);
241  vtkSyncSetObjectMacro (LookupTable, vtkLookupTable, vtkViewImage2D);
242  vtkSyncSetObjectMacro (TextProperty, vtkTextProperty, vtkViewImage2D);
243  vtkSyncSetObjectMacro (Input, vtkImageData, vtkViewImage2D);
244  vtkSyncSetObjectMacro (InputConnection, vtkAlgorithmOutput, vtkViewImage2D);
245 
247  vtkSyncSetObjectMacro (Position, int, vtkViewImage2D);
248  vtkSyncSetObjectMacro (WorldCoordinates, double, vtkViewImage2D);
249 
251  vtkSyncSetMacro (Interpolate, int, vtkViewImage2D);
252 
254  virtual void SyncResetWindowLevel(void);
255 
256  void SyncUpdateWindowLevel(void);
257 
259  virtual void SyncResetCamera(void);
260 
262  virtual void SyncRender();
263 
266  virtual void SyncRender( vtkViewImage2D* iV );
267 
269  virtual void SyncReset(void);
270 
272  virtual void SyncStart(void);
273 
274  // Decide weither or not the collection will link interactions
275 
277  vtkGetMacro (LinkSliceMove, unsigned int);
279  virtual void SetLinkSliceMove(unsigned int v);
280 
282  vtkBooleanMacro (LinkSliceMove, unsigned int);
283 
285  vtkGetMacro (LinkColorWindowLevel, unsigned int);
287  virtual void SetLinkColorWindowLevel(unsigned int v);
288 
290  vtkBooleanMacro (LinkColorWindowLevel, unsigned int);
291 
293  vtkGetMacro (LinkResetWindowLevel, unsigned int);
295  virtual void SetLinkResetWindowLevel(unsigned int v);
296 
298  vtkBooleanMacro (LinkResetWindowLevel, unsigned int);
299 
301  vtkGetMacro (LinkResetViewer, unsigned int);
303  virtual void SetLinkResetViewer(unsigned int v);
304 
306  vtkBooleanMacro (LinkResetViewer, unsigned int);
307 
309  vtkGetMacro (LinkRequestedPosition, unsigned int);
311  virtual void SetLinkRequestedPosition(unsigned int v);
312 
314  vtkBooleanMacro (LinkRequestedPosition, unsigned int);
315 
317  vtkGetMacro (LinkCamera, unsigned int);
319  virtual void SetLinkCamera(unsigned int v);
320 
322  vtkBooleanMacro (LinkCamera, unsigned int);
323 
325  vtkGetMacro (LinkPosition, unsigned int);
327  virtual void SetLinkPosition(unsigned int v);
328 
330  vtkBooleanMacro (LinkPosition, unsigned int);
331 
333  virtual void SetShowAxes(unsigned int v);
334 
336  vtkBooleanMacro (ShowAxes, unsigned int);
338  vtkGetMacro (ShowAxes, unsigned int);
339 
340  void SyncSetBackground(double *rgb);
341 
342  void SyncPan();
343 
344  void SyncSetZoomAndParallelScale(double Zoom, double ParallelScale);
345 
350  void SetSplinePlaneActorsVisibility(bool iVisibility);
351 
355  void EnableDefaultInteractionMode();
356 
360  void EnableZoomInteractionMode();
361 
365  void EnablePanInteractionMode();
366 
370  void EnableContourPickingMode();
371 
376  void SynchronizeViews( bool iSynchronize);
377 
381  std::vector< vtkProp3D * > GetPlanesActors();
382 
383 protected:
384 
387 
389  vtkRenderWindow * ExtraRenderWindow;
390 
391  std::vector< vtkProp3D * > PlanesActors;
392 
393  unsigned int LinkSliceMove;
394  unsigned int LinkColorWindowLevel;
395  unsigned int LinkResetWindowLevel;
396  unsigned int LinkResetViewer;
397  unsigned int LinkRequestedPosition;
398  unsigned int LinkCamera;
399  unsigned int LinkPosition;
400  unsigned int ShowAxes;
401 };
402 
403 #endif /* _vtkViewImage2DCollection_h_ */
Manage events occuring in a 2D view and apply it to a collection.
std::vector< vtkProp3D * > PlanesActors
Text annotation in four corners.
#define vtkSyncSetMacro(name, type, base)
Manage a collection of 2D views.
#define vtkSyncSetObjectMacro(name, type, base)
ETX.
vtkViewImage2D * GetItem(int i)
vtkViewImage2DCollectionCommand * Command
void SetExtraRenderWindow(vtkRenderWindow *win)
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.