DGtal  1.2.0
Public Types | Public Member Functions | Data Fields
DGtal::AddTextureImage3DWithFunctor< TImageType, TFunctor, Space, KSpace > Struct Template Reference

class to insert a custom 3D 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::AddTextureImage3DWithFunctor< TImageType, TFunctor, Space, KSpace >:
[legend]

Public Types

typedef Viewer3D< Space, KSpace >::TextureMode TTextureMode
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CConstImage< TImageType >))
 
 AddTextureImage3DWithFunctor (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 * my3DImage
 
const TFunctor myFunctor
 
TTextureMode myMode
 

Detailed Description

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

class to insert a custom 3D 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 viewer3D-9-3Dimages.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
{
HueShadeColorMap<unsigned char> hueShade(0,255);
Color col = hueShade((unsigned char)aVal);
return (((unsigned int) col.red()) << 16)| (((unsigned int) col.green()) << 8)|((unsigned int) col.blue());
}
};

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

viewer << AddTextureImage3DWithFunctor<Image3D, hueFct, Z3i::Space, Z3i::KSpace> (imageCrop2, hueFct(), MyViewer::RGBMode);
viewer << MyViewer::updateDisplay;
Note
If you change the image date don't forget to specify again the functor with the UpdateImageData object.
See also
AddTextureImage2DWithFunctor viewer3D-8-2DSliceImages.cpp viewer3D-9-3Dimages.cpp

Definition at line 298 of file DrawWithViewer3DModifier.h.

Member Typedef Documentation

◆ TTextureMode

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

Definition at line 301 of file DrawWithViewer3DModifier.h.

Constructor & Destructor Documentation

◆ AddTextureImage3DWithFunctor()

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
DGtal::AddTextureImage3DWithFunctor< TImageType, TFunctor, Space, KSpace >::AddTextureImage3DWithFunctor ( 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 306 of file DrawWithViewer3DModifier.h.

309  : my3DImage(&anImage),
310  myFunctor(aFunctor),
311  myMode(aMode)
312  {
313 
314  }

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

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

Field Documentation

◆ my3DImage

template<typename TImageType , typename TFunctor , typename Space , typename KSpace >
const TImageType* DGtal::AddTextureImage3DWithFunctor< TImageType, TFunctor, Space, KSpace >::my3DImage

Definition at line 315 of file DrawWithViewer3DModifier.h.

◆ myFunctor

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

Definition at line 316 of file DrawWithViewer3DModifier.h.

◆ myMode

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

Definition at line 317 of file DrawWithViewer3DModifier.h.


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