ImageDev

EigenDecomposition3d

Performs the singular value decomposition (SVD) of a 3D 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 3D tensor field). The input image must have six channels, where each channel contains one of the unique components of a 3x3 symmetric matrix. The redundant components are not contained in the input image.

Let $A(P)$ be the 3x3 symmetric matrix at position $P=(x,y,z)$.
The input image $I$ has 6 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 EigenDecomposition3dOutput structure containing the outputVectorImage1, outputVectorImage2, outputVectorImage3 and outputEigenvaluesImage output parameters.
// Output structure.
struct EigenDecomposition3dOutput
{
    std::shared_ptr< iolink::ImageView > outputVectorImage1;
    std::shared_ptr< iolink::ImageView > outputVectorImage2;
    std::shared_ptr< iolink::ImageView > outputVectorImage3;
    std::shared_ptr< iolink::ImageView > outputEigenvaluesImage;
};

// Function prototype.
EigenDecomposition3dOutput
eigenDecomposition3d( std::shared_ptr< iolink::ImageView > inputTensorImage,
                      int32_t outputSelection,
                      std::shared_ptr< iolink::ImageView > outputVectorImage1 = NULL,
                      std::shared_ptr< iolink::ImageView > outputVectorImage2 = NULL,
                      std::shared_ptr< iolink::ImageView > outputVectorImage3 = NULL,
                      std::shared_ptr< iolink::ImageView > outputEigenvaluesImage = NULL );
This function returns a tuple containing the output_vector_image1, output_vector_image2, output_vector_image3 and output_eigenvalues_image output parameters.
// Function prototype.
eigen_decomposition_3d( input_tensor_image,
                        output_selection = 11,
                        output_vector_image1 = None,
                        output_vector_image2 = None,
                        output_vector_image3 = None,
                        output_eigenvalues_image = None )
This function returns a EigenDecomposition3dOutput structure containing the outputVectorImage1, outputVectorImage2, outputVectorImage3 and outputEigenvaluesImage output parameters.
/// Output structure of the EigenDecomposition3d function.
public struct EigenDecomposition3dOutput
{
    public IOLink.ImageView outputVectorImage1;
    public IOLink.ImageView outputVectorImage2;
    public IOLink.ImageView outputVectorImage3;
    public IOLink.ImageView outputEigenvaluesImage;
};

// Function prototype.
public static EigenDecomposition3dOutput
EigenDecomposition3d( IOLink.ImageView inputTensorImage,
                      Int32 outputSelection = 11,
                      IOLink.ImageView outputVectorImage1 = null,
                      IOLink.ImageView outputVectorImage2 = null,
                      IOLink.ImageView outputVectorImage3 = null,
                      IOLink.ImageView outputEigenvaluesImage = null );

Class Syntax

Parameters

Class Name EigenDecomposition3d

Parameter Name Description Type Supported Values Default Value
input
inputTensorImage
The input image of which each voxel represents a 3x3 symmetric matrix. This image must have the float data type and contain 6 channels.
The 6 channels must be in the following order: $(A_{11}, A_{12}, A_{13}, A_{22}, A_{23}, A_{33})$ where $A$ is a symmetric 3x3 matrix (or 3D 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 the computation of the second eigenvector, corresponding to the medium eigenvalue. Associated value = 2.
EIGEN_VECTOR_3 Enable the computation of the third eigenvector, corresponding to the smallest eigenvalue. Associated value = 4.
EIGEN_VALUES Enable the computation of the eigenvalues. Associated value = 8.
MultipleChoice EIGEN_VECTOR_1 | EIGEN_VECTOR_2 | EIGEN_VALUES
output
outputVectorImage1
The first eigenvector output image containing the largest eigenvalue.
The X, Y and Z dimensions of this output image are the same as the input but the number of channels is three (channel 0: X component, channel 1: Y component, channel 2: Z 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 image containing the medium eigenvalue.
The X, Y and Z dimensions of this output image are the same as the input but the number of channels is three (channel 0: X component, channel 1: Y component, channel 2: Z 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
outputVectorImage3
The third eigenvector image containing the smallest eigenvalue.
The X, Y and Z dimensions of this output image are the same as the input but the number of channels is three (channel 0: X component, channel 1: Y component, channel 2: Z 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, Y and Z dimensions of this output image are the same as the input but the number of channels is three (channel 0: largest eigenvalue, channel 1: medium eigenvalue, channel 2: 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

Object Examples

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

EigenDecomposition3d eigenDecomposition3dAlgo;
eigenDecomposition3dAlgo.setInputTensorImage( neuron_hessian );
eigenDecomposition3dAlgo.setOutputSelection( 15 );
eigenDecomposition3dAlgo.execute();

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

eigen_decomposition_3d_algo = imagedev.EigenDecomposition3d()
eigen_decomposition_3d_algo.input_tensor_image = neuron_hessian
eigen_decomposition_3d_algo.output_selection = 15
eigen_decomposition_3d_algo.execute()

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

EigenDecomposition3d eigenDecomposition3dAlgo = new EigenDecomposition3d
{
    inputTensorImage = neuron_hessian,
    outputSelection = 15
};
eigenDecomposition3dAlgo.Execute();

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

Function Examples

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

auto result = eigenDecomposition3d( neuron_hessian, 15 );

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

result_output_vector_image1, result_output_vector_image2, result_output_vector_image3, result_output_eigenvalues_image = imagedev.eigen_decomposition_3d( neuron_hessian, 15 )

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

Processing.EigenDecomposition3dOutput result = Processing.EigenDecomposition3d( neuron_hessian, 15 );

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