|
#include "sliceO_include.hpp"
// ----------------------------------------------------------------------------
//
// Tool_Pixel_Update_Val
//
// Param: (char *) str_1 Pointer to a text representing the GLI value
// (char *) str_1 Pointer to a text representing the TAG value
// (SliceO_Frame *) frame Pointer to the desired frame
// Point_2D *) pos Position of the desired pixel in the frame
//
// Return: (void)
//
// ----------------------------------------------------------------------------
void Tool_Pixel_Update_Val( char *str1, char *str2, SliceO_Frame *frame, Point_2D *pos )
{
if ( ! frame ) {
sprintf( str1, "GLI: ----" ) ;
sprintf( str2, "Tag ---" ) ;
return ;
}
// --- transform 2D pos in 4D info ---
Vect v_pos ;
v_pos.set( (*pos)[0], (*pos)[1], frame->m_z, frame->m_t ) ;
// --- Get the GLI pixel value ---
int GLI_val = frame->Fct_Pixel_Get_GLI( frame, frame->m_ima, v_pos ) ;
// --- make sure the value is valid ---
if ( GLI_val == PIXEL_GLI_INVALID ) {
sprintf( str1, "invalid" ) ;
sprintf( str2, "invalid" ) ;
return ;
}
if ( GLI_val == PIXEL_GLI_OUTSIDE ) {
sprintf( str1, "outside" ) ;
sprintf( str2, "outside" ) ;
return ;
}
// --- special case for RGB images ---
if ( frame->m_pix_type & DATA_TYPE_COLOR ) {
Color val_col ;
val_col.color = GLI_val ;
sprintf( str1, "%3d,%3d,%3d", val_col.col.R, val_col.col.G, val_col.col.B ) ;
return ;
}
// --- convert to floating point value ---
float GLI_float = Fct_GLI_2_Float( frame, GLI_val ) ;
if ( frame->m_pix_type & DATA_TYPE_32BIT )
sprintf( str1, "GLI: %11.4g", GLI_float ) ;
else
sprintf( str1, "GLI: %4.0f", GLI_float ) ;
// --- Get the TAG pixel value ---
unsigned char TAG_val = frame->Fct_Pixel_Get_TAG( frame, frame->m_ima, v_pos ) ;
sprintf( str2, "Tag: %3d", TAG_val ) ;
}
|