From 79d0587d97c04d0f8855198ca189c0c0092f0363 Mon Sep 17 00:00:00 2001 From: Martin Opat Date: Mon, 23 Dec 2024 22:16:22 +0100 Subject: [PATCH] Renamed var. for consistency with sphere.h --- src/linalg/mat.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/linalg/mat.h b/src/linalg/mat.h index dfb687d..654597a 100644 --- a/src/linalg/mat.h +++ b/src/linalg/mat.h @@ -1,6 +1,6 @@ #pragma once -__device__ Vec3 computeGradient(float* volData, const int d_volumeWidth, const int d_volumeHeight, const int d_volumeDepth, int x, int y, int z) { +__device__ Vec3 computeGradient(float* volumeData, const int d_volumeWidth, const int d_volumeHeight, const int d_volumeDepth, int x, int y, int z) { // Finite difference for partial derivatives. // For boundary voxels - clamp to the boundary. // Normal should point from higher to lower intensities @@ -13,12 +13,12 @@ __device__ Vec3 computeGradient(float* volData, const int d_volumeWidth, const i int zp = min(z + 1, d_volumeDepth - 1); // Note: Assuming data is linearized (idx = z*w*h + y*w + x) TODO: Unlinearize if data not linear - float gx = volData[z * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + xp] - - volData[z * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + xm]; - float gy = volData[z * d_volumeWidth * d_volumeHeight + yp * d_volumeWidth + x ] - - volData[z * d_volumeWidth * d_volumeHeight + ym * d_volumeWidth + x ]; - float gz = volData[zp * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + x ] - - volData[zm * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + x ]; + float gx = volumeData[z * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + xp] + - volumeData[z * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + xm]; + float gy = volumeData[z * d_volumeWidth * d_volumeHeight + yp * d_volumeWidth + x ] + - volumeData[z * d_volumeWidth * d_volumeHeight + ym * d_volumeWidth + x ]; + float gz = volumeData[zp * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + x ] + - volumeData[zm * d_volumeWidth * d_volumeHeight + y * d_volumeWidth + x ]; return Vec3(gx, gy, gz); }