diff --git a/src/cpp/writer/tswriter.cpp b/src/cpp/writer/tswriter.cpp index 198cd18..121ecd0 100644 --- a/src/cpp/writer/tswriter.cpp +++ b/src/cpp/writer/tswriter.cpp @@ -70,7 +70,7 @@ TsWriterCPP::TsWriterCPP( } void TsWriterCPP::WriteImageData( - py::array& py_image, + const py::array& py_image, const Seq& rows, const Seq& cols, const std::optional& layers, @@ -108,7 +108,7 @@ void TsWriterCPP::WriteImageData( switch(_dtype_code) { case (1): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); // Write data array to TensorStore auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); @@ -120,7 +120,7 @@ void TsWriterCPP::WriteImageData( break; } case (2): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -129,7 +129,7 @@ void TsWriterCPP::WriteImageData( break; } case (4): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -138,7 +138,7 @@ void TsWriterCPP::WriteImageData( break; } case (8): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -147,7 +147,7 @@ void TsWriterCPP::WriteImageData( break; } case (16): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -156,7 +156,7 @@ void TsWriterCPP::WriteImageData( break; } case (32): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -165,7 +165,7 @@ void TsWriterCPP::WriteImageData( break; } case (64): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -174,7 +174,7 @@ void TsWriterCPP::WriteImageData( break; } case (128): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); // Write data array to TensorStore auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); @@ -184,7 +184,7 @@ void TsWriterCPP::WriteImageData( break; } case (256): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { @@ -193,7 +193,7 @@ void TsWriterCPP::WriteImageData( break; } case (512): { - auto data_array = tensorstore::Array(py_image.mutable_unchecked().data(0), shape, tensorstore::c_order); + auto data_array = tensorstore::Array(py_image.unchecked().data(0), shape, tensorstore::c_order); auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result(); if (!write_result.ok()) { diff --git a/src/cpp/writer/tswriter.h b/src/cpp/writer/tswriter.h index 92dbaa8..98130a4 100644 --- a/src/cpp/writer/tswriter.h +++ b/src/cpp/writer/tswriter.h @@ -21,7 +21,7 @@ class TsWriterCPP{ ); void WriteImageData ( - py::array& py_image, + const py::array& py_image, const Seq& rows, const Seq& cols, const std::optional& layers, diff --git a/src/python/bfiocpp/tsreader.py b/src/python/bfiocpp/tsreader.py index 0d76ad7..ac7ad63 100644 --- a/src/python/bfiocpp/tsreader.py +++ b/src/python/bfiocpp/tsreader.py @@ -18,7 +18,7 @@ def __init__(self, file_name: str, file_type: FileType, axes_list: str) -> None: self._filetype = file_type def data( - self, rows: int, cols: int, layers: int, channels: int, tsteps: int + self, rows: Seq, cols: Seq, layers: Seq, channels: Seq, tsteps: Seq ) -> np.ndarray: return self._image_reader.get_image_data(rows, cols, layers, channels, tsteps)