MeasurementGroup
Class that manages a serializable object containing a set of features.
It gathers a list of measurements in a same object that can be set into an AnalysisMsr object. The main benefit of using a MeasurementGroup object is its serialization mechanism to save it and recall it later.
It gathers a list of measurements in a same object that can be set into an AnalysisMsr object. The main benefit of using a MeasurementGroup object is its serialization mechanism to save it and recall it later.
Syntax
Method | Description |
---|---|
MeasurementGroup() | Default constructor. |
MeasurementGroup( std::vector< MsrInfo> msrInfos ) | Constructor from a predefined list of measurements. |
void add( MsrInfo msrInfo ) | Adds a measurement into the MeasurementGroup object. |
void add( const std::vector< MsrInfo> msrInfos ) | Adds a list of measurements into the MeasurementGroup object. |
void remove( MsrInfo msrInfo ) | Removes a measurement from the MeasurementGroup object. |
void remove( const std::vector< MsrInfo>f msrInfos ) | Removes a list of measurements from the MeasurementGroup object. |
std::vector< MsrInfo> getMeasurements() | Returns the list of measurements embedded in the MeasurementGroup object. |
void read( const String& pathFile ) | Reads the MeasurementGroup object from a file path. |
void write( const String& pathFile, bool overWrite = true ) | Writes the MeasurementGroup object into a file defined by a path. |
auto polystyrene = imagedev::readVipImage( "polystyrene.vip" ); auto lab = imagedev::readVipImage( "polystyrene_sep_label.vip" ); // create a group of measurement MeasurementGroup::Ptr group = MeasurementGroup::Ptr( new MeasurementGroup() ); // add measurements group->add( NativeMeasurements::area2d ); group->add( NativeMeasurements::barycenterX ); group->add( NativeMeasurements::grayBarycenterX ); // write group->write( "group.vip" ); // read MeasurementGroup::Ptr group2 = MeasurementGroup::Ptr( new MeasurementGroup() ); group2->read( "group.vip" ); // remove measurements group2->remove( NativeMeasurements::baryCenterX ); // add measurements from a group AnalysisMsr::Ptr myMsr = AnalysisMsr::Ptr( new AnalysisMsr() ); myMsr->add( group2->getMeasurements() ); // launch the analysis labelAnalysis( lab, polystyrene, myMsr );