28 #include "WSelectorBranch.h"
32 m_size( fibers->size() ),
36 m_bitField = boost::shared_ptr< std::vector<bool> >(
new std::vector<bool>(
m_size, false ) );
39 boost::shared_ptr< boost::function< void() > >(
new boost::function< void() >( boost::bind( &
WSelectorBranch::setDirty,
this ) ) );
43 boost::shared_ptr< boost::function< void() > >(
new boost::function< void() >( boost::bind( &
WSelectorBranch::setDirty,
this ) ) );
51 for( std::list< boost::shared_ptr< WSelectorRoi > >::iterator roiIter =
m_rois.begin(); roiIter !=
m_rois.end(); ++roiIter )
75 for( std::list< boost::shared_ptr< WSelectorRoi > >::iterator iter =
m_rois.begin(); iter !=
m_rois.end(); ++iter )
77 if( ( *iter )->getRoi() == roi )
88 bool atLeastOneActive =
false;
90 for( std::list< boost::shared_ptr< WSelectorRoi > >::iterator iter =
m_rois.begin(); iter !=
m_rois.end(); ++iter )
92 if( ( *iter )->getRoi()->active() )
94 atLeastOneActive =
true;
98 if( atLeastOneActive )
102 for( std::list< boost::shared_ptr< WSelectorRoi > >::iterator iter =
m_rois.begin(); iter !=
m_rois.end(); ++iter )
104 if( ( *iter )->getRoi()->active() )
106 boost::shared_ptr< std::vector<bool> > bf = ( *iter )->getBitField();
107 bool isnot = ( *iter )->getRoi()->isNot();
110 for(
size_t i = 0 ; i <
m_size ; ++i )
112 ( *m_workerBitfield )[i] = ( *m_workerBitfield )[i] & ( *bf )[i];
117 for(
size_t i = 0 ; i <
m_size ; ++i )
119 ( *m_workerBitfield )[i] = ( *m_workerBitfield )[i] & !( *bf )[i];
127 for(
size_t i = 0 ; i <
m_size ; ++i )
129 ( *m_workerBitfield )[i] = !( *m_workerBitfield )[i];
143 return m_branch->colorProperty()->toPropColor()->get(
true );
WSelectorBranch(boost::shared_ptr< const WDataSetFibers > fibers, boost::shared_ptr< WRMBranch > branch)
constructor
boost::shared_ptr< std::vector< bool > > m_workerBitfield
the bitfield we work on
size_t m_size
size of the fiber dataset, stored for convinience
void recalculate()
updates the output bitfield with the information from all rois in this branch
boost::shared_ptr< boost::function< void() > > m_changeSignal
Signal that can be used to update the selector branch.
void setDirty()
Sets the dirty flag.
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal
Signal that can be used to update the selector branch.
std::list< boost::shared_ptr< WSelectorRoi > > m_rois
list of rois in this branch
~WSelectorBranch()
destructor
void addRoi(boost::shared_ptr< WSelectorRoi > roi)
adds a roi to the branch
boost::shared_ptr< std::vector< bool > > m_bitField
the bitfield given to the outside world
boost::shared_ptr< WRMBranch > m_branch
pointer to the branch object in the roi manager
void removeRoi(osg::ref_ptr< WROI > roi)
Removes a roi fromt he branch.
WColor getBranchColor() const
Return the current branch color.
std::list< boost::shared_ptr< WSelectorRoi > > getROIs()
Queries the ROIs.