Skip to content

Commit

Permalink
#37 Fixed bug when running connected components where the last chunk …
Browse files Browse the repository at this point in the history
…was larger on the z axis than the rest.
  • Loading branch information
carljohnsen committed Oct 7, 2024
1 parent 0f04b3c commit 3619457
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/cpp/cpu/connected_components.cc
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ namespace cpu_par {
apply_renaming(chunks + (i*chunk_size), this_chunk_size, renames[i]);
}

// Handle the remainder of the last chunk, if it exists
if (total_z > n_chunks * global_shape.z) {
int64_t last_chunk_size = (total_z - (n_chunks * global_shape.z)) * global_shape.y * global_shape.x;
apply_renaming(chunks + (n_chunks*chunk_size), last_chunk_size, renames[n_chunks-1]);
}

return n_labels[std::get<0>(index_tree[index_tree.size()-1][0])];
}

Expand Down

0 comments on commit 3619457

Please sign in to comment.