Biomedical Engineering Reference
In-Depth Information
Table 3.5 GPU Level Set Timing Results
Operation
Timing(%)
Initialization
0.01
Create masks
2.63
Compute distance transform
34.93
Create GVD
22.92
Redistance f
2.08
Compute regularized dirac
2.51
Compute energy term
18.93
Compute length term
3.80
Compute area term
4.06
Update f
4.98
Render image
3.15
Table 3.6 Jump Flood Distance Transform
void jumpFlood2Df(float2 coords : WPOS,
uniform float jumpStep,
uniform samplerRECT source,
out float4 color : COLOR)
{ float4 currentPixel = texRECT(source, coords);
//Initialize minimum distance and seed coordinates
float minDist = currentPixel.r;
float2 minCoords = currentPixel.gb;
{
}
int stepSign[] =
1,0,-1
;
int counter = 0;
>
{
if( currentPixel.r
0)
<
{
for(int i = 0; i
3;i=i+1)
<
{
for(int j = 0; j
3;j=j+1)
counter = counter + 1;
// Get coordinates for each jump neighbor
float2 jumpCoords = float2(coords.x +
(stepSign[i] * jumpStep),
coords.y + (stepSign[j] * jumpStep));
// Get seed pixel coordinate for jump neighbor
float2 seedCoords = texRECT(source, jumpCoords).gb;
// Find nearest seed pixel from jump neighbors
float seedDist = distance(seedCoords, coords);
<
if(seedDist
minDist)
{ minDist = seedDist;
minCoords = seedCoords;
}
}
}
color = float4(minDist, minCoords.x, minCoords.y, 0);
}
Search WWH ::




Custom Search