Skip to content

Commit 9d7418f

Browse files
melissawmaliddell
andauthored
Apply suggestions from code review
Co-authored-by: Alan Liddell <[email protected]>
1 parent 37aeb5d commit 9d7418f

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

docs/api_reference/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="card">
1010
<h4>C API Reference</h4>
11-
<p>Information on classes and methods</p>
11+
<p>Information on structures and methods</p>
1212
<a href="c_api" class="button">C API Reference</a>
1313
</div>
1414
</div>

docs/get_started.md

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Get Started
2-
The `acquire-zarr` library provides bindings in Python and C.
2+
The `acquire-zarr` library provides both Python and C interfaces.
33

4-
## Get Started with the Python Bindings
4+
## Get Started with Python
55

66
### Install the Python library
77

@@ -16,7 +16,7 @@ python -m pip install acquire-zarr
1616
We recommend installing `acquire-zarr` in a fresh conda environment or virtualenv.
1717
For example, to install `acquire-zarr` in a conda environment named `acquire`:
1818

19-
```
19+
```shell
2020
conda create -n acquire python #compatible with python 3.9-3.13
2121
conda activate acquire
2222
python -m pip install acquire-zarr
@@ -38,7 +38,7 @@ import acquire_zarr
3838

3939
#### Usage
4040

41-
The library provides two main interfaces. First, `ZarrStream`, representing an output stream to a Zarr dataset.
41+
The library provides two main classes. First, `ZarrStream`, representing an output stream to a Zarr dataset.
4242
Second, `ZarrStreamSettings` to configure a Zarr stream.
4343

