Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor updates #14

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/cpp/writer/tswriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Seq>& layers,
Expand Down Expand Up @@ -108,7 +108,7 @@ void TsWriterCPP::WriteImageData(
switch(_dtype_code)
{
case (1): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::uint8_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::uint8_t, 1>().data(0), shape, tensorstore::c_order);

// Write data array to TensorStore
auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
Expand All @@ -120,7 +120,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (2): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::uint16_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::uint16_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -129,7 +129,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (4): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::uint32_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::uint32_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -138,7 +138,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (8): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::uint64_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::uint64_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -147,7 +147,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (16): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::int8_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::int8_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -156,7 +156,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (32): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::int16_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::int16_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -165,7 +165,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (64): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::int32_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::int32_t, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -174,7 +174,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (128): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<std::int64_t, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<std::int64_t, 1>().data(0), shape, tensorstore::c_order);

// Write data array to TensorStore
auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
Expand All @@ -184,7 +184,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (256): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<float, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<float, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand All @@ -193,7 +193,7 @@ void TsWriterCPP::WriteImageData(
break;
}
case (512): {
auto data_array = tensorstore::Array(py_image.mutable_unchecked<double, 1>().data(0), shape, tensorstore::c_order);
auto data_array = tensorstore::Array(py_image.unchecked<double, 1>().data(0), shape, tensorstore::c_order);

auto write_result = tensorstore::Write(tensorstore::UnownedToShared(data_array), _source | output_transform).result();
if (!write_result.ok()) {
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/writer/tswriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Seq>& layers,
Expand Down
2 changes: 1 addition & 1 deletion src/python/bfiocpp/tsreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading