2.2.3.8.21 Matrix::SetZRangeSetZRange
Description
Set the dynamic range of this Matrix (Z1, Z2) that is used in data to image conversion.
Syntax
BOOL SetZRange( double z1, double z2, BOOL bRound = FALSE )
Parameters
- z1
- [input] Lower bound of the matrix data to be mapped in converting to an image, all data below z1 are treated as z1
- z2
- [input] Upper bound of the matrix data to be mapped in converting to an image, all data above z2 are treated as z2
- bRound
- [input] TRUE to use 256 to round the z1 z2 values, FALSE (default) will use values as they are without rounding
Return
Returns FALSE if z1 and z2 are not valid for setting the dynamic range otherwise returns TRUE.
Examples
EX1
// Demonstrate the effect of Dynamic Z Range in an image
void Matrix_SetZRange_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
Set the dynamic range of this Matrix (Z1, Z2) that is used in data to image conversion.
This method calls SetZRangeUpdate(FALSE) as there is no need to recalculate the Z range from the Matrix data when explicitly setting it.
See Also
Matrix::SetZRangeUpdate, Matrix::GetZRange
Header to Include
origin.h
|