Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
ofgulban committed Dec 3, 2021
1 parent 6095d84 commit 8727e9f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/LN2_PATCH_FLATTEN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ int main(int argc, char* argv[]) {

// ========================================================================
// Fix input datatype issues
// ========================================================================
nifti_image* nii_input = copy_nifti_as_float32(nii1);
float* nii_input_data = static_cast<float*>(nii_input->data);
nifti_image* coords_uv = copy_nifti_as_float32(nii2);
Expand All @@ -182,6 +183,7 @@ int main(int argc, char* argv[]) {

// ========================================================================
// Determine the type of depth file
// ========================================================================
float min_d = std::numeric_limits<float>::max();
float max_d = std::numeric_limits<float>::min();

Expand Down Expand Up @@ -217,6 +219,7 @@ int main(int argc, char* argv[]) {

// ========================================================================
// Prepare outputs
// ========================================================================
nifti_image* out_cells = copy_nifti_as_int32(domain);
int32_t* out_cells_data = static_cast<int32_t*>(out_cells->data);

Expand All @@ -226,6 +229,7 @@ int main(int argc, char* argv[]) {

// ------------------------------------------------------------------------
// Determine flat image dimensions
// ------------------------------------------------------------------------
int nr_cells = bins_u * bins_v;
if (mode_depth_metric == false) { // Layer file
bins_d = max_d;
Expand Down Expand Up @@ -290,6 +294,7 @@ int main(int argc, char* argv[]) {

// ========================================================================
// Find coordinate ranges
// ========================================================================
float min_u = std::numeric_limits<float>::max();
float max_u = std::numeric_limits<float>::min();
float min_v = std::numeric_limits<float>::max();
Expand Down Expand Up @@ -317,6 +322,7 @@ int main(int argc, char* argv[]) {

// ========================================================================
// Visit each voxel to check their coordinate
// ========================================================================
for (int ii = 0; ii != nr_voi; ++ii) {
int i = *(voi_id + ii);

Expand Down Expand Up @@ -374,7 +380,6 @@ int main(int argc, char* argv[]) {
// ========================================================================
// Optional Voronoi filling for empty flat bins
// ========================================================================

if (mode_voronoi) {
cout << "\n Start Voronoi (nearest neighbor) filling-in..." << endl;

Expand All @@ -394,7 +399,7 @@ int main(int argc, char* argv[]) {
*(flood_dist_data + i) = 0.;
}
}
// ------------------------------------------------------------------------
// --------------------------------------------------------------------

int grow_step = 1, bin_counter = 1;
int ix, iy, iz, j;
Expand Down Expand Up @@ -426,9 +431,9 @@ int main(int argc, char* argv[]) {
tie(ix, iy, iz) = ind2sub_3D(i, size_x, size_y);
bin_counter += 1;

// ------------------------------------------------------------
// --------------------------------------------------------
// 1-jump neighbours
// ------------------------------------------------------------
// --------------------------------------------------------
if (ix > 0) {
j = sub2ind_3D(ix-1, iy, iz, size_x, size_y);
d = *(flood_dist_data + i) + dX;
Expand Down Expand Up @@ -502,9 +507,9 @@ int main(int argc, char* argv[]) {
}
}

// ------------------------------------------------------------
// --------------------------------------------------------
// 2-jump neighbours
// ------------------------------------------------------------
// --------------------------------------------------------

if (ix > 0 && iy > 0) {
j = sub2ind_3D(ix-1, iy-1, iz, size_x, size_y);
Expand Down Expand Up @@ -651,9 +656,9 @@ int main(int argc, char* argv[]) {
}
}

// ------------------------------------------------------------
// --------------------------------------------------------
// 3-jump neighbours
// ------------------------------------------------------------
// --------------------------------------------------------
if (ix > 0 && iy > 0 && iz > 0) {
j = sub2ind_3D(ix-1, iy-1, iz-1, size_x, size_y);
d = *(flood_dist_data + i) + dia_xyz;
Expand Down

0 comments on commit 8727e9f

Please sign in to comment.