Skip to content

Commit 6e6f6af

Browse files
fix(color_connectivity_graph): 6-connected was improperly limited to uint32
1 parent 148dd18 commit 6e6f6af

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

cc3d/cc3d_graphs.hpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -740,19 +740,9 @@ OUT* color_connectivity_graph_26(
740740
return simplified_relabel<OUT>(out_labels, voxels, new_label, equivalences, N);
741741
}
742742

743-
template <typename OUT>
744-
OUT* color_connectivity_graph_6(
745-
const uint8_t* vcg, // voxel connectivity graph
746-
const int64_t sx, const int64_t sy, const int64_t sz,
747-
OUT* out_labels = NULL,
748-
size_t &N = _dummy_N
749-
) {
750-
throw new std::runtime_error("6-connectivity requires a 32-bit voxel graph for color_connectivity_graph_6.");
751-
}
752-
753-
template <typename OUT>
743+
template <typename VCG_t, typename OUT>
754744
OUT* color_connectivity_graph_6(
755-
const uint32_t* vcg, // voxel connectivity graph
745+
const VCG_t* vcg, // voxel connectivity graph
756746
const int64_t sx, const int64_t sy, const int64_t sz,
757747
OUT* out_labels = NULL,
758748
size_t &N = _dummy_N
@@ -1106,7 +1096,7 @@ OUT* color_connectivity_graph_N(
11061096
}
11071097
}
11081098
else if (connectivity == 6) {
1109-
return color_connectivity_graph_6<OUT>(vcg, sx, sy, sz, out_labels, N);
1099+
return color_connectivity_graph_6<VCG_t, OUT>(vcg, sx, sy, sz, out_labels, N);
11101100
}
11111101
else {
11121102
return color_connectivity_graph_26<OUT>(vcg, sx, sy, sz, out_labels, N);

cc3d/fastcc3d.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,8 @@ def color_connectivity_graph(
963963
cdef int sy = shape[1]
964964
cdef int sz = shape[2]
965965
966-
if connectivity in [6, 26] and sz > 1 and dtype != np.uint32:
967-
raise ValueError(f"Only uint32 is supported for 3d connectivites. Got: {vcg.dtype}")
966+
if connectivity in [18, 26] and sz > 1 and dtype != np.uint32:
967+
raise ValueError(f"Only uint32 is supported for 18 and 26 connected. Got: {vcg.dtype}")
968968
969969
cdef uint8_t[:,:,:] arr_memview8u
970970
cdef uint32_t[:,:,:] arr_memview32u

0 commit comments

Comments
 (0)