Commit 3964da04 by schurade

[ADD] the roi manager now accepts an external bitfield for fiber selection

parent 8c1962a3
......@@ -31,8 +31,11 @@
#include "../../../graphicsEngine/WROIBox.h"
WROIManagerFibers::WROIManagerFibers() :
m_recalcLock( false )
m_recalcLock( false ),
m_useExternalBitfield( false )
{
m_properties = boost::shared_ptr< WProperties >( new WProperties( "Properties", "Module's properties" ) );
m_dirty = m_properties->addProperty( "dirty", "dirty flag", true );
}
WROIManagerFibers::~WROIManagerFibers()
......@@ -162,7 +165,12 @@ void WROIManagerFibers::removeFiberDataset( boost::shared_ptr< const WDataSetFib
boost::shared_ptr< std::vector< bool > > WROIManagerFibers::getBitField()
{
m_dirty = false;
m_dirty->set( false );
if ( m_useExternalBitfield )
{
return m_externalBitfield;
}
return m_outputBitfield;
}
......@@ -196,7 +204,7 @@ void WROIManagerFibers::recalculate()
}
m_outputBitfield = m_workerBitfield;
m_dirty = true;
m_dirty->set( true );
m_recalcLock = false;
}
......@@ -304,3 +312,28 @@ boost::shared_ptr< WRMROIRepresentation > WROIManagerFibers::getSelectedRoi()
{
return m_selectedRoi;
}
void WROIManagerFibers::setExternalBitfield( boost::shared_ptr< std::vector< bool > > bitfield )
{
m_externalBitfield = bitfield;
//m_dirty->set( true );
}
void WROIManagerFibers::setUseExternalBitfield( bool flag )
{
m_useExternalBitfield = flag;
if ( !flag )
{
setDirty();
}
else
{
m_dirty->set( true );
}
}
boost::shared_ptr< std::vector< bool > > WROIManagerFibers::getRoiBitfield()
{
return m_outputBitfield;
}
......@@ -184,10 +184,48 @@ public:
*/
size_t size();
/**
* setter for the external bitfield, the bitfield must have the same size as the fiber dataset and will
* be used like the master bitfield calculated from all rois when active
*
* \param bitfield
*/
void setExternalBitfield( boost::shared_ptr< std::vector< bool > > bitfield );
/**
* setter if true the external bitfield will be used
*
* \param flag
*/
void setUseExternalBitfield( bool flag );
/**
* getter
* \return the bitfield calculated from all active rois
*/
boost::shared_ptr< std::vector< bool > > getRoiBitfield();
/**
* getter for the properties object
* \return the properties object
*/
boost::shared_ptr< WProperties > getProperties();
/**
* getter for the line start index array
* \return line starts
*/
boost::shared_ptr< std::vector< size_t > > getStarts();
/**
* getter for the line length array
* \return line lengths
*/
boost::shared_ptr< std::vector< size_t > > getLengths();
protected:
private:
bool m_dirty; //!< dirty flag
size_t m_size; //!< number of fibers in the dataset
boost::shared_ptr< const WDataSetFibers >m_fibers; //!< registered fiber dataset
......@@ -235,11 +273,27 @@ private:
boost::shared_ptr< std::vector< float > >m_customColors; //!< vector to store custom colors
boost::shared_ptr< WRMROIRepresentation > m_selectedRoi; //!< stores a pointer to the currently selected roi
boost::shared_ptr< std::vector< bool > >m_externalBitfield; //!< bit field of activated fibers
bool m_useExternalBitfield; //!< flag controlling the use of an external bitfield
/**
* The property object for the module.
*/
boost::shared_ptr< WProperties > m_properties;
/**
* dirty flag
*/
WPropBool m_dirty;
};
inline bool WROIManagerFibers::dirty()
{
return m_dirty;
return m_dirty->get();
}
inline size_t WROIManagerFibers::size()
......@@ -247,4 +301,20 @@ inline size_t WROIManagerFibers::size()
return m_size;
}
inline boost::shared_ptr< WProperties > WROIManagerFibers::getProperties()
{
return m_properties;
}
inline boost::shared_ptr< std::vector< size_t > > WROIManagerFibers::getStarts()
{
return m_fibers->getLineStartIndexes();
}
inline boost::shared_ptr< std::vector< size_t > > WROIManagerFibers::getLengths()
{
return m_fibers->getLineLengths();
}
#endif // WROIMANAGERFIBERS_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