Commit d9525be9 authored by Alexander Wiebel's avatar Alexander Wiebel

[CHANGE #366] made the glyph generation ready for parallelization.

Unfortunately it does seem to be nay faster.
parent 8189bf2e
This diff is collapsed.
......@@ -128,25 +128,91 @@ private:
*/
void renderSlice( size_t sliceId );
/**
* Makes the radii of the glyph be distributed between [0,1]
* \param glyph The glyph thta will be normalized given as teem's limnPolyData.
*/
void minMaxNormalization( limnPolyData *glyph );
osg::ref_ptr< WShader > m_shader; //!< The shader used for the glyph surfaces
boost::shared_ptr< WItemSelection > m_sliceOrientations; //!< A list of the selectable slice orientations, i.e x, y and z.
WPropSelection m_sliceOrientationSelection; //!< To choose whether to x, y or z slice.
WPropBool m_usePolarPlotProp; //!< Property indicating whether to use polar plot instead of HOME glyph
WPropBool m_useNormalization; //!< Indicates whether to us radius normalization.
WPropBool m_useNormalizationProp; //!< Indicates whether to us radius normalization.
WPropDouble m_glyphSizeProp; //!< Property holding the size of the displayed glyphs
WPropInt m_sliceIdProp; //!< Property holding the slice ID
osg::ref_ptr< osg::Geode > m_glyphsGeode; //!< Pointer to geode containing the glyphs.
osg::ref_ptr< WGEGroupNode > m_moduleNode; //!< Pointer to the modules group node.
static const size_t m_nbVertCoords; //!< The teem limn data structure has 4 values for a coordinate: x, y, z, w.
/**
* This class actually generated the glyph geometry. This class has () operator that the work.
* The () operator enables it to be parallelized by WThreadedFunction.
*/
class GlyphGeneration
{
public:
/**
* Constructor setting the data pointers and the properties from the module.
*
* \param dataSet Pointer to the treated data set.
* \param sliceId Rendered slice
* \param sliceType Slice direction (sagittal, coronal, axial )
* \param usePolar Use polar glyphs (HOME otherwise)
* \param scale Resize the glyphs.
* \param useNormalization Scale minimum and maximum radius to [0,1].
*/
GlyphGeneration( boost::shared_ptr< WDataSetSphericalHarmonics > dataSet,
const size_t& sliceId,
const size_t& sliceType,
const bool& usePolar,
const float& scale,
const bool& useNormalization );
/**
* Destructor freeing the data.
*/
~GlyphGeneration();
/**
* Computes the glyphs.
*
* \param id Thread id.
* \param numThreads The number of threads accessing this function simultaneously
* \param b A flag allowing to check whether a an abort has been requested.
*/
void operator()( size_t id, size_t numThreads, WBoolFlag& b ); //NOLINT
/**
* Get the geode of the computed glyphs.
*/
osg::ref_ptr< osg::Geode > getGraphics();
private:
/**
* Makes the radii of the glyph be distributed between [0,1]
* \param glyph The glyph thta will be normalized given as teem's limnPolyData.
*/
void minMaxNormalization( limnPolyData *glyph );
size_t m_nA; //!< Internal variable holding the number of glyphs in the first direction of the slice.
size_t m_nB; //!< Internal variable holding the number of glyphs in the second direction of the slice.
size_t m_nX; //!< Number of voxels in x direction.
size_t m_nY; //!< Number of voxels in y direction.
size_t m_nZ; //!< Number of voxels in z direction.
boost::shared_ptr< WDataSetSphericalHarmonics > m_dataSet; //!< Pointer to the treated data set.
boost::shared_ptr< WGridRegular3D > m_grid; //!< Pointer to the grid of the treated data set.
osg::Geometry* m_glyphGeometry; //!< All glyphs.
osg::ref_ptr< osg::Geode > m_glyphsGeode; //!< The geode containing the glyphs.
osg::ref_ptr< osg::Vec3Array > m_vertArray; //!< Vertices of the triangles of the glyphs.
osg::ref_ptr< osg::Vec3Array > m_normals; //!< Normals of the vertices of the glyphs.
osg::ref_ptr< osg::Vec4Array > m_colors; //!< Colors of the vertices of the glyphs.
osg::ref_ptr< osg::DrawElementsUInt > m_glyphElements; //!< Indices of the vertices of the triangles of the glyphs.
osg::ref_ptr< WGEGroupNode > m_generatorNode; //!< Pointer to the generators group node.
size_t m_sliceId; //!< Stores option from property.
size_t m_sliceType; //!< Stores option from property.
bool m_usePolar; //!< Stores option from property.
float m_scale; //!< Stores option from property.
bool m_useNormalization; //!< Stores option from property.
limnPolyData *m_sphere; //!< The geometry of the subdivided icosahedron
};
};
#endif // WMHOMEGLYPHS_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment