DGtalTools  1.5.beta
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types
Viewer3DImage< Space, KSpace > Class Template Reference

#include <visualisation/specificClasses/Viewer3DImage.h>

Inheritance diagram for Viewer3DImage< Space, KSpace >:
Inheritance graph
[legend]
Collaboration diagram for Viewer3DImage< Space, KSpace >:
Collaboration graph
[legend]

Public Types

enum  ModeVisu { BoundingBox , InterGrid , Grid , Empty }
 
- Public Types inherited from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >
enum  RenderingMode
 
enum  ImageDirection
 
enum  TextureMode
 
typedef Display3D< DGtal::Z3i::Space, DGtal::Z3i::KSpaceDisplay
 
typedef Display::SelectCallbackFct SelectCallbackFct
 
typedef Display::RealPoint RealPoint
 
- Public Types inherited from DGtal::Display3D< Space, KSpace >
enum  StreamKey
 
typedef Display3D< Space, KSpaceSelf
 
typedef Space::RealPoint RealPoint
 
typedef Space::RealVector RealVector
 
typedef CanonicEmbedder< Space > Embedder
 
typedef CanonicCellEmbedder< KSpaceCellEmbedder
 
typedef CanonicSCellEmbedder< KSpaceSCellEmbedder
 
typedef int(* SelectCallbackFct) (void *viewer, DGtal::int32_t name, void *data)
 
typedef std::map< DGtal::int32_t, std::vector< QuadD3D > > QuadsMap
 
typedef std::map< DGtal::int32_t, std::vector< CubeD3D > > CubesMap
 
typedef std::map< std::string, std::string > ModeMapping
 
typedef std::map< std::string, CountedPtr< DrawableWithDisplay3D > > StyleMapping
 

Public Member Functions

 Viewer3DImage (ModeVisu aMode=BoundingBox)
 
 Viewer3DImage (Image3D *an3DImage)
 
void setVolImage (Image3D *an3DImage)
 
- Public Member Functions inherited from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >
 Viewer3D ()
 
 Viewer3D (const DGtal::Z3i::KSpace &KSEmb)
 
void setCameraPosition (double ax, double ay, double az)
 
void setCameraDirection (double ax, double ay, double az)
 
void setCameraUpVector (double ax, double ay, double az)
 
void setNearFar (double _near, double _far)
 
void setGLScale (float sx, float sy, float sz)
 
void setGLDoubleRenderingMode (bool doubleSidedRendering)
 
void setGLMaterialShininessCoefficient (const GLfloat matShininessCoeff)
 
void setGLLightAmbientCoefficients (const GLfloat lightAmbientCoeffs[4])
 
void setGLLightDiffuseCoefficients (const GLfloat lightDiffuseCoeffs[4])
 
void setGLLightSpecularCoefficients (const GLfloat lightSpecularCoeffs[4])
 
void setUseGLPointForBalls (bool useOpenGLPt)
 
void updateRenderingCoefficients (const RenderingMode aRenderMode, bool displayState=true)
 
Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace > & operator<< (const DGtal::Color &aColor)
 
Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace > & operator<< (const typename Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::StreamKey &key)
 
Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace > & operator<< (const TDrawableWithViewer3D &object)
 
void sortSurfelFromCamera ()
 
void sortTriangleFromCamera ()
 
void sortQuadFromCamera ()
 
void sortPolygonFromCamera ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
virtual unsigned int getCurrentDomainNumber ()
 
virtual unsigned int getCurrentGLImageNumber ()
 
virtual void paintGL ()
 
virtual void show ()
 
void addTextureImage (const TextureImage &image)
 
void updateTextureImage (unsigned int imageIndex, const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0, double rotationAngle=0.0, ImageDirection rotationDir=zDirection)
 
