ImageDev

BinaryAnalysis

Computes a set of measurements globally to an input binary image.

Access to parameter description

For an introduction: This algorithm computes a list of measurements considering all pixels of the binary image as belonging to the same object. It generates an AnalysisMsr output object containing the result values.
It gives a global result on the overall image, considering the non-zero pixels in the image.

If the binary input image has a coordinate system unit defined in its calibration property, analysis results are expressed in this coordinate system unit.

More details about each available measurement can be found in the NativeMeasurement object.

See also

Function Syntax

This function returns outputAnalysis.
// Function prototype
AnalysisMsr::Ptr binaryAnalysis( std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > inputIntensityImage, AnalysisMsr::Ptr outputAnalysis = NULL );
This function returns outputAnalysis.
// Function prototype.
binary_analysis( input_binary_image,
                 input_intensity_image,
                 output_analysis = None )
This function returns outputAnalysis.
// Function prototype.
public static AnalysisMsr
BinaryAnalysis( IOLink.ImageView inputBinaryImage,
                IOLink.ImageView inputIntensityImage,
                AnalysisMsr outputAnalysis = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
input
inputIntensityImage
The intensity input image. If it equals null, the binary input image is used as the intensity input image. Image Binary, Label, Grayscale or Multispectral nullptr
input and output
outputAnalysis
The input and output analysis. This object defines the features to measure and store the results. AnalysisMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_binary_image
The binary input image. image Binary None
input
input_intensity_image
The intensity input image. If it equals null, the binary input image is used as the intensity input image. image Binary, Label, Grayscale or Multispectral None
input and output
output_analysis
The input and output analysis. This object defines the features to measure and store the results. AnalysisMsr None
Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary null
input
inputIntensityImage
The intensity input image. If it equals null, the binary input image is used as the intensity input image. Image Binary, Label, Grayscale or Multispectral null
input and output
outputAnalysis
The input and output analysis. This object defines the features to measure and store the results. AnalysisMsr null

Object Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
AnalysisMsr::Ptr analysis= AnalysisMsr::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "analysis.vip" );

BinaryAnalysis binaryAnalysisAlgo;
binaryAnalysisAlgo.setInputBinaryImage( polystyrene_sep );
binaryAnalysisAlgo.setInputIntensityImage( polystyrene );
binaryAnalysisAlgo.setOutputAnalysis( analysis );
binaryAnalysisAlgo.execute();

std::cout << "Area2d: " << binaryAnalysisAlgo.outputAnalysis()->get( NativeMeasurements::area2d )->value( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
analysis = imagedev.AnalysisMsr.read(imagedev_data.get_object_path("analysis.vip"))

binary_analysis_algo = imagedev.BinaryAnalysis()
binary_analysis_algo.input_binary_image = polystyrene_sep
binary_analysis_algo.input_intensity_image = polystyrene
binary_analysis_algo.output_analysis = analysis
binary_analysis_algo.execute()

print( "Area2d: ", str( binary_analysis_algo.output_analysis.get(imagedev.native_measurements.Area2d).value( 0 ) ) )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
AnalysisMsr analysis = AnalysisMsr.Read( @"Data/objects/analysis.vip" );

BinaryAnalysis binaryAnalysisAlgo = new BinaryAnalysis
{
    inputBinaryImage = polystyrene_sep,
    inputIntensityImage = polystyrene,
    outputAnalysis = analysis
};
binaryAnalysisAlgo.Execute();

Console.WriteLine( "Area2d: " + binaryAnalysisAlgo.outputAnalysis.Get( NativeMeasurements.Area2d ).Value( 0 ) );

Function Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
AnalysisMsr::Ptr analysis= AnalysisMsr::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "analysis.vip" );

auto result = binaryAnalysis( polystyrene_sep, polystyrene, analysis );

std::cout << "Area2d: " << result->get( NativeMeasurements::area2d )->value( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
analysis = imagedev.AnalysisMsr.read(imagedev_data.get_object_path("analysis.vip"))

result = imagedev.binary_analysis( polystyrene_sep, polystyrene, analysis )

print( "Area2d: ", str( result.get(imagedev.native_measurements.Area2d).value( 0 ) )  )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
AnalysisMsr analysis = AnalysisMsr.Read( @"Data/objects/analysis.vip" );

AnalysisMsr result = Processing.BinaryAnalysis( polystyrene_sep, polystyrene, analysis );

Console.WriteLine(  "Area2d: " + result.Get( NativeMeasurements.Area2d ).Value( 0 )  );