Skip to content

Commit

Permalink
Fix structured binding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeul committed Jun 17, 2024
1 parent eba8cde commit c53d005
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/chunked_base_to_pyr_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void ChunkedBaseToPyramid::WriteDownsampledImage( const std::string& input_fil
th_pool.push_task([ &store1, &store2,
prev_x_start, prev_x_end, prev_y_start, prev_y_end,
x_start, x_end, y_start, y_end,
x_dim, y_dim, c_dim, c, v, downsampling_func_ptr](){
x_dim=x_dim, y_dim=y_dim, c_dim=c_dim, c, v, downsampling_func_ptr](){
std::vector<T> read_buffer((prev_x_end-prev_x_start)*(prev_y_end-prev_y_start));
auto array = tensorstore::Array(read_buffer.data(), {prev_y_end-prev_y_start, prev_x_end-prev_x_start}, tensorstore::c_order);

Expand Down
2 changes: 1 addition & 1 deletion src/chunked_pyramid_assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ ImageInfo OmeTiffCollToChunked::Assemble(const std::string& input_dir,

auto t4 = std::chrono::high_resolution_clock::now();
for(const auto& i: image_vec){
th_pool.push_task([&dest, i, x_dim, y_dim, c_dim, v, &whole_image](){
th_pool.push_task([&dest, i, x_dim=x_dim, y_dim=y_dim, c_dim=c_dim, v, &whole_image](){


TENSORSTORE_CHECK_OK_AND_ASSIGN(auto source, tensorstore::Open(
Expand Down
4 changes: 2 additions & 2 deletions src/ome_tiff_to_chunked_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace argolid {
void OmeTiffToChunkedConverter::Convert( const std::string& input_file, const std::string& output_file,
const std::string& scale_key, const VisType v, BS::thread_pool& th_pool){

auto [x_dim, y_dim, c_dim, num_dims] = GetZarrParams(v);
const auto [x_dim, y_dim, c_dim, num_dims] = GetZarrParams(v);

TENSORSTORE_CHECK_OK_AND_ASSIGN(auto store1, tensorstore::Open(GetOmeTiffSpecToRead(input_file),
tensorstore::OpenMode::open,
Expand Down Expand Up @@ -70,7 +70,7 @@ void OmeTiffToChunkedConverter::Convert( const std::string& input_file, const st
for(std::int64_t j=0; j<num_cols; ++j){
std::int64_t x_start = j*chunk_shape[x_dim];
std::int64_t x_end = std::min({(j+1)*chunk_shape[x_dim], image_width});
th_pool.push_task([&store1, &store2, x_start, x_end, y_start, y_end, x_dim, y_dim, v](){
th_pool.push_task([&store1, &store2, x_start, x_end, y_start, y_end, x_dim=x_dim, y_dim=y_dim, v](){

auto array = tensorstore::AllocateArray({y_end-y_start, x_end-x_start},tensorstore::c_order,
tensorstore::value_init, store1.dtype());
Expand Down
4 changes: 2 additions & 2 deletions src/pyramid_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace argolid {

auto t4 = std::chrono::high_resolution_clock::now();
for (const auto & [file_name, location]: base_image_map) {
th_pool.push_task([ & dest, file_name, location, x_dim, y_dim, c_dim, v, & whole_image, this]() {
th_pool.push_task([ & dest, file_name, location, x_dim=x_dim, y_dim=y_dim, c_dim=c_dim, v, & whole_image, this]() {

TENSORSTORE_CHECK_OK_AND_ASSIGN(auto source, tensorstore::Open(
GetOmeTiffSpecToRead(image_coll_path + "/" + file_name),
Expand Down Expand Up @@ -227,7 +227,7 @@ namespace argolid {
continue;
}

th_pool.push_task([ & base_store, & dest, file_name, location, base_location, x_dim, y_dim, c_dim, v, this]() {
th_pool.push_task([ & base_store, & dest, file_name, location, base_location, x_dim=x_dim, y_dim=y_dim, c_dim=c_dim, v, this]() {

const auto & [x_grid_base, y_grid_base, c_grid_base] = base_location.value();

Expand Down
5 changes: 5 additions & 0 deletions src/python/pyramid_python_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "../ome_tiff_to_chunked_pyramid.h"
#include "../pyramid_view.h"
#include "../utilities.h"
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand All @@ -11,6 +12,10 @@ PYBIND11_MODULE(libargolid, m) {
.def("GenerateFromCollection", &argolid::OmeTiffToChunkedPyramid::GenerateFromCollection) \
.def("SetLogLevel", &argolid::OmeTiffToChunkedPyramid::SetLogLevel) ;

py::class_<argolid::PyramidView, std::shared_ptr<argolid::PyramidView>>(m, "PyramidViewCPP") \
.def(py::init<std::string_view, std::string, std::string, std::string, argolid::image_map&>()) \
.def("GeneratePyramid", &argolid::PyramidView::GeneratePyramid);

py::enum_<argolid::VisType>(m, "VisType")
.value("NG_Zarr", argolid::VisType::NG_Zarr)
.value("PCNG", argolid::VisType::PCNG)
Expand Down

0 comments on commit c53d005

Please sign in to comment.