Matrix::GetZRange

Description

Get the dynamic range (Z1, Z2) that is used in the data to image conversion.

Syntax

BOOL GetZRange( double & z1, double & z2 )

Parameters

z1
[output] Lower bound of the matrix data to be mapped in converting to an image, all data below z1 are treated as z1
z2
[output] Upper bound of the matrix data to be mapped in converting to an image, all data above z2 are treated as z2

Return

Returns FALSE if z range is not available and returns TRUE if Z range is available.

Examples

EX1

// Demonstrate the effect of Dynamic Z Range in an image
void Matrix_GetZRange_ex1()
{
    double zRange1, zRange2;
    int ii,jj;
    
    matrix mat1;
    int wNumRows = 100, wNumCols =100;
    vector vTemp;
    vTemp.Data(1, wNumCols);   // // Generate (1,2,...,wNumCols) in this temp vector
    mat1.SetSize( wNumRows, wNumCols );  // Set the number of rows and columns in matrix
    for(ii=0; ii<wNumRows; ii++)
        mat1.SetRow(vTemp, ii);            
    
    MatrixPage MatPg1;
    MatPg1.Create("Origin");
    MatrixLayer MatLy1 = MatPg1.Layers(0);
    MatLy1.SetViewImage();  // Set the view of the matrix to the Image Mode
    Matrix Mat1(MatLy1);
    Mat1 = mat1;
    
    MatrixPage MatPg2;
    MatPg2.Create("Origin");
    MatrixLayer MatLy2 = MatPg2.Layers(0);
    MatLy2.SetViewImage();  // Set the view of the matrix to the Image Mode
    Matrix Mat2(MatLy2);            
    Mat2 = mat1;

    Mat1.SetZRange(0, 100);
    Mat2.SetZRange(0, 100);
    
    // We will widen the dynamic range from the original
    if( Mat1.GetZRange(zRange1, zRange2) )
    {
        printf("  Original Z range in %s: %g -- %g\n",Mat1.GetName(),zRange1,zRange2);
        Mat2.SetZRange(-50, 200);
        Mat2.GetZRange(zRange1, zRange2);
        printf("  Updated Z range in %s: %g -- %g\n",Mat2.GetName(),zRange1,zRange2);
        printf("  Observe the narrower dynamic range of image in %s than original.\n",Mat2.GetName());
    }
}

Remark

Get the dynamic range (Z1, Z2) that is used in data to image conversion.

See Also

Matrix::SetZRangeUpdate, Matrix::SetZRange

Header to Include

origin.h