DGtal  0.9.3
Public Member Functions | Data Fields | Private Member Functions
DGtal::Viewer3D< Space, KSpace >::TextureImage Struct Reference

#include <DGtal/io/viewers/Viewer3D.h>

Collaboration diagram for DGtal::Viewer3D< Space, KSpace >::TextureImage:
[legend]

Public Member Functions

 ~TextureImage ()
 
 TextureImage (const TextureImage &img)
 
template<typename TImageType , typename TFunctor >
 TextureImage (const TImageType &image, const TFunctor &aFunctor, ImageDirection normalDir=zDirection, double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, TextureMode aMode=GrayScaleMode)
 
void updateImageOrientation (ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
 
void updateImage3DEmbedding (RealPoint aPoint1, RealPoint aPoint2, RealPoint aPoint3, RealPoint aPoint4)
 
template<typename TImageType , typename TFunctor >
void updateImageDataAndParam (const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
 
std::string className () const
 

Data Fields

RealPoint point1
 
RealPoint point2
 
RealPoint point3
 
RealPoint point4
 
ImageDirection myDirection
 
unsigned int myImageWidth
 
unsigned int myImageHeight
 
unsigned int * myTabImage
 
bool myDrawDomain
 
unsigned int myIndexDomain
 
TextureMode myMode
 

Private Member Functions

 TextureImage ()
 

Detailed Description

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
struct DGtal::Viewer3D< Space, KSpace >::TextureImage

Used to display an image as a textured quad image.

Definition at line 406 of file Viewer3D.h.

Constructor & Destructor Documentation

◆ ~TextureImage()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< Space, KSpace >::TextureImage::~TextureImage ( )
inline

the mode of representation of the image

Destructor

Definition at line 428 of file Viewer3D.h.

429  {
430  delete [] myTabImage;
431  };
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:419

◆ TextureImage() [1/3]

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< Space, KSpace >::TextureImage::TextureImage ( const TextureImage img)
inline

Copy constructor (needed due to myTabImage)

Parameters
imgthe image

Definition at line 437 of file Viewer3D.h.

References DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageHeight, DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageWidth, and DGtal::Viewer3D< Space, KSpace >::TextureImage::myTabImage.

437  : point1(img.point1), point2(img.point2),
438  point3(img.point3), point4(img.point4),
439  myDirection(img.myDirection), myImageWidth(img.myImageWidth),
440  myImageHeight(img.myImageHeight),
441  myTabImage(img.myTabImage),
442  myDrawDomain(img.myDrawDomain),
443  myIndexDomain(img.myIndexDomain),
444  myMode(img.myMode)
445  {
446 
447  if(img.myImageHeight>0 && img.myImageWidth>0)
448  {
449  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
450  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
451  {
452  myTabImage[i] = img.myTabImage[i];
453  }
454  }else
455  {
456  myTabImage=img.myTabImage;
457  }
458  };
ImageDirection myDirection
Definition: Viewer3D.h:414
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:419
unsigned int myIndexDomain
true if the draw have a domain
Definition: Viewer3D.h:422
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:416
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:417
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:423
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:421

◆ TextureImage() [2/3]

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
template<typename TImageType , typename TFunctor >
DGtal::Viewer3D< Space, KSpace >::TextureImage::TextureImage ( const TImageType &  image,
const TFunctor &  aFunctor,
ImageDirection  normalDir = zDirection,
double  xBottomLeft = 0.0,
double  yBottomLeft = 0.0,
double  zBottomLeft = 0.0,
TextureMode  aMode = GrayScaleMode 
)
inline

Constructor that fills image parameters from std image (image buffer, dimensions, vertex coordinates, orientation)

Template Parameters
TImageTypethe type of the image given for the constructor (should follow the CConstImage concept).
TFunctorthe functor type (should follow the CUnaryFunctor concept with image value type as input type and unsigned int as output type).
Parameters
imagethe source image.
aFunctora functor to transform input values to the output displayed values.
normalDirthe direction of normal vector of the image plane (xDirection, yDirection or zDirection (default)) .
xBottomLeftthe x coordinate of bottom left image point (default 0).
yBottomLeftthe x coordinate of bottom left image point (default 0).
zBottomLeftthe x coordinate of bottom left image point (default 0).
aModethe mode of representation (default GrayScaleMode).

Definition at line 483 of file Viewer3D.h.

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

487  {
488  BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
489  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, typename TImageType::Value, unsigned int> )) ;
490  myDrawDomain=false;
491  myDirection=normalDir;
492  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
493  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
494  myTabImage = new unsigned int [myImageWidth*myImageHeight];
495  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
496  myMode=aMode;
497  updateImageDataAndParam(image, aFunctor);
498  }
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:547
ImageDirection myDirection
Definition: Viewer3D.h:414
void updateImageOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:419
BOOST_CONCEPT_ASSERT((concepts::CSpace< Space >))
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:416
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:417
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:423
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:421

