Commit d3822289 authored by André Reichenbach's avatar André Reichenbach

[MERGE] updated script branch with newest changes from default

parents 9d6843b4 2f6cda1c
......@@ -28,7 +28,6 @@
WCreateColorArraysThread::WCreateColorArraysThread( int left, int right, boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
boost::shared_ptr< std::vector< size_t > > lineLengths,
boost::shared_ptr< std::vector< float > > globalColors,
boost::shared_ptr< std::vector< float > > localColors,
......@@ -41,7 +40,6 @@ WCreateColorArraysThread::WCreateColorArraysThread( int left, int right, boost:
m_tangents( tangents ),
m_globalColors( globalColors ),
m_localColors( localColors ),
m_lineStartIndexes( lineStartIndexes ),
m_lineLengths( lineLengths )
{
}
......@@ -52,17 +50,12 @@ WCreateColorArraysThread::~WCreateColorArraysThread()
void WCreateColorArraysThread::threadMain()
{
if( !m_vertices || !m_tangents || !m_globalColors || !m_localColors || !m_lineStartIndexes || !m_lineLengths )
if( !m_vertices || !m_tangents || !m_globalColors || !m_localColors || !m_lineLengths )
{
return;
}
if( !m_vertices->size() ||
!m_tangents->size() ||
!m_globalColors->size() ||
!m_localColors->size() ||
!m_lineStartIndexes->size() ||
!m_lineLengths->size() )
if( !m_vertices->size() || !m_tangents->size() || !m_globalColors->size() || !m_localColors->size() || !m_lineLengths->size() )
{
return;
}
......
......@@ -29,9 +29,8 @@
#include "../common/WThreadedRunner.h"
/**
* implements a thread that updates the fiber selection bit field
* Thread for computing directional color coding of fibers.
*/
class WCreateColorArraysThread: public WThreadedRunner // NOLINT
{
......@@ -39,17 +38,16 @@ public:
/**
* default constructor
*
* \param left
* \param right
* \param vertices
* \param lineStartIndexes
* \param lineLengths
* \param globalColors
* \param localColors
* \param left start position of the first line to comput colors for
* \param right last line for which the color is computed
* \param vertices vertices of all lines
* \param lineStartIndexes line start indices in vertex array
* \param lineLengths line length in vertex array
* \param globalColors where to write global coloring
* \param localColors where to write local coloring
* \param tangents
*/
WCreateColorArraysThread( int left, int right, boost::shared_ptr< std::vector< float > >vertices,
boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
boost::shared_ptr< std::vector< size_t > > lineLengths,
boost::shared_ptr< std::vector< float > > globalColors,
boost::shared_ptr< std::vector< float > > localColors,
......@@ -83,7 +81,7 @@ private:
/**
* Point vector for all fibers
*/
boost::shared_ptr< std::vector< float > > m_vertices;
boost::shared_ptr< const std::vector< float > > m_vertices;
/**
* Point vector for tangents at each vertex, used for fake tubes
......@@ -99,19 +97,12 @@ private:
* Storing the local color value of the fibers for each point.
* \note it is mutable to allow getLocalColors creating it on demand.
*/
mutable boost::shared_ptr< std::vector< float > > m_localColors;
/**
* Line vector that contains the start index of its first point for each line.
* \warning The index returned cannot be used in the vertices array until
* the number of components for each point is multiplied.
*/
boost::shared_ptr< std::vector< size_t > > m_lineStartIndexes;
boost::shared_ptr< std::vector< float > > m_localColors;
/**
* Line vector that contains the number of vertices for each line
*/
boost::shared_ptr< std::vector< size_t > > m_lineLengths;
boost::shared_ptr< const std::vector< size_t > > m_lineLengths;
};
#endif // WCREATECOLORARRAYSTHREAD_H
......@@ -136,16 +136,15 @@ void WDataSetFibers::init()
boost::shared_ptr< std::vector< float > > localColors = boost::shared_ptr< std::vector< float > >( new std::vector<float>( size ) );
boost::shared_ptr< std::vector< float > > customColors = boost::shared_ptr< std::vector< float > >( new std::vector<float>( size ) );
// TODO(all): use the new WThreadedJobs functionality
WCreateColorArraysThread* t1 = new WCreateColorArraysThread( 0, m_lineLengths->size()/4, m_vertices,
m_lineStartIndexes, m_lineLengths, globalColors, localColors, m_tangents );
m_lineLengths, globalColors, localColors, m_tangents );
WCreateColorArraysThread* t2 = new WCreateColorArraysThread( m_lineLengths->size()/4+1, m_lineLengths->size()/2, m_vertices,
m_lineStartIndexes, m_lineLengths, globalColors, localColors, m_tangents );
m_lineLengths, globalColors, localColors, m_tangents );
WCreateColorArraysThread* t3 = new WCreateColorArraysThread( m_lineLengths->size()/2+1, m_lineLengths->size()/4*3, m_vertices,
m_lineStartIndexes, m_lineLengths, globalColors, localColors, m_tangents );
m_lineLengths, globalColors, localColors, m_tangents );
WCreateColorArraysThread* t4 = new WCreateColorArraysThread( m_lineLengths->size()/4*3+1, m_lineLengths->size()-1, m_vertices,
m_lineStartIndexes, m_lineLengths, globalColors, localColors, m_tangents );
m_lineLengths, globalColors, localColors, m_tangents );
t1->run();
t2->run();
t3->run();
......@@ -186,6 +185,8 @@ void WDataSetFibers::init()
m_colorProp = m_properties->addProperty( "Color Scheme", "Determines the coloring scheme to use for this data.", m_colors->getSelectorFirst() );
WPropertyHelper::PC_SELECTONLYONE::addTo( m_colorProp );
WPropertyHelper::PC_NOTEMPTY::addTo( m_colorProp );
m_infoProperties->addProperty( "#Fibers", "The number of fibers", static_cast< WPVBaseTypes::PV_INT >( m_lineLengths->size() ) );
m_infoProperties->addProperty( "#Vertices", "The number of vertices", static_cast< WPVBaseTypes::PV_INT >( m_vertices->size() ) );
}
bool WDataSetFibers::isTexture() const
......@@ -243,16 +244,6 @@ WDataSetFibers::TangentArray WDataSetFibers::getTangents() const
return m_tangents;
}
WDataSetFibers::ColorArray WDataSetFibers::getGlobalColors() const
{
return boost::shared_static_cast< const ColorScheme >( ( *m_colors )[0] )->getColor();
}
WDataSetFibers::ColorArray WDataSetFibers::getLocalColors() const
{
return boost::shared_static_cast< const ColorScheme >( ( *m_colors )[1] )->getColor();
}
void WDataSetFibers::addColorScheme( WDataSetFibers::ColorArray colors, std::string name, std::string description )
{
ColorScheme::ColorMode mode = ColorScheme::GRAY;
......
......@@ -296,20 +296,6 @@ public:
*/
TangentArray getTangents() const;
/**
* Reference to the vector storing the global colors.
*
* \return Pointer to the float array. This always is RGB.
*/
ColorArray getGlobalColors() const;
/**
* Reference to the vector storing the local colors.
*
* \return Pointer to the float array. This always is RGB.
*/
ColorArray getLocalColors() const;
/**
* Get the parameter values for each vertex. Same indexing as vertices. Used to store additional scalar values for each vertex.
*
......
......@@ -283,7 +283,7 @@ void WMFiberDisplay::create()
m_fiberDrawable->setPointsPerLine( m_dataset->getLineLengths() );
m_fiberDrawable->setVerts( m_dataset->getVertices() );
m_fiberDrawable->setTangents( m_dataset->getTangents() );
m_fiberDrawable->setColor( m_dataset->getGlobalColors() );
m_fiberDrawable->setColor( m_dataset->getColorScheme( "Global Color" )->getColor() );
m_fiberDrawable->setBitfield( m_fiberSelector->getBitfield() );
m_fiberDrawable->setUseDisplayList( false );
......
......@@ -231,7 +231,7 @@ bool WMWriteTracts::saveJson() const
dataFile << fValue << "],\n";
dataFile << ( " \"colors\" : [" );
boost::shared_ptr<std::vector<float> > colors = ds->getGlobalColors();
boost::shared_ptr< std::vector< float > > colors = ds->getColorScheme( "Global Color" )->getColor();
for( size_t i = 0; i < colors->size() - 3; i += 3 )
{
fValue = colors->at( i );
......@@ -311,7 +311,7 @@ bool WMWriteTracts::saveJson2() const
boost::shared_ptr<std::vector<float> > verts = ds->getVertices();
boost::shared_ptr<std::vector<float> > tangents = ds->getTangents();
boost::shared_ptr<std::vector<float> > colors = ds->getGlobalColors();
boost::shared_ptr< std::vector< float > > colors = ds->getColorScheme( "Global Color" )->getColor();
for( size_t k = 0; k < lengths->size(); ++k )
{
......
......@@ -92,7 +92,7 @@ void WNetworkLayoutNode::remove( WNetworkLayoutNode *node )
else
{
iter = std::find( m_parents.begin(), m_parents.end(), node );
if( iter != m_children.end() )
if( iter != m_parents.end() )
{
m_parents.erase( iter );
}
......
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