DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields
DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace > Struct Template Reference

class to insert a custom 2D textured image by using a conversion functor and allows to change the default mode (GrayScale mode) to color mode. More...

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

Inheritance diagram for DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >:
DGtal::DrawWithViewer3DModifier DGtal::DrawWithDisplay3DModifier

Public Types

typedef Viewer3D< Space, KSpace >::TextureMode TTextureMode
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CConstImage< TImageType >))
 
 AddTextureImage2DWithFunctor (ConstAlias< TImageType > anImage, Clone< TFunctor > aFunctor, TTextureMode aMode=TTextureMode::GrayScaleMode)
 
- Public Member Functions inherited from DGtal::DrawWithViewer3DModifier
std::string className () const
 
- Public Member Functions inherited from DGtal::DrawWithDisplay3DModifier
std::string className () const
 

Data Fields

const TImageType * my2DImage
 
const TFunctor myFunctor
 
TTextureMode myMode
 

Detailed Description

template<typename TImageType, typename TFunctor, typename Space, typename KSpace>
struct DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >

class to insert a custom 2D textured image by using a conversion functor and allows to change the default mode (GrayScale mode) to color mode.

Template Parameters
TImageTypethe type of the used as texture (should follow the concept of CConstImage).
TFunctorthe functor type to transform source image scalar value into the one of the image being displayed.

A typical use can be illustrated by displaying a grayscale source image with artificial color defined from a colormap (see viewer3D-8-2DSliceImages.cpp ): We can first add a functor to convert grayscale value into RGB int:

#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/DrawWithViewer3DModifier.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/Color.h"
struct hueFct{
inline
unsigned int operator() (unsigned char aVal) const
{
Color col = hueShade((unsigned char)aVal);
return (((unsigned int) col.red()) << 16)| (((unsigned int) col.green()) << 8)|((unsigned int) col.blue());
}
};
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
void blue(const unsigned char aBlueValue)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...

Then you can define and add the object AddTextureImage2DWithFunctor in a viewer:

viewer << AddTextureImage2DWithFunctor<MySliceImageAdapter, hueFct, Z3i::Space, Z3i::KSpace> (aSliceImageZ, hueFct(), Viewer3D<Z3i::Space, Z3i::KSpace>::RGBMode);
viewer << AddTextureImage2DWithFunctor<MySliceImageAdapter, hueFct, Z3i::Space, Z3i::KSpace> (aSliceImageY, hueFct(), Viewer3D<Z3i::Space, Z3i::KSpace>::RGBMode);
Note
If you change the image date don't forget to specify again.
viewer << DGtal::UpdateImagePosition<Z3i::Space, Z3i::KSpace>(3, MyViewer::yDirection, 500.0, 50.0, 0.0);
viewer << DGtal::UpdateImageData<MySliceImageAdapter, hueFct>(2, aSliceImageZ, 500, 0, 10, 0.0, MyViewer::zDirection, hueFct());
See also
AddTextureImage3DWithFunctor viewer3D-8-2DSliceImages.cpp viewer3D-9-3Dimages.cpp

Definition at line 251 of file DrawWithViewer3DModifier.h.

Member Typedef Documentation

◆ TTextureMode

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
typedef Viewer3D<Space,KSpace>::TextureMode DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::TTextureMode

Definition at line 254 of file DrawWithViewer3DModifier.h.

Constructor & Destructor Documentation

◆ AddTextureImage2DWithFunctor()

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::AddTextureImage2DWithFunctor ( ConstAlias< TImageType >  anImage,
Clone< TFunctor >  aFunctor,
TTextureMode  aMode = TTextureMode::GrayScaleMode 
)
inline

Constructor given from an 2D image and a Functor to apply specific conversion.

Definition at line 260 of file DrawWithViewer3DModifier.h.

262 : my2DImage(&anImage),
263 myFunctor(aFunctor),
264 myMode(aMode)
265 {
266
267 }

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CConstImage< TImageType >)  )

Field Documentation

◆ my2DImage

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
const TImageType* DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::my2DImage

Definition at line 268 of file DrawWithViewer3DModifier.h.

◆ myFunctor

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
const TFunctor DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::myFunctor

Definition at line 269 of file DrawWithViewer3DModifier.h.

◆ myMode

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
TTextureMode DGtal::AddTextureImage2DWithFunctor< TImageType, TFunctor, Space, KSpace >::myMode

Definition at line 270 of file DrawWithViewer3DModifier.h.


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