tlambert03 / nd2

Full-featured nd2 (Nikon NIS Elements) file reader for python. Outputs to numpy, dask, and xarray. Exhaustive metadata extraction
https://tlambert03.github.io/nd2
BSD 3-Clause "New" or "Revised" License
53 stars 15 forks source link

Add utility to try to rescue frames from a corrupted nd2 file #44

Closed tlambert03 closed 2 years ago

tlambert03 commented 2 years ago
from nd2 import rescue_nd2

for f in rescue_nd2('bad_file.nd2', frame_shape=(512, 512, 3), dtype='uint16'):
    ...  # do something with the rescued frame

note that frame_shape must be in the shape as it appears on disk, which is usually (Y, X, C)

tlambert03 commented 2 years ago

cc @kevinyamauchi

codecov[bot] commented 2 years ago

Codecov Report

Merging #44 (1e446ad) into main (941958d) will increase coverage by 0.33%. The diff coverage is 81.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
+ Coverage   86.21%   86.55%   +0.33%     
==========================================
  Files          10       10              
  Lines        1110     1145      +35     
==========================================
+ Hits          957      991      +34     
- Misses        153      154       +1     
Impacted Files Coverage Δ
src/nd2/_chunkmap.py 67.16% <80.48%> (+10.16%) :arrow_up:
src/nd2/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 941958d...1e446ad. Read the comment docs.