◆ TextureImage() [3/3]

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
DGtal::Viewer3D< Space, KSpace >::TextureImage::TextureImage ( )
inlineprivate

default constructor TextureImage

Definition at line 579 of file Viewer3D.h.

References DGtal::Viewer3D< Space, KSpace >::addImage2DDomainD3D(), DGtal::Viewer3D< Space, KSpace >::addTextureImage(), DGtal::Viewer3D< Space, KSpace >::compute2DDomainLineRepresentation(), DGtal::Viewer3D< Space, KSpace >::getCurrentDomainNumber(), DGtal::Viewer3D< Space, KSpace >::getCurrentGLImageNumber(), DGtal::Viewer3D< Space, KSpace >::glDrawGLBall(), DGtal::Viewer3D< Space, KSpace >::isValid(), DGtal::Viewer3D< Space, KSpace >::keyPressEvent(), DGtal::Viewer3D< Space, KSpace >::mouseMoveEvent(), DGtal::Viewer3D< Space, KSpace >::mousePressEvent(), DGtal::Viewer3D< Space, KSpace >::mouseReleaseEvent(), DGtal::Viewer3D< Space, KSpace >::operator<<(), DGtal::Viewer3D< Space, KSpace >::paintGL(), DGtal::Color::Red, DGtal::Viewer3D< Space, KSpace >::rotateDomain(), DGtal::Viewer3D< Space, KSpace >::rotateLineD3D(), DGtal::Viewer3D< Space, KSpace >::selfDisplay(), DGtal::Viewer3D< Space, KSpace >::show(), DGtal::Viewer3D< Space, KSpace >::sortPolygonFromCamera(), DGtal::Viewer3D< Space, KSpace >::sortQuadFromCamera(), DGtal::Viewer3D< Space, KSpace >::sortSurfelFromCamera(), DGtal::Viewer3D< Space, KSpace >::sortTriangleFromCamera(), DGtal::Viewer3D< Space, KSpace >::translateAn2DDomain(), DGtal::Viewer3D< Space, KSpace >::updateAn2DDomainOrientation(), DGtal::Viewer3D< Space, KSpace >::updateEmbeddingTextureImage(), DGtal::Viewer3D< Space, KSpace >::updateList(), DGtal::Viewer3D< Space, KSpace >::updateOrientationTextureImage(), DGtal::Viewer3D< Space, KSpace >::updateTextureImage(), and DGtal::Viewer3D< Space, KSpace >::zDirection.

580  {};

Member Function Documentation

◆ className()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
std::string DGtal::Viewer3D< Space, KSpace >::TextureImage::className ( ) const

return the class name to implement the CDrawableWithViewer3D concept.

◆ updateImage3DEmbedding()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
void DGtal::Viewer3D< Space, KSpace >::TextureImage::updateImage3DEmbedding ( RealPoint  aPoint1,
RealPoint  aPoint2,
RealPoint  aPoint3,
RealPoint  aPoint4 
)
inline

Update the embedding of the image by updating the image 3D vertex.

Parameters
aPoint1the first image point (lower bound point)
aPoint2the second image point (upper bound point in first dimension and lower in the second dimentsion)
aPoint3the third image point (upper bound point in first second dimentsion)
aPoint4the fourth image point (lower bound point in first dimension and upper in the second dimentsion)

