SOFA plugin: image  master
Open source framework for multi-physics simuation
sofa::component::misc::ImageViewer< _ImageTypes > Class Template Reference

#include <ImageViewer.h>

This component is responsible for displaying images in SOFA. More...

Inheritance diagram for sofa::component::misc::ImageViewer< _ImageTypes >:

Detailed Description

template<class _ImageTypes>
class sofa::component::misc::ImageViewer< _ImageTypes >

This component is responsible for displaying images in SOFA.

ImageViewer scene options:

image - a link to the imge in the ImageContainer component

transform - a link to the transformation in the ImageContainer component

histo -

plane -

vectorvis - Describes the settings for visualizing vectors and tensors. Input string should be in the form: "subsampleXY subsampleZ scale rgb shape tensorOrder", where: subsampleXY is an integer n where in the X and Y planes, a shape is drawn every n voxels. subsampleZ is an integer n where in the Z plane, a shape is drawn every n voxels. scale is an integer n such that each shape is drawn n times its normal size. rgb is a bool. When true, an image with 3 channels is displayed as an rgb image, and when false, it is displayed as a greyscale image where the value is the L2 norm of all the channels. shape is a bool. When true, an image with 3 channels has vectors displayed, and an image with 6 channels has tensors displayed. tensorOrder is a string describing the order in which the 6 tensors values are provided in the image. The three supported types are: LowerTriRowMajor UpperTriRowMajor DiagonalFirst

The default vectorvis configuration is "5 5 10 true false LowerTriRowMajor"

Public Attributes

Data< ImageTypesimage
 input image More...
 
Data< bool > showSlicedModels
 display visual models on cutPlanes More...
 
Data< int > scroll
 0 if no scrolling, 1 for up, 2 for down, 3 left, and 4 for right More...
 
Data< bool > display
 true if image is displayed, false otherwise More...
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< bool > f_listening
 
- Public Attributes inherited from sofa::core::objectmodel::Base
std::vector< lifecycle::DeprecatedData * > m_oldAttributes
 
Data< int > d_messageLogCount
 
Data< std::string > name
 
Data< bool > f_printLog
 
Data< sofa::core::objectmodel::TagSetf_tags
 
Data< sofa::type::BoundingBoxf_bbox
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 
std::string m_definitionSourceFileName
 
int m_definitionSourceFilePos
 
std::string m_instanciationSourceFileName
 
int m_instanciationSourceFilePos
 

Static Protected Attributes

static const unsigned cutplane_res =1024
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(ImageViewer, _ImageTypes), Inherited)
 
 ImageViewer ()
 
 ~ImageViewer () override
 
void init () override
 
void reinit () override
 
void handleEvent (sofa::core::objectmodel::Event *event) override
 
void draw (const core::visual::VisualParams *vparams) override
 
void getCorners (type::Vec< 8, type::Vec3 > &c)
 
void computeBBox (const core::ExecParams *params, bool onlyVisible=false) override
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
BasefindLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const override
 
virtual bool insertInNode (BaseNode *)
 
virtual bool removeInNode (BaseNode *)
 
SReal getTime () const
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleTopologyChange ()
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 
virtual void bwdInit ()
 
void updateInternal ()
 
virtual void storeResetState ()
 
virtual void reset ()
 
virtual void cleanup ()
 
SReal getTime () const
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addDeprecatedAttribute (lifecycle::DeprecatedData *attribute)
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 
void setName (const std::string &n)
 
void setName (const std::string &n, int counter)
 
std::string getTypeName () const
 
virtual std::string getClassName () const
 
virtual std::string getTemplateName () const final
 
std::string getNameSpaceName () const
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 
const std::string & getDefinitionSourceFileName () const
 
void setDefinitionSourceFilePos (const int)
 
int getDefinitionSourceFilePos () const
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 
virtual bool hasField (const std::string &attribute) const
 
void parseFields (const std::list< std::string > &str)
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 
void writeDatas (std::map< std::string, std::string * > &str)=delete
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 
virtual void updateLinks (bool logErrors=true)
 
BaseData::BaseInitData initData (::sofa::core::objectmodel::Data< T > *field, const char *name, const char *help, ::sofa::core::objectmodel::BaseData::DataFlags dataflags)
 
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 
void addAlias (BaseData *field, const char *alias)
 
void addLink (BaseLink *l)
 
void addAlias (BaseLink *link, const char *alias)
 
const VecDatagetDataFields () const
 
const MapDatagetDataAliases () const
 
const VecLinkgetLinks () const
 
const MapLinkgetLinkAliases () const
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 

Protected Member Functions

void drawArrows (const core::visual::VisualParams *vparams)
 
void drawEllipsoid ()
 
cimg_library::CImg< TcomputeTensorFromLowerTriRowMajorVector (cimg_library::CImg< T > vector)
 
cimg_library::CImg< TcomputeTensorFromUpperTriRowMajorVector (cimg_library::CImg< T > vector)
 
cimg_library::CImg< TcomputeTensorFromDiagonalFirstVector (cimg_library::CImg< T > vector)
 
void drawCutplanes ()
 
void updateTextures ()
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, std::size_t, bool add)
 
void trackInternalData (const BaseData &data)
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
- Protected Member Functions inherited from sofa::core::IntrusiveObject
virtual ~IntrusiveObject ()=default
 
typedef defaulttype::Histogram< THistogramType
 
typedef helper::WriteOnlyAccessor< Data< HistogramType > > waHisto
 
