ImageDev

EigenDecomposition2d

Performs the singular value decomposition (SVD) of a 2D tensor field image.

Access to parameter description

This algorithm creates one or several output images containing the eigenvectors and/or eigenvalues of the input matrix image $I$ (or 2D tensor field). The input image must have three channels, where each channel contains one of the unique components of a 2x2 symmetric matrix. The redundant components are not contained in the input image.

Let $A(P)$ be the 2x2 symmetric matrix at position $P=(x,y)$.
The input image $I$ has three spectral component values $s$ at the spatial position $P$: Where $I(P,s)$ is the spectral component value $s$ at the spatial position $P$.

See also

Function Syntax

This function returns a EigenDecomposition2dOutput structure containing outputVectorImage1, outputVectorImage2 and outputEigenvaluesImage.
// Output structure of the eigenDecomposition2d function.
struct EigenDecomposition2dOutput
{
    /// The first eigenvector output image containing the largest eigenvalue.
    std::shared_ptr< iolink::ImageView > outputVectorImage1;
    /// The second eigenvector output image containing the smallest eigenvalue.
    std::shared_ptr< iolink::ImageView > outputVectorImage2;
    /// The eigenvalues output image. Each channel corresponds to an eigenvalue, from the largest to the smallest.
    std::shared_ptr< iolink::ImageView > outputEigenvaluesImage;
};

// Function prototype
EigenDecomposition2dOutput eigenDecomposition2d( std::shared_ptr< iolink::ImageView > inputTensorImage, int32_t outputSelection, std::shared_ptr< iolink::ImageView > outputVectorImage1 = nullptr, std::shared_ptr< iolink::ImageView > outputVectorImage2 = nullptr, std::shared_ptr< iolink::ImageView > outputEigenvaluesImage = nullptr );
This function returns a tuple containing output_vector_image1, output_vector_image2 and output_eigenvalues_image.
// Function prototype.
eigen_decomposition_2d(input_tensor_image: idt.ImageType,
                       output_selection: Union[int, str, EigenDecomposition2d.OutputSelection] = 5,
                       output_vector_image1: idt.ImageType = None,
                       output_vector_image2: idt.ImageType = None,
                       output_eigenvalues_image: idt.ImageType = None) -> Tuple[idt.ImageType, idt.ImageType, idt.ImageType]
This function returns a EigenDecomposition2dOutput structure containing outputVectorImage1, outputVectorImage2 and outputEigenvaluesImage.
/// Output structure of the EigenDecomposition2d function.
public struct EigenDecomposition2dOutput
{
    /// The first eigenvector output image containing the largest eigenvalue.
    public IOLink.ImageView outputVectorImage1;
    /// The second eigenvector output image containing the smallest eigenvalue.
    public IOLink.ImageView outputVectorImage2;
    /// 
    /// The eigenvalues output image. Each channel corresponds to an eigenvalue, from the largest to the smallest.
    /// 
    public IOLink.ImageView outputEigenvaluesImage;
};

// Function prototype.
public static EigenDecomposition2dOutput
EigenDecomposition2d( IOLink.ImageView inputTensorImage,
                      Int32 outputSelection = 5,
                      IOLink.ImageView outputVectorImage1 = null,
                      IOLink.ImageView outputVectorImage2 = null,
                      IOLink.ImageView outputEigenvaluesImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputTensorImage
The input image of which each pixel represents a 2x2 symmetric matrix. This image must have the float data type and contain three channels.
The three channels must be in the following order: $(A_{11}, A_{12}, A_{22})$ where $A$ is a symmetric 2x2 matrix (or 2D tensor).
Image Binary, Label or Multispectral nullptr
input
outputSelection
The output images to be computed. Several outputs can be generated by combining the associated enumerated values.
EIGEN_VECTOR_1 Enable the computation of the first eigenvector, corresponding to the largest eigenvalue. Associated value = 1.
EIGEN_VECTOR_2 Enable computation of second eigenvector, corresponding to the smallest eigenvalue. Associated value = 2.
EIGEN_VALUES Enable the computation of the eigenvalues. Associated value = 4.
MultipleChoice EIGEN_VECTOR_1 | EIGEN_VALUES
output
outputVectorImage1
The first eigenvector output image containing the largest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
Image nullptr
output
outputVectorImage2
The second eigenvector output image containing the smallest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
Image nullptr
output
outputEigenvaluesImage
The eigenvalues output image. Each channel corresponds to an eigenvalue, from the largest to the smallest.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: largest eigenvalue, channel 1: smallest eigenvalue). The calibration (voxel size, origin, orientation) is the same values as the input image. The output data type is forced to float.
Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_tensor_image
The input image of which each pixel represents a 2x2 symmetric matrix. This image must have the float data type and contain three channels.
The three channels must be in the following order: $(A_{11}, A_{12}, A_{22})$ where $A$ is a symmetric 2x2 matrix (or 2D tensor).
image Binary, Label or Multispectral None
input
output_selection
The output images to be computed. Several outputs can be generated by combining the associated enumerated values.
EIGEN_VECTOR_1 Enable the computation of the first eigenvector, corresponding to the largest eigenvalue. Associated value = 1.
EIGEN_VECTOR_2 Enable computation of second eigenvector, corresponding to the smallest eigenvalue. Associated value = 2.
EIGEN_VALUES Enable the computation of the eigenvalues. Associated value = 4.
multiple_choice EIGEN_VECTOR_1 | EIGEN_VALUES
output
output_vector_image1
The first eigenvector output image containing the largest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
image None
output
output_vector_image2
The second eigenvector output image containing the smallest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
image None
output
output_eigenvalues_image
The eigenvalues output image. Each channel corresponds to an eigenvalue, from the largest to the smallest.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: largest eigenvalue, channel 1: smallest eigenvalue). The calibration (voxel size, origin, orientation) is the same values as the input image. The output data type is forced to float.
image None
Parameter Name Description Type Supported Values Default Value
input
inputTensorImage
The input image of which each pixel represents a 2x2 symmetric matrix. This image must have the float data type and contain three channels.
The three channels must be in the following order: $(A_{11}, A_{12}, A_{22})$ where $A$ is a symmetric 2x2 matrix (or 2D tensor).
Image Binary, Label or Multispectral null
input
outputSelection
The output images to be computed. Several outputs can be generated by combining the associated enumerated values.
EIGEN_VECTOR_1 Enable the computation of the first eigenvector, corresponding to the largest eigenvalue. Associated value = 1.
EIGEN_VECTOR_2 Enable computation of second eigenvector, corresponding to the smallest eigenvalue. Associated value = 2.
EIGEN_VALUES Enable the computation of the eigenvalues. Associated value = 4.
MultipleChoice EIGEN_VECTOR_1 | EIGEN_VALUES
output
outputVectorImage1
The first eigenvector output image containing the largest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
Image null
output
outputVectorImage2
The second eigenvector output image containing the smallest eigenvalue.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: X component, channel 1: Y component). The calibration (voxel size, origin, orientation) is the same as the input image. The output data type is forced to float.
Image null
output
outputEigenvaluesImage
The eigenvalues output image. Each channel corresponds to an eigenvalue, from the largest to the smallest.
The X and Y dimensions of this output image are the same as the input but the number of channels is two (channel 0: largest eigenvalue, channel 1: smallest eigenvalue). The calibration (voxel size, origin, orientation) is the same values as the input image. The output data type is forced to float.
Image null