void updateOrientationTextureImage (unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
 
void updateEmbeddingTextureImage (unsigned int anImageIndex, typename Space::Point aPoint1, typename Space::Point aPoint2, typename Space::Point aPoint3, typename Space::Point aPoint4)
 
void addImage2DDomainD3D (const TDomain &anImageDomain, std::string mode, const DGtal::Color &aColor=DGtal::Color::Red)
 
void updateAn2DDomainOrientation (unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
 
void translateAn2DDomain (unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
 
std::vector< typename DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::LineD3Dcompute2DDomainLineRepresentation (Image2DDomainD3D &anImageDomain, double delta)
 
std::vector< typename DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::LineD3Dcompute2DDomainLineRepresentation (Image2DDomainD3D &anImageDomain)
 
void rotateLineD3D (typename DGtal::Display3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::LineD3D &aLine, DGtal::PointVector< 3, int > pt, double angleRotation, ImageDirection dirRotation)
 
void rotateDomain (Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir)
 
void updateList (bool needToUpdateBoundingBox=true)
 
void glDrawGLBall (const typename Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::BallD3D &aBall)
 
virtual void mouseMoveEvent (QMouseEvent *e)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 
virtual void drawWithNames ()
 
virtual void draw ()
 
virtual void postSelection (const QPoint &point)
 
virtual QDomElement domElement (const QString &name, QDomDocument &document) const
 
virtual void initFromDOMElement (const QDomElement &element)
 
- Public Member Functions inherited from DGtal::Display3D< Space, KSpace >
 BOOST_CONCEPT_ASSERT ((concepts::CSpace< Space >))
 
virtual ~Display3D ()
 
 Display3D (const KSpace &KSEmb)
 
 Display3D ()
 
 Display3D (const Display3D &)=delete
 
 Display3D (Display3D &&)=delete
 
Display3Doperator= (const Display3D &)=delete
 
Display3Doperator= (Display3D &&)=delete
 
const Embedderembedder () const
 
const CellEmbeddercellEmbedder () const
 
const SCellEmbeddersCellEmbedder () const
 
const KSpacespace () const
 
virtual void setFillColor (DGtal::Color aColor)
 
virtual void setFillTransparency (unsigned char alpha)
 
virtual void setLineColor (DGtal::Color aColor)
 
virtual DGtal::Color getFillColor ()
 
virtual DGtal::Color getLineColor ()
 
virtual void setKSpace (const KSpace &aKSpace)
 
void setName3d (DGtal::int32_t name=-1)
 
DGtal::int32_t name3d () const
 
void setSelectCallback3D (SelectCallbackFct fct, void *data, DGtal::int32_t min_name, DGtal::int32_t max_name)
 
SelectCallbackFct getSelectCallback3D (DGtal::int32_t aName, void *&data) const
 
void addClippingPlane (double a, double b, double c, double d, bool drawPlane)
 
std::string getMode (const std::string &objectName) const
 
void createNewLineList (std::string s="")
 
void createNewBallList (std::string s="")
 
DGtal::int32_t createNewCubeList ()
 
bool deleteCubeList (const DGtal::int32_t name)
 
DGtal::int32_t createNewQuadList ()
 
bool deleteQuadList (const DGtal::int32_t name)
 
void createNewTriangleList (std::string s="")
 
void createNewPolygonList (std::string s="")
 
void addQuad (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4)
 
void addQuadWithNormal (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3, const RealPoint &p4, const RealPoint &n, const bool enableReorientation, const bool enableDoubleFace=false)
 
void addQuadFromSurfelCenter (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel)
 
void addQuadFromSurfelCenterWithNormal (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, const RealVector &aNormal, const bool enableReorientation, const bool sign, const bool enableDoubleFace=false)
 
void addTriangle (const RealPoint &p1, const RealPoint &p2, const RealPoint &p3)
 
void addPolygon (const std::vector< RealPoint > &vertices)
 
void addLine (const RealPoint &p1, const RealPoint &p2, const double width=0.03)
 
void addCube (const RealPoint &center, double width=1.0)
 
void addBall (const RealPoint &center, const double radius=0.5, const unsigned int resolution=30)
 
void addPrism (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel, double sizeShiftFactor, double sizeFactor=1.0, bool isSigned=false, bool aSign=true)
 
void addBasicSurfel (const RealPoint &baseQuadCenter, bool xSurfel, bool ySurfel, bool zSurfel)
 
void addCone (const RealPoint &p1, const RealPoint &p2, double width=0.08)
 
void addCylinder (const RealPoint &p1, const RealPoint &p2, const double width=0.02)
 
void updateBoundingBox (const RealPoint &point)
 
void exportToMesh (Mesh< RealPoint > &aMesh) const
 
Display3Doperator<< (const TDrawableWithDisplay3D &object)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
void clear ()
 
RealPoint embed (const typename Space::Point &dp) const
 
RealPoint embedKS (const typename KSpace::SCell &cell) const
 
RealPoint embedKS (const DGtal::TransformedPrism &aTrans) const
 
RealPoint embedK (const typename KSpace::Cell &cell) const
 

Protected Member Functions

virtual QString helpString () const
 
virtual void keyPressEvent (QKeyEvent *e)
 
virtual void init ()
 
- Protected Member Functions inherited from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >
virtual void closeEvent (QCloseEvent *e)
 

Protected Attributes

Image3Dmy3dImage
 
float myScaleX
 
float myScaleY
 
float myScaleZ
 
int mySliceXPos
 
int mySliceYPos
 
int mySliceZPos
 
int myCurrentSliceDim
 
double myAngleRotation
 
double myTotalAngleRotationX
 
double myTotalAngleRotationY
 
double myTotalAngleRotationZ
 
bool myDisplayingInfo
 
DGtal::Z3i::Point myImageOrigin
 
ModeVisu myMode
 
- Protected Attributes inherited from DGtal::Display3D< Space, KSpace >
KSpace myKSpace
 
EmbeddermyEmbedder
 
CellEmbeddermyCellEmbedder
 
SCellEmbeddermySCellEmbedder
 
DGtal::Color myCurrentFillColor
 
DGtal::Color myCurrentLineColor
 
double myCurrentfShiftVisuPrisms
 
std::vector< std::vector< LineD3D > > myLineSetList
 
std::vector< std::vector< BallD3D > > myBallSetList
 
std::vector< ClippingPlaneD3D > myClippingPlaneList
 
std::vector< QuadD3DmyPrismList
 
QuadsMap myQuadsMap
 
std::vector< std::vector< TriangleD3D > > myTriangleSetList
 
std::vector< std::vector< PolygonD3D > > myPolygonSetList
 
CubesMap myCubesMap
 
std::vector< std::string > myCubeSetNameList
 
std::vector< std::string > myLineSetNameList
 
std::vector< std::string > myBallSetNameList
 
std::vector< std::string > myClippingPlaneNameList
 
std::vector< std::string > myPrismNameList
 
std::vector< std::string > myQuadSetNameList
 
std::vector< std::string > myTriangleSetNameList
 
std::vector< std::string > myPolygonSetNameList
 
DGtal::int32_t myName3d
 
std::set< SelectCallbackFctStoremySelectCallBackFcts
 

Private Types

typedef DGtal::ImageContainerBySTLVector< DGtal::Z3i::Domain, unsigned char > Image3D
 
typedef DGtal::ImageContainerBySTLVector< DGtal::Z2i::Domain, unsigned char > Image2D
 
typedef DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, DGtal::functors::IdentitySliceImageAdapter
 
typedef DGtal::ConstImageAdapter< Image3D, DGtal::Z2i::Domain, DGtal::functors::SliceRotator2D< DGtal::Z3i::Domain >, Image3D::Value, DGtal::functors::IdentityMyRotatorSliceImageAdapter
 

Additional Inherited Members

- Static Public Member Functions inherited from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >
static void rotateImageVertex (TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
 
static void rotatePoint (TValues &x, TValues &y, TValues &z, double cx, double cy, double cz, double rotationAngle, ImageDirection rotationDir)
 
- Data Fields inherited from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >
 RenderingDefault
 
 RenderingMetallic
 
 RenderingPlastic
 
 RenderingLambertian
 
 xDirection
 
 yDirection
 
 zDirection
 
 undefDirection
 
 RGBMode
 
 GrayScaleMode
 
DGtal::Color myDefaultBackgroundColor
 
DGtal::Color myDefaultColor
 
bool myIsBackgroundDefault
 
bool myViewWire
 
double myGLPointMinWidth
 
double myGLLineMinWidth
 
bool myAutoSaveState
 
RenderingMode myRenderingMode
 
- Data Fields inherited from DGtal::Display3D< Space, KSpace >
 addNewList
 
 updateDisplay
 
 shiftSurfelVisu
 
ModeMapping myModes
 
StyleMapping myStyles
 
bool myBoundingPtEmptyTag
 
double myBoundingPtUp [3]
 
double myBoundingPtLow [3]
 
- Static Protected Member Functions inherited from DGtal::Display3D< Space, KSpace >
static void cross (double dst[3], double srcA[3], double srcB[3])
 
static void normalize (double vec[3])
 

Detailed Description

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
class Viewer3DImage< Space, KSpace >

Prevents repeated inclusion of headers.

Definition at line 23 of file Viewer3DImage.h.

Member Typedef Documentation

◆ Image2D

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
typedef DGtal::ImageContainerBySTLVector<DGtal::Z2i::Domain, unsigned char> Viewer3DImage< Space, KSpace >::Image2D
private

Definition at line 27 of file Viewer3DImage.h.

◆ Image3D

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
typedef DGtal::ImageContainerBySTLVector<DGtal::Z3i::Domain, unsigned char> Viewer3DImage< Space, KSpace >::Image3D
private

Definition at line 26 of file Viewer3DImage.h.

◆ MyRotatorSliceImageAdapter

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
typedef DGtal::ConstImageAdapter<Image3D, DGtal::Z2i::Domain, DGtal::functors::SliceRotator2D< DGtal::Z3i::Domain >, Image3D::Value, DGtal::functors::Identity > Viewer3DImage< Space, KSpace >::MyRotatorSliceImageAdapter
private

Definition at line 33 of file Viewer3DImage.h.

◆ SliceImageAdapter

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
typedef DGtal::ConstImageAdapter<Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space>, Image3D::Value, DGtal::functors::Identity > Viewer3DImage< Space, KSpace >::SliceImageAdapter
private

Definition at line 30 of file Viewer3DImage.h.

Member Enumeration Documentation

◆ ModeVisu

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
enum Viewer3DImage::ModeVisu
Enumerator
BoundingBox 
InterGrid 
Grid 
Empty 

Definition at line 38 of file Viewer3DImage.h.

Constructor & Destructor Documentation

◆ Viewer3DImage() [1/2]

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
Viewer3DImage< Space, KSpace >::Viewer3DImage ( ModeVisu  aMode = BoundingBox)
inline

Definition at line 40 of file Viewer3DImage.h.

41  mySliceXPos=0;
42  mySliceYPos=0;
43  mySliceZPos=0;
47  myAngleRotation=0.0;
49  myMode=aMode;
50  myDisplayingInfo=true;
51  }
ModeVisu myMode
Definition: Viewer3DImage.h:82
double myAngleRotation
Definition: Viewer3DImage.h:76
double myTotalAngleRotationY
Definition: Viewer3DImage.h:78
double myTotalAngleRotationZ
Definition: Viewer3DImage.h:79
double myTotalAngleRotationX
Definition: Viewer3DImage.h:77
bool myDisplayingInfo
Definition: Viewer3DImage.h:80
DGtal::Z3i::Point myImageOrigin
Definition: Viewer3DImage.h:81

References Viewer3DImage< Space, KSpace >::myAngleRotation, Viewer3DImage< Space, KSpace >::myCurrentSliceDim, Viewer3DImage< Space, KSpace >::myDisplayingInfo, Viewer3DImage< Space, KSpace >::myMode, Viewer3DImage< Space, KSpace >::mySliceXPos, Viewer3DImage< Space, KSpace >::mySliceYPos, Viewer3DImage< Space, KSpace >::mySliceZPos, Viewer3DImage< Space, KSpace >::myTotalAngleRotationX, Viewer3DImage< Space, KSpace >::myTotalAngleRotationY, and Viewer3DImage< Space, KSpace >::myTotalAngleRotationZ.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ Viewer3DImage() [2/2]

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
Viewer3DImage< Space, KSpace >::Viewer3DImage ( Image3D an3DImage)
inline

Definition at line 54 of file Viewer3DImage.h.

54  {
55  my3dImage = an3DImage;
56  Viewer3DImage();
57  }
Image3D * my3dImage
Definition: Viewer3DImage.h:68
Viewer3DImage(ModeVisu aMode=BoundingBox)
Definition: Viewer3DImage.h:40

References Viewer3DImage< Space, KSpace >::my3dImage, and Viewer3DImage< Space, KSpace >::Viewer3DImage().

Member Function Documentation

◆ helpString()

template<typename Space , typename KSpace >
QString Viewer3DImage< Space, KSpace >::helpString
protectedvirtual

Reimplemented from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >.

Definition at line 128 of file Viewer3DImage.cpp.

129 {
130  QString text ( "<h2> Viewer3DImage</h2>" );
131  text += "Use the mouse to move the camera around the object. ";
132  text += "You can respectively revolve around, zoom and translate with the three mouse buttons. ";
133  text += "Left and middle buttons pressed together rotate around the camera view direction axis<br><br>";
134  text += "Pressing <b>Alt</b> and one of the function keys (<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
135  text += "Simply press the function key again to restore it. Several keyFrames define a ";
136  text += "camera path. Paths are saved when you quit the application and restored at next start.<br><br>";
137  text += "Press <b>F</b> to display the frame rate, <b>A</b> for the world axis, ";
138  text += "<b>Alt+Return</b> for full screen mode and <b>Control+S</b> to save a snapshot. ";
139  text += "See the <b>Keyboard</b> tab in this window for a complete shortcut list.<br><br>";
140  text += "Double clicks automates single click actions: A left button double click aligns the closer axis with the camera (if close enough). ";
141  text += "A middle button double click fits the zoom of the camera and the right button re-centers the scene.<br><br>";
142  text += "A left button double click while holding right button pressed defines the camera <i>Revolve Around Point</i>. ";
143  text += "See the <b>Mouse</b> tab and the documentation web pages for details.<br><br>";
144  text += "Press <b>Escape</b> to exit the viewer.";
145  return text;
146 }

◆ init()

template<typename Space , typename KSpace >
void Viewer3DImage< Space, KSpace >::init
protectedvirtual

Reimplemented from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >.

Definition at line 40 of file Viewer3DImage.cpp.

40  {
42 
43  QGLViewer::setKeyDescription ( Qt::Key_X, "Change the current axis to X for the current 2D image slice setting." );
44  QGLViewer::setKeyDescription ( Qt::Key_Y, "Change the current axis to Y for the current 2D image slice setting." );
45  QGLViewer::setKeyDescription ( Qt::Key_Z, "Change the current axis to Z for the current 2D image slice setting." );
46  QGLViewer::setKeyDescription ( Qt::Key_Up, "Move the current 2D image slice to 5 in the positive direction of the current axis." );
47  QGLViewer::setKeyDescription ( Qt::Key_Down, "Move the current 2D image slice to 5 in the negative direction of the current axis." );
48  QGLViewer::setKeyDescription ( Qt::Key_Shift, "Change the slice move with step 1 (5 by default)" );
49  QGLViewer::setKeyDescription ( Qt::Key_M, "Hide/Display message informations (slice numbers, selected axis)" );
50 }
virtual void init()

References DGtal::Viewer3D< Space, KSpace >::init().

◆ keyPressEvent()

template<typename Space , typename KSpace >
void Viewer3DImage< Space, KSpace >::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

Reimplemented from DGtal::Viewer3D< DGtal::Z3i::Space, DGtal::Z3i::KSpace >.

Definition at line 154 of file Viewer3DImage.cpp.

155 {
156 
157  bool handled = false;
158  if( e->key() == Qt::Key_M){
160  handled=true;
161  }
162  if( e->key() == Qt::Key_I){
163  std::cout << "Image generation" << std::endl;
164  handled=true;
165  }
166 
167  if( e->key() == Qt::Key_X){
168  std::cout << "Current axis set to X" << std::endl;
169  (*this).displayMessage(QString("Current axis set to X"), 100000);
171  handled=true;
172  }
173  if( e->key() == Qt::Key_Y){
174  (*this).displayMessage(QString("Current axis set to Y"), 100000);
176  handled=true;
177  }
178  if( e->key() == Qt::Key_Z){
179  (*this).displayMessage(QString("Current axis set to Z"), 100000);
181  handled=true;
182  }
183  if( e->key() == Qt::Key_Up || e->key() == Qt::Key_Down){
184  int dirStep = (e->key() == Qt::Key_Up)? 5: -5;
185  if((e->modifiers() & Qt::ShiftModifier)){
186  dirStep/=5;
187  }
188  if((e->modifiers() & Qt::MetaModifier)){
189  myAngleRotation =(e->key() == Qt::Key_Down)? 0.1: -0.1;
190  dirStep=0;
191  }else{
192  myAngleRotation=0.0;
193  }
194  int aSliceNum=0;
195  int aSliceMax=0;
196  bool stoped=false;
197  if(myCurrentSliceDim==0){
198  aSliceMax=my3dImage->domain().upperBound()[0]+1;
199  if(mySliceXPos+dirStep<aSliceMax&&mySliceXPos+dirStep>=myImageOrigin[0]){
200  mySliceXPos+=dirStep;
201  }else{
202  stoped=true;
203  }
204 
205  aSliceNum=mySliceXPos;
206  }else if(myCurrentSliceDim==1){
207  aSliceMax=my3dImage->domain().upperBound()[1]+1;
208  if(mySliceYPos+dirStep<aSliceMax&&mySliceYPos+dirStep>=myImageOrigin[1]){
209  mySliceYPos+=dirStep;
210  }else{
211  stoped=true;
212  }
213  aSliceNum=mySliceYPos;
214  }else if(myCurrentSliceDim==2){
215  aSliceMax=my3dImage->domain().upperBound()[2]+1;
216  if(mySliceZPos+dirStep<aSliceMax&&mySliceZPos+dirStep>=myImageOrigin[2]){
217  mySliceZPos+=dirStep;
218  }else{
219  stoped=true;
220  }
221  aSliceNum=mySliceZPos;
222  }
223 
224  if(!stoped){
225  double myTotalAngleRotation=0.0;
226  if(myCurrentSliceDim==0){
228  myTotalAngleRotation = myTotalAngleRotationX;
229  }else if (myCurrentSliceDim==1){
231  myTotalAngleRotation = myTotalAngleRotationY;
232  }else if (myCurrentSliceDim==2){
234  myTotalAngleRotation = myTotalAngleRotationZ;
235  }
236 
238  aSliceNum, 2, myTotalAngleRotation);
239  // Adding X slice in the viewer.
241  DGtal::Z2i::Domain domain2D(invFunctor(my3dImage->domain().lowerBound()),
242  invFunctor(my3dImage->domain().upperBound()));
243 
244  const DGtal::functors::Identity identityFunctor{};
245  MyRotatorSliceImageAdapter sliceImage( *my3dImage, domain2D, aSliceFunctor, identityFunctor );
246 
248  (myCurrentSliceDim==0)? dirStep: 0.0,
249  (myCurrentSliceDim==1)? dirStep: 0.0,
250  (myCurrentSliceDim==2)? dirStep: 0.0,
252  (*this).updateList(false);
253  (*this).update();
254  }
255  if(myDisplayingInfo){
256  std::stringstream sstring;
257  sstring << "slice X: " << mySliceXPos ;
258  sstring << " slice Y: " << mySliceYPos ;
259  sstring << " slice Z: " << mySliceZPos ;
260  (*this).displayMessage(QString(sstring.str().c_str()), 100000);
261  }
262 
263 
264 
265 
266  handled=true;
267  }
268 
269  if ( !handled )
271 
272 }
const Domain & domain() const
virtual void keyPressEvent(QKeyEvent *e)
DGtal::ConstImageAdapter< Image3D, DGtal::Z2i::Domain, DGtal::functors::SliceRotator2D< DGtal::Z3i::Domain >, Image3D::Value, DGtal::functors::Identity > MyRotatorSliceImageAdapter
Definition: Viewer3DImage.h:33
void initRemoveOneDim(const Dimension &dimRemoved)

References DGtal::functors::Projector< S >::initRemoveOneDim(), and DGtal::Viewer3D< Space, KSpace >::keyPressEvent().

◆ setVolImage()

template<typename Space , typename KSpace >
void Viewer3DImage< Space, KSpace >::setVolImage ( Image3D an3DImage)

Definition at line 55 of file Viewer3DImage.cpp.

55  {
56  my3dImage = an3DImage;
57 
58  switch (myMode) {
59  case BoundingBox:
60  (*this) << DGtal::SetMode3D("ConstImageAdapter", "BoundingBox");
61  break;
62  case InterGrid:
63  (*this) << DGtal::SetMode3D("ConstImageAdapter", "InterGrid");
64  break;
65  case Grid:
66  (*this) << DGtal::SetMode3D("ConstImageAdapter", "Grid");
67  break;
68  case Empty:
69  (*this) << DGtal::SetMode3D("ConstImageAdapter", "");
70  break;
71  }
72 
73  myImageOrigin = my3dImage->domain().lowerBound();
74  (*this).updateList(false);
75  (*this).update();
76 
80 
81  // Adding X slice in the viewer.
83  DGtal::Z2i::Domain domain2DX(invFunctorX(my3dImage->domain().lowerBound()),
84  invFunctorX(my3dImage->domain().upperBound()));
85 
86 
88  const DGtal::functors::Identity identityFunctor{};
89  MyRotatorSliceImageAdapter sliceImageX( *my3dImage, domain2DX, aSliceFunctorX, identityFunctor );
90 
91  std::cout << "image:" << sliceImageX.className();
92  (*this) << sliceImageX;
94 
95 
96  // Adding Y slice in the viewer.
98  DGtal::Z2i::Domain domain2DY(invFunctorY(my3dImage->domain().lowerBound()),
99  invFunctorY(my3dImage->domain().upperBound()));
100 
101  DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctorY(mySliceYPos); aSliceFunctorY.initAddOneDim(1);
102  SliceImageAdapter sliceImageY(*my3dImage, domain2DY, aSliceFunctorY, identityFunctor );
103  (*this) << sliceImageY;
105 
106 
107 
108 
109 
110  // Adding Z slice in the viewer.
112  DGtal::Z2i::Domain domain2DZ(invFunctorZ(my3dImage->domain().lowerBound()),
113  invFunctorZ(my3dImage->domain().upperBound()));
114 
115  DGtal::Z3i::Point centerZ((my3dImage->domain().upperBound())[0]/2, (my3dImage->domain().upperBound())[1]/2, mySliceZPos);
116 
118  MyRotatorSliceImageAdapter sliceImageZ( *my3dImage, domain2DZ, aSliceFunctorZ, identityFunctor );
119  (*this) << sliceImageZ;
122 
123 }
DGtal::ConstImageAdapter< Image3D, Image2D::Domain, DGtal::functors::Projector< DGtal::Z3i::Space >, Image3D::Value, DGtal::functors::Identity > SliceImageAdapter
Definition: Viewer3DImage.h:30

References DGtal::ConstImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV >::className(), DGtal::functors::Projector< S >::initAddOneDim(), and DGtal::functors::Projector< S >::initRemoveOneDim().

Field Documentation

◆ my3dImage

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
Image3D* Viewer3DImage< Space, KSpace >::my3dImage
protected

Definition at line 68 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myAngleRotation

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
double Viewer3DImage< Space, KSpace >::myAngleRotation
protected

Definition at line 76 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myCurrentSliceDim

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
int Viewer3DImage< Space, KSpace >::myCurrentSliceDim
protected

Definition at line 75 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myDisplayingInfo

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
bool Viewer3DImage< Space, KSpace >::myDisplayingInfo
protected

Definition at line 80 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myImageOrigin

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
DGtal::Z3i::Point Viewer3DImage< Space, KSpace >::myImageOrigin
protected

Definition at line 81 of file Viewer3DImage.h.

◆ myMode

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
ModeVisu Viewer3DImage< Space, KSpace >::myMode
protected

Definition at line 82 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myScaleX

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
float Viewer3DImage< Space, KSpace >::myScaleX
protected

Definition at line 69 of file Viewer3DImage.h.

◆ myScaleY

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
float Viewer3DImage< Space, KSpace >::myScaleY
protected

Definition at line 70 of file Viewer3DImage.h.

◆ myScaleZ

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
float Viewer3DImage< Space, KSpace >::myScaleZ
protected

Definition at line 71 of file Viewer3DImage.h.

◆ mySliceXPos

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
int Viewer3DImage< Space, KSpace >::mySliceXPos
protected

Definition at line 72 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ mySliceYPos

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
int Viewer3DImage< Space, KSpace >::mySliceYPos
protected

Definition at line 73 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ mySliceZPos

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
int Viewer3DImage< Space, KSpace >::mySliceZPos
protected

Definition at line 74 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myTotalAngleRotationX

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
double Viewer3DImage< Space, KSpace >::myTotalAngleRotationX
protected

Definition at line 77 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myTotalAngleRotationY

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
double Viewer3DImage< Space, KSpace >::myTotalAngleRotationY
protected

Definition at line 78 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().

◆ myTotalAngleRotationZ

template<typename Space = DGtal::Z3i::Space, typename KSpace = DGtal::Z3i::KSpace>
double Viewer3DImage< Space, KSpace >::myTotalAngleRotationZ
protected

Definition at line 79 of file Viewer3DImage.h.

Referenced by Viewer3DImage< Space, KSpace >::Viewer3DImage().


The documentation for this class was generated from the following files: