Commit f6e0536d authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD #449] able show only every n-th glyph now

parent 8a3addad
......@@ -182,7 +182,7 @@ void WMTeemGlyphs::properties()
m_moduloProp = m_properties->addProperty( "Modulo", "Shows only every Modulo-th glyph in the two slice directions", 3, m_recompute );
m_moduloProp->setMin( 0 );
m_moduloProp->setMax( 20 );
m_moduloProp->setMax( 10 );
m_subdivisionLevelProp = m_properties->addProperty( "Subdivision level",
"Determines the glyph resolution. Subdivision level of"
......@@ -248,6 +248,7 @@ void WMTeemGlyphs::renderSlice( size_t sliceId )
m_GFAThresholdProp->get(),
sliceId,
m_subdivisionLevelProp->get(),
m_moduloProp->get(),
sliceType,
m_usePolarPlotProp->get(),
m_glyphSizeProp->get(),
......@@ -337,6 +338,7 @@ WMTeemGlyphs::GlyphGeneration::GlyphGeneration( boost::shared_ptr< WDataSetSpher
double thresholdGFA,
const size_t& sliceId,
const size_t& subdivisionLevel,
const size_t& modulo,
const size_t& sliceType,
const bool& usePolar,
const float& scale,
......@@ -347,6 +349,7 @@ WMTeemGlyphs::GlyphGeneration::GlyphGeneration( boost::shared_ptr< WDataSetSpher
m_thresholdGFA( thresholdGFA ),
m_sliceType( sliceType ),
m_subdivisionLevel( subdivisionLevel ),
m_modulo( modulo ),
m_usePolar( usePolar ),
m_scale( scale ),
m_useNormalization( useNormalization )
......@@ -380,8 +383,7 @@ WMTeemGlyphs::GlyphGeneration::GlyphGeneration( boost::shared_ptr< WDataSetSpher
m_nB = m_nY;
break;
}
size_t nbGlyphs = m_nA * m_nB; // / m_moduloProp->get() / m_moduloProp->get();
size_t nbGlyphs = ( m_nA * m_nB ) / ( m_modulo * m_modulo );
const unsigned int level = m_subdivisionLevel; // subdivision level of sphere
unsigned int infoBitFlag = ( 1 << limnPolyDataInfoNorm ) | ( 1 << limnPolyDataInfoRGBA );
......@@ -403,10 +405,8 @@ WMTeemGlyphs::GlyphGeneration::GlyphGeneration( boost::shared_ptr< WDataSetSpher
WMTeemGlyphs::GlyphGeneration::~GlyphGeneration()
{
std::cout << "Destructor ... " << std::endl;
// free memory
m_sphere = limnPolyDataNix( m_sphere );
std::cout << "... done! " << std::endl;
}
void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WBoolFlag& /*b*/ )
......@@ -433,12 +433,17 @@ void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WB
float* res = new float[type->num];
float* esh = new float[type->num];
//******************************************
// Please take care when changing something between here and the following mark.
// Sizes and upper bound are carefully adjusted to avoid segfault with modulo
// and to avoid unwanted gaps if computing with many threads.
size_t chunkSize = m_nA / numThreads;
size_t first = id * chunkSize;
size_t last = ( id + 1 ) * chunkSize - 1;
if( id == numThreads - 1 )
{
last = m_nA - 1;
last = m_nA - 2;
}
std::stringstream ss;
......@@ -449,8 +454,13 @@ void WMTeemGlyphs::GlyphGeneration::operator()( size_t id, size_t numThreads, WB
{
for( size_t bId = 0; bId < m_nB; ++bId )
{
size_t glyphId = aId * m_nB + bId;
// Please take care when changing something between here and the above mark.
//******************************************
if( !( ( aId % m_modulo == 0) && ( bId % m_modulo == 0 ) ) )
{
continue;
}
size_t glyphId = ( aId / m_modulo ) * ( m_nB / m_modulo ) + ( bId / m_modulo );
size_t vertsUpToCurrentIteration = glyphId * nbVerts;
size_t idsUpToCurrentIteration = glyphId * m_sphere->indxNum;
......
......@@ -159,6 +159,7 @@ private:
* \param thresholdGFA Threshold of GFA below which we will not draw the glyphs
* \param sliceId Rendered slice
* \param subdivisionLevel Subidivision level of spheres that are basis for glyphs (resolution)
* \param modulo Show only every modulo-th glyph in each direction.
* \param sliceType Slice direction (sagittal, coronal, axial )
* \param usePolar Use polar glyphs (HOME otherwise)
* \param scale Resize the glyphs.
......@@ -169,6 +170,7 @@ private:
double thresholdGFA,
const size_t& sliceId,
const size_t& subdivisionLevel,
const size_t& modulo,
const size_t& sliceType,
const bool& usePolar,
const float& scale,
......@@ -218,6 +220,7 @@ private:
size_t m_sliceId; //!< Stores option from property.
size_t m_sliceType; //!< Stores option from property.
size_t m_subdivisionLevel; //!< Store option from property
size_t m_modulo; //!< Store option from property
bool m_usePolar; //!< Stores option from property.
float m_scale; //!< Stores option from property.
bool m_useNormalization; //!< Stores option from property..
......
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