DGtal  1.5.beta
DrawWithViewer3DModifier.h
1 
17 #pragma once
18 
30 #if defined(DrawWithViewer3DModifier_RECURSES)
31 #error Recursive header files inclusion detected in DrawWithViewer3DModifier.h
32 #else // defined(DrawWithViewer3DModifier_RECURSES)
34 #define DrawWithViewer3DModifier_RECURSES
35 
36 #if !defined DrawWithViewer3DModifier_h
38 #define DrawWithViewer3DModifier_h
39 
41 // Inclusions
42 #include <iostream>
43 #include "DGtal/base/Common.h"
44 #include "DGtal/base/Alias.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/images/CConstImage.h"
47 #include "DGtal/base/CountedPtr.h"
48 #include "DGtal/topology/KhalimskySpaceND.h"
49 #include "DGtal/io/DrawWithDisplay3DModifier.h"
51 
52 namespace DGtal
53 {
54 
61  {
62  std::string className() const;
63  };
64 
65 
66 #ifndef DrawWithBoard3DTo2DModifier_h
71  {
79  CameraPosition( const double x, const double y, const double z ):eyex(x), eyey(y), eyez(z)
80  {
81  }
82 
83  double eyex, eyey, eyez;
84  };
85 
86 
90  struct CameraDirection : public DrawWithViewer3DModifier
91  {
99  CameraDirection( const double x, const double y, const double z ): dirx(x), diry(y), dirz(z)
100  {
101  }
102 
103  double dirx, diry, dirz;
104  };
105 
106 
110  struct CameraUpVector : public DrawWithViewer3DModifier
111  {
119  CameraUpVector( const double x, const double y, const double z ): upx(x), upy(y), upz(z)
120  {
121  upx=x; upy=y; upz=z;
122  }
123 
124  double upx, upy, upz;
125  };
126 
127 
128 
132  struct CameraZNearFar : public DrawWithViewer3DModifier
133  {
140  CameraZNearFar( const double near, const double far ): ZNear(near), ZFar(far)
141  {
142  }
143  double ZNear, ZFar;
144  };
145 
146 #endif
147 
148 
149 
150 
156  template < typename Space, typename KSpace>
158  {
159 
171  UpdateImage3DEmbedding(unsigned int anIndex,
172  typename Space::Point aPoint1, typename Space::Point aPoint2,
173  typename Space::Point aPoint3, typename Space::Point aPoint4): myIndex(anIndex),
174  myNewPoint1(aPoint1),
175  myNewPoint2(aPoint2),
176  myNewPoint3(aPoint3),
177  myNewPoint4(aPoint4)
178  {
179  }
180  unsigned int myIndex;
185  };
186 
187 
193  template < typename Space, typename KSpace>
195  {
196 
208  UpdateImagePosition(unsigned int anIndex,typename Viewer3D<Space,KSpace>::ImageDirection newDir,
209  double posXbottomLeft, double posYbottomLeft, double posZbottomLeft ): myIndex(anIndex),
210  myPosXBottomLeft(posXbottomLeft),
211  myPosYBottomLeft(posYbottomLeft),
212  myPosZBottomLeft(posZbottomLeft),
213  myNewDirection(newDir)
214  {}
215 
216  unsigned int myIndex;
221  };
222 
223 
224 
250  template <typename TImageType, typename TFunctor, typename Space, typename KSpace>
252  {
255 
261  Clone<TFunctor> aFunctor,
262  TTextureMode aMode = TTextureMode::GrayScaleMode): my2DImage(&anImage),
263  myFunctor(aFunctor),
264  myMode(aMode)
265  {
266 
267  }
268  const TImageType *my2DImage;
269  const TFunctor myFunctor;
271  };
272 
297  template <typename TImageType, typename TFunctor, typename Space, typename KSpace>
299  {
307  Clone<TFunctor> aFunctor,
308  TTextureMode aMode =
309  TTextureMode::GrayScaleMode): my3DImage(&anImage),
310  myFunctor(aFunctor),
311  myMode(aMode)
312  {
313 
314  }
315  const TImageType *my3DImage;
316  const TFunctor myFunctor;
318  };
319 
320 
321 
327  template < typename Space, typename KSpace>
329  {
330 
342  double posXbottomLeft, double posYbottomLeft, double posZbottomLeft ):
343  myPosXBottomLeft(posXbottomLeft),
344  myPosYBottomLeft(posYbottomLeft),
345  myPosZBottomLeft(posZbottomLeft),
346  myNewDirection(newDir)
347  {
348 
349  }
354  };
355 
356 
357 
358 
364  template<typename TImageType, typename TFunctor= functors::Cast<unsigned int> >
366  {
367 
382  UpdateImageData(unsigned int anIndex, ConstAlias<TImageType> anImage, double translateX=0,
383  double translateY=0, double translateZ=0,
384  double rotationAngle=0.0, typename Viewer3D<>::ImageDirection dirRotation=Viewer3D<>::zDirection,
385  Clone<TFunctor> aFunctor = TFunctor() ): myIndex(anIndex),
386  myImage(&anImage),
387  myTranslateX (translateX),
388  myTranslateY (translateY),
389  myTranslateZ (translateZ),
390  myFunctor(aFunctor),
391  myRotationAngle(rotationAngle),
392  myRotationDir(dirRotation)
393  {}
394 
395  unsigned int myIndex;
396  const TImageType *myImage;
400  const TFunctor myFunctor;
403  };
404 
405 
406 
407 
414  {
415 
427  Translate2DDomain(unsigned int anIndex, double translateX=0,
428  double translateY=0, double translateZ=0 ): myIndex(anIndex),
429  myTranslateX (translateX),
430  myTranslateY (translateY),
431  myTranslateZ (translateZ)
432  { }
433 
434  unsigned int myIndex;
438  };
439 
440 
441 
442 
443 
444 
450  template < typename Space, typename KSpace>
452  {
453 
465  Update2DDomainPosition(unsigned int anIndex, typename Viewer3D<Space,KSpace>::ImageDirection newDir,
466  double posXbottomLeft, double posYbottomLeft, double posZbottomLeft ): myIndex(anIndex),
467  myPosXBottomLeft(posXbottomLeft),
468  myPosYBottomLeft(posYbottomLeft),
469  myPosZBottomLeft(posZbottomLeft),
470  myNewDirection(newDir)
471  { }
472 
473  unsigned int myIndex;
478  };
479 
480 
481 
482 
483 } // namespace DGtal
484 
485 
486 // //
488 
489 #endif // !defined DrawWithViewer3DModifier_h
490 
491 #undef DrawWithViewer3DModifier_RECURSES
492 #endif // else defined(DrawWithViewer3DModifier_RECURSES)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
ImageDirection
the 3 possible axes for the image direction
Definition: Viewer3D.h:470
DGtal is the top-level namespace which contains all DGtal functions and types.
class to insert a custom 2D textured image by using a conversion functor and allows to change the def...
AddTextureImage2DWithFunctor(ConstAlias< TImageType > anImage, Clone< TFunctor > aFunctor, TTextureMode aMode=TTextureMode::GrayScaleMode)
Viewer3D< Space, KSpace >::TextureMode TTextureMode
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TImageType >))
class to insert a custom 3D textured image by using a conversion functor and allows to change the def...
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TImageType >))
Viewer3D< Space, KSpace >::TextureMode TTextureMode
AddTextureImage3DWithFunctor(ConstAlias< TImageType > anImage, Clone< TFunctor > aFunctor, TTextureMode aMode=TTextureMode::GrayScaleMode)
CameraDirection(const double x, const double y, const double z)
CameraPosition class to set camera position.
CameraPosition(const double x, const double y, const double z)
CameraUpVector(const double x, const double y, const double z)
CameraZNearFar(const double near, const double far)
Base class specifying the methods for classes which intend to modify a Viewer3D stream.
Base class specifying the methods for classes which intend to modify a Viewer3D stream.
std::string className() const
class to modify the data of an given image and also the possibility to translate it (optional).
Translate2DDomain(unsigned int anIndex, double translateX=0, double translateY=0, double translateZ=0)
class to modify the position and orientation of an 2D domain.
Viewer3D< Space, KSpace >::ImageDirection myNewDirection
Update2DDomainPosition(unsigned int anIndex, typename Viewer3D< Space, KSpace >::ImageDirection newDir, double posXbottomLeft, double posYbottomLeft, double posZbottomLeft)
class to modify the 3d embedding of the image (useful to display not only 2D slice images)....
UpdateImage3DEmbedding(unsigned int anIndex, typename Space::Point aPoint1, typename Space::Point aPoint2, typename Space::Point aPoint3, typename Space::Point aPoint4)
class to modify the data of an given image and also the possibility to translate it (optional).
Viewer3D ::ImageDirection myRotationDir
UpdateImageData(unsigned int anIndex, ConstAlias< TImageType > anImage, double translateX=0, double translateY=0, double translateZ=0, double rotationAngle=0.0, typename Viewer3D<>::ImageDirection dirRotation=Viewer3D<>::zDirection, Clone< TFunctor > aFunctor=TFunctor())
class to modify the position and orientation of an textured 2D image.
Viewer3D< Space, KSpace >::ImageDirection myNewDirection
UpdateImagePosition(unsigned int anIndex, typename Viewer3D< Space, KSpace >::ImageDirection newDir, double posXbottomLeft, double posYbottomLeft, double posZbottomLeft)
class to modify the position and orientation of an textured 2D image.
Viewer3D< Space, KSpace >::ImageDirection myNewDirection
UpdateLastImagePosition(typename Viewer3D< Space, KSpace >::ImageDirection newDir, double posXbottomLeft, double posYbottomLeft, double posZbottomLeft)
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:95