|
// ----------------------------------------------------------------------------
//
// Class_Root_Pixel_Get_GLI
//
// Get one pixel from the original GLI image
//
// ----------------------------------------------------------------------------
int Class_Root_Pixel_Get_GLI( SliceO_Class *pt, void *ima, Vect pos )
{
// --- get the associated image and make sure we are inside it ---
if ( ! ima )
return( PIXEL_GLI_INVALID ) ;
Tomo_Image *pt_ima = (Tomo_Image *) ima ;
if ( ! pt_ima->data )
return( PIXEL_GLI_INVALID ) ;
short x = (int) pos.x ;
short y = (int) pos.y ;
short z = (int) pos.z ;
short t = (int) pos.t ;
if ( x < 0 || x >= pt_ima->x
|| y < 0 || y >= pt_ima->y
|| z < 0 || z >= pt_ima->z
|| t < 0 || t >= pt_ima->t )
return( PIXEL_GLI_INVALID ) ;
// --- Get the GLI value of th epixel ---
int GLI_val = Tomo_Image_Pixel_Get_Int( NULL, pt_ima, x, y, z, t ) ;
// --- if this value is outside the FOV mark it as "OUTSIDE" ---
switch( pt_ima->g2.pix_data_type ) {
case DATA_TYPE_SHORT :
case DATA_TYPE_INT :
if ( GLI_val == pt_ima->g2.pix_fill )
return( PIXEL_GLI_OUTSIDE ) ;
break ;
case DATA_TYPE_USHORT :
case DATA_TYPE_UINT :
if ( (unsigned int) GLI_val == (unsigned int) pt_ima->g2.pix_fill )
return( PIXEL_GLI_OUTSIDE ) ;
break ;
case DATA_TYPE_COLOR :
if ( ! INT_BYTE(GLI_val) )
return( PIXEL_GLI_OUTSIDE ) ;
break ;
}
// --- if we got here, we are not outside, so make sure the "OUTSIDE"
// value is not used by mistake ---
if ( GLI_val == PIXEL_GLI_INVALID )
GLI_val = 0x07FFFFFFD ;
if ( GLI_val == PIXEL_GLI_OUTSIDE )
GLI_val = 0x07FFFFFFD ;
return( GLI_val ) ;
}
|