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 );
Method |
Description |
add(msrInfo)
|
Adds a measurement into the MeasurementGroup object. |
remove(msrInfo)
|
Removes a measurement from the MeasurementGroup object. |
read(filename) |
Reads the MeasurementGroup object from a file path. |
write(filename, overwrite = True) |
Writes the MeasurementGroup object into a file defined by a path. |
Attributes |
Description |
list
|
Sets or returns the list of measurements embedded in the MeasurementGroup object. |
native_measurements = imagedev.native_measurements
group = imagedev.MeasurementGroup([native_measurements.Area2d, native_measurements.IntensityIntegral])
self.assertTrue(group.list == [native_measurements.Area2d, native_measurements.IntensityIntegral])
group.remove(native_measurements.Area2d)
self.assertTrue(group.list == [native_measurements.IntensityIntegral])
group.add(native_measurements.Area2d)
self.assertTrue(group.list == [native_measurements.IntensityIntegral, native_measurements.Area2d])
group.save('mygroup.txt', True)
reload = imagedev.MeasurementGroup()
reload.load('mygroup.txt')
for msr in reload.list:
self.assertTrue(msr in group.list)
Method |
Description |
MeasurementGroup()
|
Default constructor. |
MeasurementGroup(MsrInfo[] msrInfos)
|
Constructor from a predefined list of measurements. |
void Add(MsrInfo msrInfo)
|
Adds a measurement into the MeasurementGroup object. |
void Add(MsrInfo[] msrInfos)
|
Adds a list of measurements into the MeasurementGroup object. |
void Remove(MsrInfo msrInfo)
|
Removes a measurement from the MeasurementGroup object. |
void Remove(MsrInfo[] msrInfos)
|
Removes a list of measurements from the MeasurementGroup object. |
MsrInfo[] GetMeasurements()
|
Returns the list of measurements embedded in the MeasurementGroup object. |
void Read(String pathFile) |
Reads the MeasurementGroup object from a file path. |
void Write(String pathFile, Boolean overWrite = true) |
Writes the MeasurementGroup object into a file defined by a path. |
ImageView polystyrene_sep_label = Data.ReadVipImage(GetBaseImagePath("polystyrene_sep_label.vip")) as ImageView;
ImageView polystyrene = Data.ReadVipImage(GetBaseImagePath("polystyrene.vip")) as ImageView;
// create a group of measurement
MeasurementGroup group = new MeasurementGroup();
// add measurements
group.Add(NativeMeasurements.Area2d);
group.Add(NativeMeasurements.BarycenterX);
group.Add(NativeMeasurements.GrayBarycenterX);
// write
group.Write("group.vip");
// read
MeasurementGroup group2 = new MeasurementGroup();
group2.Read("group.vip");
// add measurements from a group
AnalysisMsr analysis = new AnalysisMsr();
analysis.Add(group.GetMeasurements());
LabelAnalysis labelAnalysisAlgo = new LabelAnalysis
{
inputLabelImage = polystyrene_sep_label,
inputIntensityImage = polystyrene,
outputAnalysis = analysis
}
labelAnalysisAlgo.Execute();