HDF5 endpoints¶
Two endpoints for HDF5 files (.h5, .hdf5).
POST /h5/inspect¶
Inspect an uploaded HDF5 file — returns the list of all datasets with their shapes and dtypes.
Request: multipart/form-data
| Field | Type | Description |
|---|---|---|
file |
file | A .h5 or .hdf5 file |
Response: application/json
{
"filename": "experiment.h5",
"format": "hdf5",
"datasets": [
{
"path": "data/subject01/run1/bold",
"shape": [64, 64, 30, 200],
"dtype": "float32"
},
{
"path": "data/subject02/run1/bold",
"shape": [64, 64, 30, 198],
"dtype": "float32"
}
]
}
Example:
import httpx
with open("experiment.h5", "rb") as f:
response = httpx.post(
"http://127.0.0.1:8000/h5/inspect",
files={"file": f},
)
for ds in response.json()["datasets"]:
print(ds["path"], ds["shape"])
POST /h5/slice¶
Generate a PNG slice preview from a dataset inside an uploaded HDF5 file.
Request: multipart/form-data + query parameters
| Field | Type | Description |
|---|---|---|
file |
file | A .h5 or .hdf5 file |
| Query param | Type | Required | Description |
|---|---|---|---|
dataset_path |
string | Yes | Path to the dataset inside the file, e.g. data/subject01/run1/bold |
axis |
integer | Yes | Axis to slice along (0, 1, or 2) |
slice_index |
integer | No | Slice index; defaults to centre |
Response: image/png
Example: