Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable specifying the field update rule #104

Merged
merged 16 commits into from
Oct 14, 2019
Merged
Prev Previous commit
Fixes for the binary function on GPU
  • Loading branch information
simeks committed Oct 14, 2019
commit a03bb23f868dd313f19aaee17dd4162e4697deb2
23 changes: 13 additions & 10 deletions src/deform_lib/registration/gpu/cost_functions/binary_function.cu
Original file line number Diff line number Diff line change
@@ -134,10 +134,13 @@ __global__ void regularizer_kernel(
half_exponent
);

// Here we need to think in reverse, since this are the costs for the
// neighbouring node. I.e. E01 => E10

cost_x(gx-1,gy,gz).x = weight*inv_spacing2_exp.x*e.x;
cost_x(gx-1,gy,gz).y = weight*inv_spacing2_exp.x*e.y;
cost_x(gx-1,gy,gz).y = weight*inv_spacing2_exp.x*e.z;
cost_x(gx-1,gy,gz).z = weight*inv_spacing2_exp.x*e.x; // border nodes can't move
cost_x(gx-1,gy,gz).w = cost_x(gx-1,gy,gz).x;
cost_x(gx-1,gy,gz).w = cost_x(gx-1,gy,gz).z;
}

if (y == 0 && gy != 0) {
@@ -154,10 +157,10 @@ __global__ void regularizer_kernel(
half_exponent
);

cost_x(gx,gy-1,gz).x = weight*inv_spacing2_exp.x*e.x;
cost_x(gx,gy-1,gz).y = weight*inv_spacing2_exp.x*e.y;
cost_x(gx,gy-1,gz).z = weight*inv_spacing2_exp.x*e.x; // border nodes can't move
cost_x(gx,gy-1,gz).w = cost_x(gx,gy-1,gz).x;
cost_y(gx,gy-1,gz).x = weight*inv_spacing2_exp.y*e.x;
cost_y(gx,gy-1,gz).y = weight*inv_spacing2_exp.y*e.z;
cost_y(gx,gy-1,gz).z = weight*inv_spacing2_exp.y*e.x; // border nodes can't move
cost_y(gx,gy-1,gz).w = cost_y(gx,gy-1,gz).z;
}

if (z == 0 && gz != 0) {
@@ -174,10 +177,10 @@ __global__ void regularizer_kernel(
half_exponent
);

cost_x(gx,gy,gz-1).x = weight*inv_spacing2_exp.x*e.x;
cost_x(gx,gy,gz-1).y = weight*inv_spacing2_exp.x*e.y;
cost_x(gx,gy,gz-1).z = weight*inv_spacing2_exp.x*e.x; // border nodes can't move
cost_x(gx,gy,gz-1).w = cost_x(gx,gy,gz-1).x;
cost_z(gx,gy,gz-1).x = weight*inv_spacing2_exp.z*e.x;
cost_z(gx,gy,gz-1).y = weight*inv_spacing2_exp.z*e.z;
cost_z(gx,gy,gz-1).z = weight*inv_spacing2_exp.z*e.x; // border nodes can't move
cost_z(gx,gy,gz-1).w = cost_z(gx,gy,gz-1).z;
}
}