Skip to content

Commit

Permalink
#37 Updated the function signatures of the connected components funct…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
carljohnsen committed Sep 4, 2024
1 parent 1f5475d commit 62c4576
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/cpp/include/connected_components.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace NS {
std::vector<std::vector<std::tuple<int64_t, int64_t>>> generate_adjacency_tree(const int64_t chunks);
std::vector<idx3d> merge_canonical_names(const std::vector<idx3d> &names_a, const std::vector<idx3d> &names_b);
std::vector<int64_t> merge_labels(mapping_t &mapping_a, const mapping_t &mapping_b, const std::vector<int64_t> &to_rename_b);
int64_t merge_labeled_chunks(int64_t *chunks, const int64_t n_chunks, const int64_t *n_labels, const idx3d &global_shape, const bool verbose);
int64_t merge_labeled_chunks(int64_t *chunks, const int64_t n_chunks, int64_t *n_labels, const idx3d &global_shape, const int64_t total_z, const bool verbose);
int64_t recount_labels(const mapping_t &mapping_a, mapping_t &mapping_b, std::vector<int64_t> &to_rename_a, std::vector<int64_t> &to_rename_b);
std::tuple<std::vector<int64_t>, std::vector<int64_t>, int64_t> relabel(const std::vector<int64_t> &a, const int64_t n_labels_a, const std::vector<int64_t> &b, const int64_t n_labels_b, const idx3d &global_shape, const bool verbose);
void rename_mapping(mapping_t &mapping_a, const std::vector<int64_t> &to_rename_other);
Expand Down
3 changes: 2 additions & 1 deletion src/pybind/connected_components-pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace python_api {

const idx3d chunk_shape = {nz, ny, nx};

return NS::merge_labeled_chunks(chunks, n_chunks, n_labels, chunk_shape, verbose);
return NS::merge_labeled_chunks(chunks, n_chunks, n_labels, chunk_shape, n_chunks*nz, verbose);
}

int64_t connected_components(const std::string &base_path, np_array<int64_t> &py_n_labels, const std::tuple<int64_t, int64_t, int64_t> &py_total_shape, const std::tuple<int64_t, int64_t, int64_t> &py_global_shape, const bool verbose = false) {
Expand Down Expand Up @@ -58,6 +58,7 @@ namespace python_api {
PYBIND11_MODULE(connected_components, m) {
m.doc() = "Connected Components"; // optional module docstring

m.def("cc3d_call", &python_api::cc3d_call, py::arg("np_image").noconvert(), py::arg("np_result").noconvert(), py::arg("verbose") = false);
m.def("connected_components", &python_api::connected_components, py::arg("base_path"), py::arg("np_n_labels"), py::arg("total_shape"), py::arg("global_shape"), py::arg("verbose") = false);
m.def("largest_connected_component", &python_api::largest_connected_component, py::arg("result").noconvert(), py::arg("base_path"), py::arg("np_n_labels"), py::arg("total_shape"), py::arg("global_shape"), py::arg("verbose") = false);
m.def("merge_labeled_chunks", &python_api::merge_labeled_chunks, py::arg("np_chunks").noconvert(), py::arg("np_n_labels").noconvert(), py::arg("verbose") = false);
Expand Down

0 comments on commit 62c4576

Please sign in to comment.