ImageDev

CartesianToPolar2d

Transforms a pair of real and imaginary part two-dimensional images into a pair of module and phase images.

Access to parameter description

For an introduction: see section Frequency Domain.

This algorithm computes the cartesian-to-polar transformation or real/imaginary to the module/phase transformation.

If $I_1$ is the real part or $X$ coordinate image and $I_2$ the imaginary part or $Y$ coordinate image, then: See also

Function Syntax

This function returns a CartesianToPolar2dOutput structure containing outputModulusImage and outputPhaseImage.
// Output structure of the cartesianToPolar2d function.
struct CartesianToPolar2dOutput
{
    /// The output modulus image. Its dimensions and type are forced to the same values as the input.
    std::shared_ptr< iolink::ImageView > outputModulusImage;
    /// The output phase image. Its dimensions and type are forced to the same values as the input.
    std::shared_ptr< iolink::ImageView > outputPhaseImage;
};

// Function prototype
CartesianToPolar2dOutput cartesianToPolar2d( std::shared_ptr< iolink::ImageView > inputRealImage, std::shared_ptr< iolink::ImageView > inputImaginaryImage, std::shared_ptr< iolink::ImageView > outputModulusImage = NULL, std::shared_ptr< iolink::ImageView > outputPhaseImage = NULL );
This function returns a tuple containing output_modulus_image and output_phase_image.
// Function prototype.
cartesian_to_polar_2d( input_real_image,
                       input_imaginary_image,
                       output_modulus_image = None,
                       output_phase_image = None )
This function returns a CartesianToPolar2dOutput structure containing outputModulusImage and outputPhaseImage.
/// Output structure of the CartesianToPolar2d function.
public struct CartesianToPolar2dOutput
{
    /// 
    /// The output modulus image. Its dimensions and type are forced to the same values as the input.
    /// 
    public IOLink.ImageView outputModulusImage;
    /// 
    /// The output phase image. Its dimensions and type are forced to the same values as the input.
    /// 
    public IOLink.ImageView outputPhaseImage;
};

// Function prototype.
public static CartesianToPolar2dOutput
CartesianToPolar2d( IOLink.ImageView inputRealImage,
                    IOLink.ImageView inputImaginaryImage,
                    IOLink.ImageView outputModulusImage = null,
                    IOLink.ImageView outputPhaseImage = null );

Class Syntax

Parameters

Class Name CartesianToPolar2d

Parameter Name Description Type Supported Values Default Value
input
inputRealImage
The real part input image. It must be a floating point image. Image Grayscale or Multispectral nullptr
input
inputImaginaryImage
The imaginary part input image. This image must have same dimensions and data type as the real input image. Image Grayscale or Multispectral nullptr
output
outputModulusImage
The output modulus image. Its dimensions and type are forced to the same values as the input. Image nullptr
output
outputPhaseImage
The output phase image. Its dimensions and type are forced to the same values as the input. Image nullptr

Object Examples

auto polystyrene_float = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_float.vip" );

CartesianToPolar2d cartesianToPolar2dAlgo;
cartesianToPolar2dAlgo.setInputRealImage( polystyrene_float );
cartesianToPolar2dAlgo.setInputImaginaryImage( polystyrene_float );
cartesianToPolar2dAlgo.execute();

std::cout << "outputModulusImage:" << cartesianToPolar2dAlgo.outputModulusImage()->toString();
std::cout << "outputPhaseImage:" << cartesianToPolar2dAlgo.outputPhaseImage()->toString();
polystyrene_float = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_float.vip"))

cartesian_to_polar_2d_algo = imagedev.CartesianToPolar2d()
cartesian_to_polar_2d_algo.input_real_image = polystyrene_float
cartesian_to_polar_2d_algo.input_imaginary_image = polystyrene_float
cartesian_to_polar_2d_algo.execute()

print( "output_modulus_image:", str( cartesian_to_polar_2d_algo.output_modulus_image ) )
print( "output_phase_image:", str( cartesian_to_polar_2d_algo.output_phase_image ) )
ImageView polystyrene_float = Data.ReadVipImage( @"Data/images/polystyrene_float.vip" );

CartesianToPolar2d cartesianToPolar2dAlgo = new CartesianToPolar2d
{
    inputRealImage = polystyrene_float,
    inputImaginaryImage = polystyrene_float
};
cartesianToPolar2dAlgo.Execute();

Console.WriteLine( "outputModulusImage:" + cartesianToPolar2dAlgo.outputModulusImage.ToString() );
Console.WriteLine( "outputPhaseImage:" + cartesianToPolar2dAlgo.outputPhaseImage.ToString() );

Function Examples

auto polystyrene_float = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_float.vip" );

auto result = cartesianToPolar2d( polystyrene_float, polystyrene_float );

std::cout << "outputModulusImage:" << result.outputModulusImage->toString();
std::cout << "outputPhaseImage:" << result.outputPhaseImage->toString();
polystyrene_float = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_float.vip"))

result_output_modulus_image, result_output_phase_image = imagedev.cartesian_to_polar_2d( polystyrene_float, polystyrene_float )

print( "output_modulus_image:", str( result_output_modulus_image ) )
print( "output_phase_image:", str( result_output_phase_image ) )
ImageView polystyrene_float = Data.ReadVipImage( @"Data/images/polystyrene_float.vip" );

Processing.CartesianToPolar2dOutput result = Processing.CartesianToPolar2d( polystyrene_float, polystyrene_float );

Console.WriteLine( "outputModulusImage:" + result.outputModulusImage.ToString() );
Console.WriteLine( "outputPhaseImage:" + result.outputPhaseImage.ToString() );