Definition at line 521 of file Viewer3D.h.

References DGtal::Viewer3D< Space, KSpace >::undefDirection.

525  {
526  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
528  }
ImageDirection myDirection
Definition: Viewer3D.h:414

◆ updateImageDataAndParam()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
template<typename TImageType , typename TFunctor >
void DGtal::Viewer3D< Space, KSpace >::TextureImage::updateImageDataAndParam ( const TImageType &  image,
const TFunctor &  aFunctor,
double  xTranslation = 0.0,
double  yTranslation = 0.0,
double  zTranslation = 0.0 
)
inline

Update the image parameters from std image (image buffer, vertex coordinates) The new image should be with same dimension than the original.

Template Parameters
TImageTypethe type of the image given for the constructor (should follow the CConstImage concept).
TFunctorthe functor type (should follow the CUnaryFunctor concept with image value type as input type and unsigned int as output type).
Parameters
imagethe source image.
aFunctora functor to transform input values to the output displayed values.
xTranslationthe image translation in the x direction (default 0).
yTranslationthe image translation in the y direction (default 0).
zTranslationthe image translation in the z direction (default 0).

Definition at line 547 of file Viewer3D.h.

References DGtal::Viewer3D< Space, KSpace >::BOOST_CONCEPT_ASSERT(), and image().

549  {
550  BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
551  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, typename TImageType::Value, unsigned int> )) ;
552  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
553  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
554 
555  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
556  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
557  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
558  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
559 
560  unsigned int pos=0;
561  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
562  it!=itend; ++it)
563  {
564  myTabImage[pos]= aFunctor(image(*it));
565  pos++;
566  }
567  }
MyDigitalSurface::ConstIterator ConstIterator
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:419
BOOST_CONCEPT_ASSERT((concepts::CSpace< Space >))
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:416
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:417
Image image(domain)

◆ updateImageOrientation()

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
void DGtal::Viewer3D< Space, KSpace >::TextureImage::updateImageOrientation ( ImageDirection  normalDir,
double  xBottomLeft,
double  yBottomLeft,
double  zBottomLeft 
)

Update the image direction from a specific normal direction (Viewer3D::xDirection, Viewer3D::yDirection or Viewer3D::zDirection) and image position from the botton left point.

Parameters
normalDirgive a predifined normal orientation can be (Viewer3D::xDirection, Viewer3D::yDirection or Viewer3D::zDirection)
xBottomLeftthe x coordinate of bottom left image point.
yBottomLeftthe x coordinate of bottom left image point.
zBottomLeftthe x coordinate of bottom left image point.

Field Documentation

◆ myDirection

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
ImageDirection DGtal::Viewer3D< Space, KSpace >::TextureImage::myDirection

◆ myDrawDomain

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
bool DGtal::Viewer3D< Space, KSpace >::TextureImage::myDrawDomain

for each pixel of the image, color or height ?

Definition at line 421 of file Viewer3D.h.

◆ myImageHeight

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageHeight

◆ myImageWidth

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< Space, KSpace >::TextureImage::myImageWidth

◆ myIndexDomain

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
unsigned int DGtal::Viewer3D< Space, KSpace >::TextureImage::myIndexDomain

true if the draw have a domain

Definition at line 422 of file Viewer3D.h.

◆ myMode

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
TextureMode DGtal::Viewer3D< Space, KSpace >::TextureImage::myMode

index of the image domain if exist

Definition at line 423 of file Viewer3D.h.

Referenced by DGtal::Viewer3D< Space, KSpace >::GLTextureImage::GLTextureImage().

◆ myTabImage

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
unsigned int* DGtal::Viewer3D< Space, KSpace >::TextureImage::myTabImage

◆ point1

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::TextureImage::point1

◆ point2

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::TextureImage::point2

◆ point3

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::TextureImage::point3

◆ point4

template<typename Space = SpaceND<3>, typename KSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< Space, KSpace >::TextureImage::point4

The documentation for this struct was generated from the following file: