DGtal  1.0.0
Public Member Functions | Data Fields | Private Member Functions
DGtal::Viewer3D< TSpace, TKSpace >::TextureImage Struct Reference

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

Collaboration diagram for DGtal::Viewer3D< TSpace, TKSpace >::TextureImage:
[legend]

Public Member Functions

 ~TextureImage ()
 the mode of representation of the image More...
 
 TextureImage (const TextureImage &img)
 Copy constructor (needed due to myTabImage) More...
 
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
 direction of the image (x, y or z axe) More...
 
unsigned int myImageHeight
 the width of the image More...
 
unsigned int * myTabImage
 the height of the image More...
 
bool myDrawDomain
 for each pixel of the image, color or height ? More...
 
unsigned int myIndexDomain
 true if the draw have a domain More...
 
TextureMode myMode
 index of the image domain if exist More...
 

Private Member Functions

 TextureImage ()
 

Detailed Description

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
struct DGtal::Viewer3D< TSpace, TKSpace >::TextureImage

Used to display an image as a textured quad image.

Definition at line 566 of file Viewer3D.h.

Constructor & Destructor Documentation

◆ ~TextureImage()

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

the mode of representation of the image

Destructor

Definition at line 588 of file Viewer3D.h.

589  {
590  delete [] myTabImage;
591  };
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:579

References DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myTabImage.

◆ TextureImage() [1/3]

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

Copy constructor (needed due to myTabImage)

Parameters
imgthe image

Definition at line 597 of file Viewer3D.h.

597  : point1(img.point1), point2(img.point2),
598  point3(img.point3), point4(img.point4),
599  myDirection(img.myDirection), myImageWidth(img.myImageWidth),
600  myImageHeight(img.myImageHeight),
601  myTabImage(img.myTabImage),
602  myDrawDomain(img.myDrawDomain),
603  myIndexDomain(img.myIndexDomain),
604  myMode(img.myMode)
605  {
606 
607  if(img.myImageHeight>0 && img.myImageWidth>0)
608  {
609  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
610  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
611  {
612  myTabImage[i] = img.myTabImage[i];
613  }
614  }else
615  {
616  myTabImage=img.myTabImage;
617  }
618  };
ImageDirection myDirection
Definition: Viewer3D.h:574
unsigned int myIndexDomain
true if the draw have a domain
Definition: Viewer3D.h:582
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:583
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:577
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:576
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:579
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:581

References DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myTabImage.

◆ TextureImage() [2/3]

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
template<typename TImageType , typename TFunctor >
DGtal::Viewer3D< TSpace, TKSpace >::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 643 of file Viewer3D.h.

647  {
648  BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
649  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, typename TImageType::Value, unsigned int> )) ;
650  myDrawDomain=false;
651  myDirection=normalDir;
652  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
653  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
654  myTabImage = new unsigned int [myImageWidth*myImageHeight];
655  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
656  myMode=aMode;
657  updateImageDataAndParam(image, aFunctor);
658  }
ImageDirection myDirection
Definition: Viewer3D.h:574
void updateImageOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:583
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:577
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:576
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:579
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:707
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:581

References DGtal::Viewer3D< TSpace, TKSpace >::BOOST_CONCEPT_ASSERT(), DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myDirection, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myDrawDomain, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myImageHeight, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myImageWidth, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myMode, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myTabImage, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::updateImageDataAndParam(), and DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::updateImageOrientation().

◆ TextureImage() [3/3]

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

default constructor TextureImage

Definition at line 739 of file Viewer3D.h.

740  {};

Member Function Documentation

◆ className()

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

return the class name to implement the CDrawableWithViewer3D concept.

◆ updateImage3DEmbedding()

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
void DGtal::Viewer3D< TSpace, TKSpace >::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 681 of file Viewer3D.h.

685  {
686  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
688  }
ImageDirection myDirection
Definition: Viewer3D.h:574

References DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myDirection, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point1, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point2, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point3, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point4, and DGtal::Viewer3D< TSpace, TKSpace >::undefDirection.

◆ updateImageDataAndParam()

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
template<typename TImageType , typename TFunctor >
void DGtal::Viewer3D< TSpace, TKSpace >::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 707 of file Viewer3D.h.

709  {
710  BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
711  BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctor<TFunctor, typename TImageType::Value, unsigned int> )) ;
712  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
713  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
714 
715  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
716  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
717  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
718  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
719 
720  unsigned int pos=0;
721  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
722  it!=itend; ++it)
723  {
724  myTabImage[pos]= aFunctor(image(*it));
725  pos++;
726  }
727  }
MyDigitalSurface::ConstIterator ConstIterator
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:577
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:576
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:579
Image image(domain)

References DGtal::Viewer3D< TSpace, TKSpace >::BOOST_CONCEPT_ASSERT(), image(), DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myImageHeight, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myImageWidth, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myTabImage, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point1, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point2, DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point3, and DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point4.

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::TextureImage().

◆ updateImageOrientation()

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
void DGtal::Viewer3D< TSpace, TKSpace >::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.

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::TextureImage().

Field Documentation

◆ myDirection

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
ImageDirection DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myDirection

◆ myDrawDomain

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
bool DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myDrawDomain

for each pixel of the image, color or height ?

Definition at line 581 of file Viewer3D.h.

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::TextureImage().

◆ myImageHeight

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

◆ myImageWidth

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

◆ myIndexDomain

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

true if the draw have a domain

Definition at line 582 of file Viewer3D.h.

◆ myMode

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
TextureMode DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::myMode

index of the image domain if exist

Definition at line 583 of file Viewer3D.h.

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::TextureImage().

◆ myTabImage

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

◆ point1

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point1

◆ point2

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point2

◆ point3

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point3

◆ point4

template<typename TSpace = SpaceND<3>, typename TKSpace = KhalimskySpaceND<3>>
RealPoint DGtal::Viewer3D< TSpace, TKSpace >::TextureImage::point4

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