Object Examples

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

EigenDecomposition2d eigenDecomposition2dAlgo;
eigenDecomposition2dAlgo.setInputTensorImage( retina_hessian );
eigenDecomposition2dAlgo.setOutputSelection( 7 );
eigenDecomposition2dAlgo.execute();

std::cout << "outputVectorImage1:" << eigenDecomposition2dAlgo.outputVectorImage1()->toString();
std::cout << "outputVectorImage2:" << eigenDecomposition2dAlgo.outputVectorImage2()->toString();
std::cout << "outputEigenvaluesImage:" << eigenDecomposition2dAlgo.outputEigenvaluesImage()->toString();
retina_hessian = imagedev.read_vip_image(imagedev_data.get_image_path("retina_hessian.vip"))

eigen_decomposition_2d_algo = imagedev.EigenDecomposition2d()
eigen_decomposition_2d_algo.input_tensor_image = retina_hessian
eigen_decomposition_2d_algo.output_selection = 7
eigen_decomposition_2d_algo.execute()

print("output_vector_image1:", str(eigen_decomposition_2d_algo.output_vector_image1))
print("output_vector_image2:", str(eigen_decomposition_2d_algo.output_vector_image2))
print("output_eigenvalues_image:", str(eigen_decomposition_2d_algo.output_eigenvalues_image))
ImageView retina_hessian = Data.ReadVipImage( @"Data/images/retina_hessian.vip" );

EigenDecomposition2d eigenDecomposition2dAlgo = new EigenDecomposition2d
{
    inputTensorImage = retina_hessian,
    outputSelection = 7
};
eigenDecomposition2dAlgo.Execute();

Console.WriteLine( "outputVectorImage1:" + eigenDecomposition2dAlgo.outputVectorImage1.ToString() );
Console.WriteLine( "outputVectorImage2:" + eigenDecomposition2dAlgo.outputVectorImage2.ToString() );
Console.WriteLine( "outputEigenvaluesImage:" + eigenDecomposition2dAlgo.outputEigenvaluesImage.ToString() );

Function Examples

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

auto result = eigenDecomposition2d( retina_hessian, 7 );

std::cout << "outputVectorImage1:" << result.outputVectorImage1->toString();
std::cout << "outputVectorImage2:" << result.outputVectorImage2->toString();
std::cout << "outputEigenvaluesImage:" << result.outputEigenvaluesImage->toString();
retina_hessian = imagedev.read_vip_image(imagedev_data.get_image_path("retina_hessian.vip"))

result_output_vector_image1, result_output_vector_image2, result_output_eigenvalues_image = imagedev.eigen_decomposition_2d(retina_hessian, 7)

print("output_vector_image1:", str(result_output_vector_image1))
print("output_vector_image2:", str(result_output_vector_image2))
print("output_eigenvalues_image:", str(result_output_eigenvalues_image))
ImageView retina_hessian = Data.ReadVipImage( @"Data/images/retina_hessian.vip" );

Processing.EigenDecomposition2dOutput result = Processing.EigenDecomposition2d( retina_hessian, 7 );

Console.WriteLine( "outputVectorImage1:" + result.outputVectorImage1.ToString() );
Console.WriteLine( "outputVectorImage2:" + result.outputVectorImage2.ToString() );
Console.WriteLine( "outputEigenvaluesImage:" + result.outputEigenvaluesImage.ToString() );