Yet another nd2 (Nikon NIS Elements) file reader.
Project description
nd2
Yet another .nd2 (Nikon NIS Elements) file reader.
This reader provides a Cython wrapper for the official Nikon SDK (currently version 1.7.0.0, released Jun 23, 2021).
Features good metadata retrieval, and direct to_dask and to_xarray options for lazy and/or annotated arrays.
It does not currently support legacy format nd2 files (JPEG_XL files starting with bytes 0x0000000c)
install
pip install nd2
(linux support coming but not yet ready)
usage
import nd2
# directly read file to numpy array:
my_array = nd2.imread('some_file.nd2')
# or open a file with ND2File
f = nd2.ND2File('some_file.nd2')
# attributes: # example output
f.shape # (10, 2, 256, 256)
f.ndim # 4
f.dtype # np.dtype('uint16')
f.axes # 'TCYX'
# methods
f.pixel_size() # (0.1, 0.1, 0.5) (x,y,z)
f.asarray() # np.ndarray, greedy reader
f.to_dask() # dask.array.Array, lazy reader
f.to_xarray() # xr.DataArray, with labeled axes/coords
# metadata # returns instance of ...
f.attributes() # nd2.structures.Attributes
f.metadata() # nd2.structures.Metadata
f.metadata(frame=3) # nd2.structures.FrameMetadata
f.experiment() # List[nd2.structures.ExpLoop]
f.text_info() # dict of misc info
f.close() # don't forget to close when done!
# ... or you can use it as a context manager
with nd2.ND2File('some_file.nd2') as ndfile:
print(ndfile.metadata())
xarr = ndfile.to_xarray(delayed=False)
issues
This is a work in progress (though working pretty well for most files!). If you have an nd2 file that errors or otherwise provides unexpected results, please open an issue and link to the file. I'd love to add it to the growing list of test files. (Note, if nd2._util.is_old_format('your.nd2') returns True, this is a legacy format that is not yet supported.)
alternatives
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nd2-0.0.1rc3.tar.gz.
File metadata
- Download URL: nd2-0.0.1rc3.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
350b4c40576bba74e3133140df2034b3d0396dd3cdd9ac27a663552b1473d06e
|
|
| MD5 |
84c713834c9aaaa1f5ea448e480662f0
|
|
| BLAKE2b-256 |
acb85dff90245e3d366cb1a789d1e9804c887f6901e952acb0fc1a8fbecb9259
|
File details
Details for the file nd2-0.0.1rc3-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 792.9 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f85a0841e8ca2441a45ac678e508ba659b6c432b9b7f4597e5a6d8d10d607e57
|
|
| MD5 |
fa9c4d0a70e5bb29c3a92f36ad46ff91
|
|
| BLAKE2b-256 |
38640f929d2a66da62e6b6e74944317cbb4b2fd0fc1b311c8d96915bf7f87044
|
File details
Details for the file nd2-0.0.1rc3-cp39-cp39-macosx_10_9_x86_64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76d973af48dc3ffdf02d4b586c7b194f0d1f43a0a7582f0ca0aac2065a03c96b
|
|
| MD5 |
078d996aac52f6d9f611405818d82b14
|
|
| BLAKE2b-256 |
4b1ceec138b67d84b87b2f0ab628e8a93d2d9d7db7cd120b4e0cc1e945cd8615
|
File details
Details for the file nd2-0.0.1rc3-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 793.0 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca2fe7ebb9859172279c726857a2b1621db45c5e46d2c47bbc32636cab7b09da
|
|
| MD5 |
2b660c4f649295ffa1563702a2460bfd
|
|
| BLAKE2b-256 |
e65d9ebfc896e2fbcea63b092b8b84e0b895baedae49e290e9a505c4d03bdf56
|
File details
Details for the file nd2-0.0.1rc3-cp38-cp38-macosx_10_9_x86_64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42bfa6ea0293088af4a43c67995c29b01131e7e51dae525478a949cc1e12c861
|
|
| MD5 |
590ed5279f41d6616c00cba972899279
|
|
| BLAKE2b-256 |
3274dcbd9e6ad2665ebd524e768e65ee65127d0629d223d6e882167e5ca28a2e
|
File details
Details for the file nd2-0.0.1rc3-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 791.7 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8e31d12ea630804edadad4a8b2c96b245a8c9a63004d36576b1eb674ec0256b
|
|
| MD5 |
c7d3d247d3b4b32a75a7e8e80a65f986
|
|
| BLAKE2b-256 |
9416d3abbe45a59cce383cebeb30267705a8673b721a1a7423ba1b17306c5868
|
File details
Details for the file nd2-0.0.1rc3-cp37-cp37m-macosx_10_9_x86_64.whl.
File metadata
- Download URL: nd2-0.0.1rc3-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd0a9c182f070ec67fcb32a24b162a80df93169e89efac1853b6fdc95934b1dc
|
|
| MD5 |
97cc8fa0b279c84177d0ef1a98b59a51
|
|
| BLAKE2b-256 |
b121b46797c1de1cfafbdf4c169004d479e25baea4c30b46e13e58390e24372f
|