|
25 | 25 |
|
26 | 26 | #include "tensorstore/tensorstore.h" |
27 | 27 |
|
| 28 | +using Index = mdio::Index; |
| 29 | + |
28 | 30 | std::string GetNumpyDtypeJson(const tensorstore::DataType& dtype) { |
29 | 31 | using namespace tensorstore; |
30 | 32 |
|
@@ -56,14 +58,14 @@ absl::Status WriteNumpy(const mdio::SharedArray<T, R, OriginKind>& accessor, |
56 | 58 | return absl::InvalidArgumentError("Expected a 3D array"); |
57 | 59 | } |
58 | 60 |
|
59 | | - auto inline_inclusive_min = domain[0].inclusive_min(); |
60 | | - auto inline_exclusive_max = domain[0].exclusive_max(); |
| 61 | + const Index inline_inclusive_min = domain[0].inclusive_min(); |
| 62 | + const Index inline_exclusive_max = domain[0].exclusive_max(); |
61 | 63 |
|
62 | | - auto xline_inclusive_min = domain[1].inclusive_min(); |
63 | | - auto xline_exclusive_max = domain[1].exclusive_max(); |
| 64 | + const Index xline_inclusive_min = domain[1].inclusive_min(); |
| 65 | + const Index xline_exclusive_max = domain[1].exclusive_max(); |
64 | 66 |
|
65 | | - auto depth_inclusive_min = domain[2].inclusive_min(); |
66 | | - auto depth_exclusive_max = domain[2].exclusive_max(); |
| 67 | + const Index depth_inclusive_min = domain[2].inclusive_min(); |
| 68 | + const Index depth_exclusive_max = domain[2].exclusive_max(); |
67 | 69 |
|
68 | 70 | const int width = inline_exclusive_max - inline_inclusive_min; |
69 | 71 | const int height = xline_exclusive_max - xline_inclusive_min; |
@@ -98,9 +100,9 @@ absl::Status WriteNumpy(const mdio::SharedArray<T, R, OriginKind>& accessor, |
98 | 100 | outfile.write(header.str().c_str(), header_size); |
99 | 101 |
|
100 | 102 | // Write the data |
101 | | - for (int il = inline_inclusive_min; il < inline_exclusive_max; ++il) { |
102 | | - for (int xl = xline_inclusive_min; xl < xline_exclusive_max; ++xl) { |
103 | | - for (int zl = depth_inclusive_min; zl < depth_exclusive_max; ++zl) { |
| 103 | + for (Index il = inline_inclusive_min; il < inline_exclusive_max; ++il) { |
| 104 | + for (Index xl = xline_inclusive_min; xl < xline_exclusive_max; ++xl) { |
| 105 | + for (Index zl = depth_inclusive_min; zl < depth_exclusive_max; ++zl) { |
104 | 106 | T value = accessor(il, xl, zl); |
105 | 107 | outfile.write(reinterpret_cast<const char*>(&value), sizeof(T)); |
106 | 108 | } |
|
0 commit comments