Positron emission tomography (PET) is a nuclear medicine imaging technique which produces a three-dimensional image or picture of functional processes in the body. The system detects pairs of gamma rays emitted indirectly by a positron-emitting radionuclide (tracer), which is introduced into the body on a biologically active molecule. Images of tracer concentration in 3-dimensional or 4-dimensional space (the 4th dimension being time) within the body are then reconstructed by computer analysis. In modern scanners, this reconstruction is often accomplished with the aid of a CT X-ray scan performed on the patient during the same session, in the same machine. [2]
vec4 T1orCTbasedonPET( vec3 pos ){
vec4 texel = texture3D(PET, pos);
//If the PET high enough?
if ( texel.a > 0.6 ){
float mriv = texture3D( MRIT1, pos ).a;
//Make the PET color darker
//and more transparent
//in areas with low T1
texel.rgb *= mriv;
texel.a = mriv;
}
// if not, then use CT
else{
texel = texture1D(cmCT, texture3D(CT,pos).a );
}
return texel;
}
bool through_bone = false;
bool inside_bone = false;
// Resulting texel color
vec4 texel = vec4( 0,0,0,0 );
Raycasting Loop{
vec4 voxel = vec4( 0,0,0,0 );
float cta = texture1D(colormap,texture3D(CT,pos).a).a;
if ( ! through_bone ){
if (inside_bone){
if (cta < 0.1 )
through_bone = true;
}
else{
if (cta > 0.1 )
inside_bone = true;
}
}
else{
voxel = texture3D( PET, pos );
voxel.a = texture3D( MRIT1, pos ).a;
}
texel += blend( texel, voxel );
}

vec4 mri_difference( vec3 pos ){
float value = texture3D( MRIT1, pos ).a
- texture3D( MRIT2, pos ).a;
//Enlarge the difference by a factor (e.g., 20)
//to highlight the differences
value = 20*value;
vec4 texel = texture1D(diverging_cmap,(value+1.0)*0.5 );
return texel;
}