4444
A typical use case for a 4-dimensional acquisition in Python might look like this:
@@ -101,75 +101,77 @@ To build the Python bindings from source, follow [these instructions](https://gi
101101

102102
The `acquire-zarr` C library is distributed as a binary and headers, which you can download for your system from our [Releases page](https://github.com/acquire-project/acquire-zarr/releases). You will also need to install the following dependencies:
103103

104-
- [c-blosc](https://github.com/Blosc/c-blosc) >= 1.21.5
105-
- [nlohmann-json](https://github.com/nlohmann/json) >= 3.11.3
106-
- [minio-cpp](https://github.com/minio/minio-cpp) >= 0.3.0
107-
- [crc32c](https://github.com/google/crc32c) >= 1.1.2 [this is missing in the README, I will add it back in]
104+
- [c-blosc](https://github.com/Blosc/c-blosc) >= 1.21.5
105+
- [nlohmann-json](https://github.com/nlohmann/json) >= 3.11.3
106+
- [minio-cpp](https://github.com/minio/minio-cpp) >= 0.3.0
107+
- [crc32c](https://github.com/google/crc32c) >= 1.1.2
108108

109109
We suggest using [vcpkg](https://github.com/microsoft/vcpkg) or another package manager to handle dependencies.
110110

111111
[Here](https://github.com/acquire-project/acquire-zarr/blob/main/examples/CMakeLists.txt) is an example CMakeLists.txt file of C executables using acquire-zarr.
112112

113113
#### Usage
114114

115-
The library provides two main interfaces. First, `ZarrStream`, representing an output stream to a Zarr dataset.
115+
The library provides two main structs. First, `ZarrStream`, representing an output stream to a Zarr dataset.
116116
Second, `ZarrStreamSettings` to configure a Zarr stream.
117117

118118
A typical use case for a 4-dimensional acquisition in C might look like this:
119119

120120
```c
121-
ZarrStreamSettings settings = (ZarrStreamSettings){
122-
.store_path = "my_stream.zarr",
123-
.data_type = ZarrDataType_uint16,
124-
.version = ZarrVersion_3,
125-
};
126-
settings.store_path = "my_stream.zarr";
127-
settings.data_type = ZarrDataType_uint16;
128-
settings.version = ZarrVersion_3;
129-
130-
ZarrStreamSettings_create_dimension_array(&settings, 4);
131-
settings.dimensions[0] = (ZarrDimensionProperties){
132-
.name = "t",
133-
.type = ZarrDimensionType_Time,
134-
.array_size_px = 0, // this is the append dimension
135-
.chunk_size_px = 100, // 100 time points per chunk
136-
.shard_size_chunks = 10, // 10 chunks per shard
137-
};
138-
139-
settings.dimensions[1] = (ZarrDimensionProperties){
140-
.name = "c",
141-
.type = ZarrDimensionType_Channel,
142-
.array_size_px = 3, // 3 channels
143-
.chunk_size_px = 1, // 1 channel per chunk
144-
.shard_size_chunks = 1, // 1 chunk per shard
145-
};
146-
147-
settings.dimensions[2] = (ZarrDimensionProperties){
148-
.name = "y",
149-
.type = ZarrDimensionType_Space,
150-
.array_size_px = 1080, // height
151-
.chunk_size_px = 270, // 4 x 4 tiles of size 270 x 480
152-
.shard_size_chunks = 2, // 2 x 2 tiles per shard
153-
};
154-
155-
settings.dimensions[3] = (ZarrDimensionProperties){
156-
.name = "x",
157-
.type = ZarrDimensionType_Space,
158-
.array_size_px = 1920, // width
159-
.chunk_size_px = 480, // 4 x 4 tiles of size 270 x 480
160-
.shard_size_chunks = 2, // 2 x 2 tiles per shard
161-
};
162-
163-
ZarrStream* stream = ZarrStream_create(&settings);
164-
165-
size_t bytes_written;
166-
ZarrStream_append(stream, my_frame_data, my_frame_size, &bytes_written);
167-
assert(bytes_written == my_frame_size);
121+
#include "acquire.zarr.h"
122+
#include "assert.h"
123+
124+
int main() {
125+
ZarrStreamSettings settings = (ZarrStreamSettings){
126+
.store_path = "my_stream.zarr",
127+
.data_type = ZarrDataType_uint16,
128+
.version = ZarrVersion_3,
129+
};
130+
131+
ZarrStreamSettings_create_dimension_array(&settings, 4);
132+
settings.dimensions[0] = (ZarrDimensionProperties){
133+
.name = "t",
134+
.type = ZarrDimensionType_Time,
135+
.array_size_px = 0, // this is the append dimension
136+
.chunk_size_px = 100, // 100 time points per chunk
137+
.shard_size_chunks = 10, // 10 chunks per shard
138+
};
139+
140+
settings.dimensions[1] = (ZarrDimensionProperties){
141+
.name = "c",
142+
.type = ZarrDimensionType_Channel,
143+
.array_size_px = 3, // 3 channels
144+
.chunk_size_px = 1, // 1 channel per chunk
145+
.shard_size_chunks = 1, // 1 chunk per shard
146+
};
147+
148+
settings.dimensions[2] = (ZarrDimensionProperties){
149+
.name = "y",
150+
.type = ZarrDimensionType_Space,
151+
.array_size_px = 1080, // height
152+
.chunk_size_px = 270, // 4 x 4 tiles of size 270 x 480
153+
.shard_size_chunks = 2, // 2 x 2 tiles per shard
154+
};
155+
156+
settings.dimensions[3] = (ZarrDimensionProperties){
157+
.name = "x",
158+
.type = ZarrDimensionType_Space,
159+
.array_size_px = 1920, // width
160+
.chunk_size_px = 480, // 4 x 4 tiles of size 270 x 480
161+
.shard_size_chunks = 2, // 2 x 2 tiles per shard
162+
};
163+
164+
ZarrStream* stream = ZarrStream_create(&settings);
165+
166+
size_t bytes_written;
167+
ZarrStream_append(stream, my_frame_data, my_frame_size, &bytes_written);
168+
assert(bytes_written == my_frame_size);
169+
}
168170
```
169171

170172
Look at [acquire.zarr.h](include/acquire.zarr.h) for more details.
171173

172-
### Building C Bindings from Source
174+
### Building the C Library from Source
173175

174176
The library must be built from source to contribute to the latest development version or to incorporate the library into an existing program.
175177
To build the C library from source, follow [these instructions](https://github.com/acquire-project/acquire-zarr/blob/main/README.md#building).

0 commit comments

Comments
 (0)