typedef helper::ReadAccessor< Data< HistogramType > > raHisto
 
Data< HistogramTypehisto
 
typedef SReal Real
 
typedef defaulttype::ImageLPTransform< RealTransformType
 
typedef TransformType::Coord Coord
 
typedef helper::ReadAccessor< Data< TransformType > > raTransform
 
Data< TransformTypetransform
 
typedef defaulttype::ImagePlane< TImagePlaneType
 
typedef helper::ReadAccessor< Data< ImagePlaneType > > raPlane
 
typedef helper::WriteOnlyAccessor< Data< ImagePlaneType > > waPlane
 
Data< ImagePlaneTypeplane
 
typedef helper::ReadAccessor< core::objectmodel::Data< type::vector< Coord > > > raPoints
 
typedef helper::WriteOnlyAccessor< core::objectmodel::Data< type::vector< Coord > > > waPoints
 
Data< type::vector< Coord > > points
 
typedef helper::ReadAccessor< Data< defaulttype::VectorVis > > raVis
 
typedef helper::WriteOnlyAccessor< Data< defaulttype::VectorVis > > waVis
 
Data< defaulttype::VectorVisvectorVisualization
 

Additional Inherited Members

- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINK > l_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINK > l_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 
MapData m_aliasData
 
VecLink m_vecLink
 
MapLink m_aliasLink
 
- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 

Attribute details

◆ cutplane_res

template<class _ImageTypes >
const unsigned sofa::component::misc::ImageViewer< _ImageTypes >::cutplane_res =1024
staticprotected

◆ display

template<class _ImageTypes >
Data<bool> sofa::component::misc::ImageViewer< _ImageTypes >::display

true if image is displayed, false otherwise

◆ histo

template<class _ImageTypes >
Data< HistogramType > sofa::component::misc::ImageViewer< _ImageTypes >::histo

◆ image

template<class _ImageTypes >
Data< ImageTypes > sofa::component::misc::ImageViewer< _ImageTypes >::image

input image

◆ plane

template<class _ImageTypes >
Data< ImagePlaneType > sofa::component::misc::ImageViewer< _ImageTypes >::plane

◆ points

template<class _ImageTypes >
Data< type::vector<Coord> > sofa::component::misc::ImageViewer< _ImageTypes >::points

◆ scroll

template<class _ImageTypes >
Data<int> sofa::component::misc::ImageViewer< _ImageTypes >::scroll

0 if no scrolling, 1 for up, 2 for down, 3 left, and 4 for right

◆ showSlicedModels

template<class _ImageTypes >
Data<bool> sofa::component::misc::ImageViewer< _ImageTypes >::showSlicedModels

display visual models on cutPlanes

◆ transform

template<class _ImageTypes >
Data< TransformType > sofa::component::misc::ImageViewer< _ImageTypes >::transform

◆ vectorVisualization

template<class _ImageTypes >
Data<defaulttype::VectorVis> sofa::component::misc::ImageViewer< _ImageTypes >::vectorVisualization

Constructor details

◆ ImageViewer()

template<class _ImageTypes >
sofa::component::misc::ImageViewer< _ImageTypes >::ImageViewer ( )
inline

◆ ~ImageViewer()

template<class _ImageTypes >
sofa::component::misc::ImageViewer< _ImageTypes >::~ImageViewer ( )
inlineoverride

Function details

◆ computeBBox()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::computeBBox ( const core::ExecParams params,
bool  onlyVisible = false 
)
inlineoverridevirtual

◆ computeTensorFromDiagonalFirstVector()

template<class _ImageTypes >
cimg_library::CImg<T> sofa::component::misc::ImageViewer< _ImageTypes >::computeTensorFromDiagonalFirstVector ( cimg_library::CImg< T vector)
inlineprotected

◆ computeTensorFromLowerTriRowMajorVector()

template<class _ImageTypes >
cimg_library::CImg<T> sofa::component::misc::ImageViewer< _ImageTypes >::computeTensorFromLowerTriRowMajorVector ( cimg_library::CImg< T vector)
inlineprotected

◆ computeTensorFromUpperTriRowMajorVector()

template<class _ImageTypes >
cimg_library::CImg<T> sofa::component::misc::ImageViewer< _ImageTypes >::computeTensorFromUpperTriRowMajorVector ( cimg_library::CImg< T vector)
inlineprotected

◆ draw()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::draw ( const core::visual::VisualParams vparams)
inlineoverridevirtual

◆ drawArrows()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::drawArrows ( const core::visual::VisualParams vparams)
inlineprotected

◆ drawCutplanes()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::drawCutplanes ( )
inlineprotected

◆ drawEllipsoid()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::drawEllipsoid ( )
inlineprotected

◆ getCorners()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::getCorners ( type::Vec< 8, type::Vec3 > &  c)
inline

◆ handleEvent()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::handleEvent ( sofa::core::objectmodel::Event event)
inlineoverridevirtual

◆ init()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::init ( void  )
inlineoverridevirtual

◆ reinit()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::reinit ( )
inlineoverridevirtual

◆ SOFA_CLASS()

template<class _ImageTypes >
sofa::component::misc::ImageViewer< _ImageTypes >::SOFA_CLASS ( SOFA_TEMPLATE(ImageViewer< _ImageTypes >, _ImageTypes)  ,
Inherited   
)

◆ updateTextures()

template<class _ImageTypes >
void sofa::component::misc::ImageViewer< _ImageTypes >::updateTextures ( )
inlineprotected