cine-handler 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cine_handler-0.1.1.dist-info/METADATA +358 -0
- cine_handler-0.1.1.dist-info/RECORD +17 -0
- cine_handler-0.1.1.dist-info/WHEEL +5 -0
- cine_handler-0.1.1.dist-info/top_level.txt +1 -0
- cine_reader/__init__.py +31 -0
- cine_reader/_lookup.py +72 -0
- cine_reader/cine.py +847 -0
- cine_reader/frame_decode.py +91 -0
- cine_reader/headers.py +452 -0
- cine_reader/image_ops.py +285 -0
- cine_reader/libs/unpack_data_arm64.dylib +0 -0
- cine_reader/libs/unpack_data_elf64.so +0 -0
- cine_reader/libs/unpack_data_win32.dll +0 -0
- cine_reader/libs/unpack_data_win64.dll +0 -0
- cine_reader/py.typed +0 -0
- cine_reader/stats.py +161 -0
- cine_reader/unpack.py +139 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cine-handler
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Cross-platform Python reader for Vision Research Phantom .cine files
|
|
5
|
+
Author: Rees Verleur
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/rverleur/cine-reader
|
|
8
|
+
Project-URL: Repository, https://github.com/rverleur/cine-reader
|
|
9
|
+
Project-URL: Documentation, https://github.com/rverleur/cine-reader/blob/main/python/API.md
|
|
10
|
+
Project-URL: Issues, https://github.com/rverleur/cine-reader/issues
|
|
11
|
+
Project-URL: Releases, https://github.com/rverleur/cine-reader/releases
|
|
12
|
+
Project-URL: MATLAB Implementation, https://github.com/rverleur/cine-reader/tree/main/Matlab
|
|
13
|
+
Keywords: phantom,cine,high-speed-camera,imaging
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
28
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
29
|
+
|
|
30
|
+
# cine-handler
|
|
31
|
+
|
|
32
|
+
`cine-handler` is the PyPI distribution for the `cine_reader` Python package,
|
|
33
|
+
which reads Vision Research Phantom `.cine` files on macOS, Linux, and
|
|
34
|
+
Windows.
|
|
35
|
+
|
|
36
|
+
The PyPI distribution contains only the Python package. The repository also
|
|
37
|
+
includes a separate MATLAB implementation that stays in GitHub:
|
|
38
|
+
|
|
39
|
+
- Repository: <https://github.com/rverleur/cine-reader>
|
|
40
|
+
- MATLAB implementation: <https://github.com/rverleur/cine-reader/tree/main/Matlab>
|
|
41
|
+
- Python examples: <https://github.com/rverleur/cine-reader/tree/main/python/examples>
|
|
42
|
+
- Python API notes: <https://github.com/rverleur/cine-reader/blob/main/python/API.md>
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
Install from PyPI:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install cine-handler
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Development install from GitHub:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install "git+https://github.com/rverleur/cine-reader.git"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Editable install from a local checkout:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install -e .[dev]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## What The Package Provides
|
|
65
|
+
|
|
66
|
+
- High-level `Cine` reader for file metadata, frame access, frame iteration,
|
|
67
|
+
trimming, and simple processing.
|
|
68
|
+
- Packed 10-bit decode with bundled native helpers and a NumPy fallback.
|
|
69
|
+
- Dead-pixel repair helpers for mono, Bayer/CFA, and RGB image arrays.
|
|
70
|
+
- Bilinear Bayer demosaic for raw color sensor frames.
|
|
71
|
+
- Low-memory frame statistics helpers for averaging and robust background
|
|
72
|
+
estimation.
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from pathlib import Path
|
|
78
|
+
|
|
79
|
+
from cine_reader import Cine
|
|
80
|
+
|
|
81
|
+
cine_path = Path("my_capture.cine")
|
|
82
|
+
|
|
83
|
+
with Cine(cine_path) as cine:
|
|
84
|
+
print("frames:", cine.total_frames)
|
|
85
|
+
print("range:", cine.first_frame_number, cine.last_frame_number)
|
|
86
|
+
print("frame rate:", cine.frame_rate)
|
|
87
|
+
print("exposure (s):", cine.exposure_time_seconds)
|
|
88
|
+
|
|
89
|
+
cine.load_frame(cine.first_frame_number)
|
|
90
|
+
raw_frame = cine.frame
|
|
91
|
+
|
|
92
|
+
rgb_frame = cine.get_frame_rgb()
|
|
93
|
+
average = cine.average_frames(cine.first_frame_number, cine.first_frame_number + 9)
|
|
94
|
+
background = cine.mode_frames(cine.first_frame_number, cine.first_frame_number + 19)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Frame And Color Behavior
|
|
98
|
+
|
|
99
|
+
- Mono cines load as 2D arrays.
|
|
100
|
+
- Raw color CFA/Bayer cines load as 2D sensor mosaics by default.
|
|
101
|
+
- Interpolated 24-bit and 48-bit color payloads load as 3-channel arrays.
|
|
102
|
+
- Set `debayer=True` on `Cine(...)` or call `debayer_frame()` to convert raw CFA
|
|
103
|
+
frames to RGB.
|
|
104
|
+
- Set `remove_dead_pixels=True` on `Cine(...)` or call `replace_dead_pixels()`
|
|
105
|
+
to repair dead pixels.
|
|
106
|
+
- `red_pixels`, `green_pixels`, and `blue_pixels` expose raw CFA sensor samples
|
|
107
|
+
for Bayer frames, using `NaN` at non-matching locations.
|
|
108
|
+
|
|
109
|
+
## The `Cine` Class
|
|
110
|
+
|
|
111
|
+
### Constructor
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
Cine(
|
|
115
|
+
filename,
|
|
116
|
+
keep_annotations=True,
|
|
117
|
+
remove_dead_pixels=False,
|
|
118
|
+
debayer=False,
|
|
119
|
+
dead_value=None,
|
|
120
|
+
dead_is_threshold=True,
|
|
121
|
+
bayer_pattern="auto",
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- `filename`: path to a `.cine` file.
|
|
126
|
+
- `keep_annotations`: keep annotation block bytes in `annotation_data` and
|
|
127
|
+
`annotation`.
|
|
128
|
+
- `remove_dead_pixels`: repair dead pixels on each `load_frame`.
|
|
129
|
+
- `debayer`: debayer raw CFA/Bayer frames on each `load_frame`.
|
|
130
|
+
- `dead_value`: optional dead-pixel marker or threshold. If omitted, the value
|
|
131
|
+
is inferred from camera metadata.
|
|
132
|
+
- `dead_is_threshold`: when `True`, values greater than or equal to
|
|
133
|
+
`dead_value` are treated as dead pixels.
|
|
134
|
+
- `bayer_pattern`: `"auto"`, `"RGGB"`, `"BGGR"`, `"GRBG"`, or `"GBRG"`.
|
|
135
|
+
|
|
136
|
+
### Reader Lifecycle
|
|
137
|
+
|
|
138
|
+
- `open_cine_file(filename)`: reopen a `.cine` file and parse the top-level
|
|
139
|
+
metadata blocks.
|
|
140
|
+
- `close_file()`: close the active file handle.
|
|
141
|
+
- Context manager support: `with Cine(path) as cine: ...`
|
|
142
|
+
|
|
143
|
+
### Metadata And Aliases
|
|
144
|
+
|
|
145
|
+
These properties are the most useful entry points for file metadata:
|
|
146
|
+
|
|
147
|
+
- `first_frame_number`
|
|
148
|
+
- `total_frames`
|
|
149
|
+
- `last_frame_number`
|
|
150
|
+
- `frame_rate`
|
|
151
|
+
- `exposure_time_ns`
|
|
152
|
+
- `exposure_time_seconds`
|
|
153
|
+
- `exposure_time`
|
|
154
|
+
- `recording_datetime`
|
|
155
|
+
- `recording_date`
|
|
156
|
+
- `cfa_code`
|
|
157
|
+
- `bayer_pattern`
|
|
158
|
+
|
|
159
|
+
The specification-aligned metadata objects are also available directly:
|
|
160
|
+
|
|
161
|
+
- `file_header` as `CineHeader`
|
|
162
|
+
- `image_header` as `BitmapHeader`
|
|
163
|
+
- `camera_setup` as `Setup`
|
|
164
|
+
- `image_locations` as `ImageOffsets`
|
|
165
|
+
|
|
166
|
+
### Frame Access
|
|
167
|
+
|
|
168
|
+
- `load_frame(image_no, convert_bgr_to_rgb=False)`
|
|
169
|
+
- Loads a single frame by global frame number.
|
|
170
|
+
- `convert_bgr_to_rgb=True` converts 3-channel payloads to RGB on load.
|
|
171
|
+
- `next_frame(increment=1, convert_bgr_to_rgb=False)`
|
|
172
|
+
- Loads the next frame relative to `current_frame`.
|
|
173
|
+
- Negative increments are allowed.
|
|
174
|
+
- `frame` and `image`
|
|
175
|
+
- Aliases for the currently loaded NumPy array.
|
|
176
|
+
- `get_frame_rgb(image_no=None, bayer_pattern="auto")`
|
|
177
|
+
- Returns the current frame, or a selected frame, as RGB.
|
|
178
|
+
- Raw CFA/Bayer frames are demosaiced first.
|
|
179
|
+
|
|
180
|
+
Example:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
with Cine("capture.cine") as cine:
|
|
184
|
+
cine.load_frame(cine.first_frame_number)
|
|
185
|
+
raw = cine.frame
|
|
186
|
+
rgb = cine.get_frame_rgb()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Pixel Repair And Demosaic
|
|
190
|
+
|
|
191
|
+
- `replace_dead_pixels(dead_value=None, dead_is_threshold=True)`
|
|
192
|
+
- Repairs dead pixels on the current frame.
|
|
193
|
+
- Works for mono, raw Bayer/CFA, and RGB data.
|
|
194
|
+
- `debayer_frame(bayer_pattern="auto")`
|
|
195
|
+
- Converts the current raw CFA/Bayer frame to RGB in place.
|
|
196
|
+
|
|
197
|
+
Example:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
with Cine("capture.cine") as cine:
|
|
201
|
+
cine.load_frame(cine.first_frame_number)
|
|
202
|
+
cine.replace_dead_pixels()
|
|
203
|
+
cine.debayer_frame()
|
|
204
|
+
rgb = cine.frame
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Multi-Frame Operations
|
|
208
|
+
|
|
209
|
+
- `average_frames(start_frame, end_frame, replace_dead_pixels=False, chunk_size=8)`
|
|
210
|
+
- Computes a per-pixel average over an inclusive frame range.
|
|
211
|
+
- `mode_frames(start_frame, end_frame, replace_dead_pixels=False, method="auto", q_bg=0.80, k_sigma=2.5, min_keep=3, max_keep=96, stack_limit=128)`
|
|
212
|
+
- Computes a robust bright-background estimate.
|
|
213
|
+
- `method="mad"` uses a full-stack quantile/MAD estimator.
|
|
214
|
+
- `method="topk"` uses a bounded-memory top-k estimator.
|
|
215
|
+
- `method="auto"` chooses between them from the range length.
|
|
216
|
+
- `load_frames_batch(start_frame, count)`
|
|
217
|
+
- Loads consecutive frames into one stacked array.
|
|
218
|
+
- Output shape is `[H, W, N]` for mono/raw CFA and `[H, W, 3, N]` for color.
|
|
219
|
+
- `save_frames_to_new_file(output_filename, start_frame, end_frame)`
|
|
220
|
+
- Writes a trimmed `.cine` file for an inclusive frame range.
|
|
221
|
+
|
|
222
|
+
Example:
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
with Cine("capture.cine") as cine:
|
|
226
|
+
first = cine.first_frame_number
|
|
227
|
+
last = min(first + 49, cine.last_frame_number)
|
|
228
|
+
|
|
229
|
+
avg = cine.average_frames(first, last, chunk_size=8)
|
|
230
|
+
bg = cine.mode_frames(first, last, method="topk")
|
|
231
|
+
batch = cine.load_frames_batch(first, 5)
|
|
232
|
+
cine.save_frames_to_new_file("trimmed.cine", first, last)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Standalone Helper Functions
|
|
236
|
+
|
|
237
|
+
### Packed 10-bit Decode
|
|
238
|
+
|
|
239
|
+
- `unpack_10bit_data(data)`
|
|
240
|
+
- Decodes Phantom packed 10-bit payloads.
|
|
241
|
+
- Uses a bundled native unpack helper when one is available.
|
|
242
|
+
- Falls back to NumPy automatically.
|
|
243
|
+
- `unpack_10bit_numpy(data)`
|
|
244
|
+
- Pure-NumPy packed 10-bit decoder.
|
|
245
|
+
|
|
246
|
+
To force the NumPy path:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
export CINE_READER_DISABLE_C_UNPACK=1
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Dead-Pixel Repair
|
|
253
|
+
|
|
254
|
+
- `replace_dead_pixels(frame, dead_value=4095, dead_is_threshold=False, bayer_raw=False)`
|
|
255
|
+
- Dispatches to the right repair strategy for mono, Bayer, or RGB input.
|
|
256
|
+
- `replace_dead_pixels_mono(frame, dead_value=4095, dead_is_threshold=False)`
|
|
257
|
+
- Repairs dead pixels in a 2D mono frame from valid 8-neighbor values.
|
|
258
|
+
- `replace_dead_pixels_bayer(frame, dead_value=4095, dead_is_threshold=False)`
|
|
259
|
+
- Repairs a 2D raw Bayer/CFA frame phase-by-phase before demosaic.
|
|
260
|
+
- `replace_dead_pixels_rgb(frame, dead_value=4095, dead_is_threshold=False)`
|
|
261
|
+
- Repairs each color channel independently in a 3D image.
|
|
262
|
+
|
|
263
|
+
Example:
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from cine_reader import replace_dead_pixels_bayer
|
|
267
|
+
|
|
268
|
+
clean = replace_dead_pixels_bayer(raw_bayer_frame, dead_value=4095)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Demosaic
|
|
272
|
+
|
|
273
|
+
- `demosaic_bilinear(frame, pattern="RGGB")`
|
|
274
|
+
- Bilinear Bayer demosaic for raw CFA frames.
|
|
275
|
+
- Supported patterns are `"RGGB"`, `"BGGR"`, `"GRBG"`, and `"GBRG"`.
|
|
276
|
+
|
|
277
|
+
Example:
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
from cine_reader import demosaic_bilinear
|
|
281
|
+
|
|
282
|
+
rgb = demosaic_bilinear(raw_bayer_frame, pattern="RGGB")
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Frame Statistics
|
|
286
|
+
|
|
287
|
+
- `average_from_frame_iter(frames, out_dtype=None, chunk_size=8)`
|
|
288
|
+
- Computes a per-pixel mean from an iterable of equally shaped frames.
|
|
289
|
+
- Returns `(average_frame, frame_count)`.
|
|
290
|
+
- `robust_background_mad_stack(frames, q_bg=0.80, k_sigma=2.5, min_keep=3, out_dtype=np.uint16)`
|
|
291
|
+
- Full-stack bright-background estimator based on quantile and MAD rejection.
|
|
292
|
+
- `robust_background_topk(frames, frame_count, q_bg=0.80, min_keep=3, max_keep=96, out_dtype=np.uint16)`
|
|
293
|
+
- Bounded-memory bright-background estimator that keeps the top-k samples per
|
|
294
|
+
pixel.
|
|
295
|
+
|
|
296
|
+
Example:
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
from cine_reader import average_from_frame_iter, robust_background_topk
|
|
300
|
+
|
|
301
|
+
avg, count = average_from_frame_iter(frames, chunk_size=16)
|
|
302
|
+
bg = robust_background_topk(frames, frame_count=count, q_bg=0.80)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Metadata Classes
|
|
306
|
+
|
|
307
|
+
These classes are returned by the reader for direct access to CINE metadata:
|
|
308
|
+
|
|
309
|
+
- `CineHeader`
|
|
310
|
+
- File header fields such as `FirstImageNo`, `ImageCount`, and
|
|
311
|
+
`OffImageOffsets`.
|
|
312
|
+
- `BitmapHeader`
|
|
313
|
+
- Image header fields such as `biWidth`, `biHeight`, and `biBitCount`.
|
|
314
|
+
- `ImageOffsets`
|
|
315
|
+
- Frame byte-offset table as `pImage`.
|
|
316
|
+
- `Setup`
|
|
317
|
+
- Camera setup metadata including frame rate, exposure, bit depth, color
|
|
318
|
+
flags, and descriptive strings.
|
|
319
|
+
|
|
320
|
+
Example:
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
with Cine("capture.cine") as cine:
|
|
324
|
+
print(cine.file_header.FirstImageNo)
|
|
325
|
+
print(cine.image_header.biWidth, cine.image_header.biHeight)
|
|
326
|
+
print(cine.camera_setup.FrameRate, cine.camera_setup.RealBPP)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Included Native Helpers
|
|
330
|
+
|
|
331
|
+
The wheel ships with runtime unpack libraries for packed 10-bit payloads:
|
|
332
|
+
|
|
333
|
+
- `unpack_data_win32.dll`
|
|
334
|
+
- `unpack_data_win64.dll`
|
|
335
|
+
- `unpack_data_elf64.so`
|
|
336
|
+
- `unpack_data_arm64.dylib`
|
|
337
|
+
|
|
338
|
+
If no matching helper can be loaded, `cine-handler` falls back to the NumPy
|
|
339
|
+
decoder automatically.
|
|
340
|
+
|
|
341
|
+
## MATLAB Implementation
|
|
342
|
+
|
|
343
|
+
The PyPI package is intentionally Python-only. If you also need the MATLAB
|
|
344
|
+
reader, use the same GitHub repository:
|
|
345
|
+
|
|
346
|
+
- MATLAB package entry point:
|
|
347
|
+
<https://github.com/rverleur/cine-reader/blob/main/Matlab/Cine.m>
|
|
348
|
+
- MATLAB setup and examples:
|
|
349
|
+
<https://github.com/rverleur/cine-reader/blob/main/Matlab/README.md>
|
|
350
|
+
|
|
351
|
+
## More Examples
|
|
352
|
+
|
|
353
|
+
- Basic usage:
|
|
354
|
+
<https://github.com/rverleur/cine-reader/blob/main/python/examples/basic_usage.py>
|
|
355
|
+
- Trimming and background estimation:
|
|
356
|
+
<https://github.com/rverleur/cine-reader/blob/main/python/examples/trim_and_background.py>
|
|
357
|
+
- Performance test:
|
|
358
|
+
<https://github.com/rverleur/cine-reader/blob/main/python/examples/performance_test.py>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
cine_reader/__init__.py,sha256=NHEsk3uGjdFS8c8DBEFOp367_LdtpNZrWaJBJvScGXs,830
|
|
2
|
+
cine_reader/_lookup.py,sha256=jxtA4xr8bMdLeWEpYzVNG4C5LNYWlVgG4e_NOhdj2mI,6582
|
|
3
|
+
cine_reader/cine.py,sha256=svNPXTSzX74gLIH_OQfPq06CeZNDWsr5kdPUfxxYAo8,32405
|
|
4
|
+
cine_reader/frame_decode.py,sha256=ZFzItvLQPrOSboD68FCJw4iIv3BgE8YWhwIgPwgtSHM,3095
|
|
5
|
+
cine_reader/headers.py,sha256=zvusG855XCzjl5NOjZxkiEsGpUFIO6-mOXMMbgjdkbU,24490
|
|
6
|
+
cine_reader/image_ops.py,sha256=byBj4eEsyTCBAMPWay4Go6wqTK8diXhMOYPMvsny3_Q,9160
|
|
7
|
+
cine_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
cine_reader/stats.py,sha256=vIpHT_4pJFcJfs1Ytap3DiRDC5aZPf9rBvkj2cLZ2o0,5004
|
|
9
|
+
cine_reader/unpack.py,sha256=zuuKn_gItPA8cBxNwY1hgXBRMI3WxsnZIipwu4IAc1E,4237
|
|
10
|
+
cine_reader/libs/unpack_data_arm64.dylib,sha256=kJuuYsD6LY-RSvbgrA5wYVoPk2B2n8atkw9Am1tKbGU,50072
|
|
11
|
+
cine_reader/libs/unpack_data_elf64.so,sha256=mnTtCDAk8hQHKAVlkfCa_iGjd2v0N5qMJznQwnU2LeU,21800
|
|
12
|
+
cine_reader/libs/unpack_data_win32.dll,sha256=EhmcCQgwM5EkTO1pLzJJbJkgIx-luuB_ebsx5_Xl2S8,85504
|
|
13
|
+
cine_reader/libs/unpack_data_win64.dll,sha256=ljeueljdnRY-uBxH3uHkWRStCjnjcHVYYbFUE-ApUwM,110080
|
|
14
|
+
cine_handler-0.1.1.dist-info/METADATA,sha256=K8tkE10Gm5Hg-u_2W2IzQzULzIymZiSzDzIw7RD_rwA,11758
|
|
15
|
+
cine_handler-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
16
|
+
cine_handler-0.1.1.dist-info/top_level.txt,sha256=fzYCDywFXn0Dz-kWKamVkcnIm_5hZxj7ZHtrJ5HnHks,12
|
|
17
|
+
cine_handler-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cine_reader
|
cine_reader/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""cine_reader package."""
|
|
2
|
+
|
|
3
|
+
from .cine import Cine
|
|
4
|
+
from .headers import BitmapHeader, CineHeader, ImageOffsets, Setup
|
|
5
|
+
from .image_ops import (
|
|
6
|
+
demosaic_bilinear,
|
|
7
|
+
replace_dead_pixels,
|
|
8
|
+
replace_dead_pixels_bayer,
|
|
9
|
+
replace_dead_pixels_mono,
|
|
10
|
+
replace_dead_pixels_rgb,
|
|
11
|
+
)
|
|
12
|
+
from .stats import average_from_frame_iter, robust_background_mad_stack, robust_background_topk
|
|
13
|
+
from .unpack import unpack_10bit_data, unpack_10bit_numpy
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"Cine",
|
|
17
|
+
"CineHeader",
|
|
18
|
+
"BitmapHeader",
|
|
19
|
+
"ImageOffsets",
|
|
20
|
+
"Setup",
|
|
21
|
+
"unpack_10bit_data",
|
|
22
|
+
"unpack_10bit_numpy",
|
|
23
|
+
"replace_dead_pixels",
|
|
24
|
+
"replace_dead_pixels_mono",
|
|
25
|
+
"replace_dead_pixels_bayer",
|
|
26
|
+
"replace_dead_pixels_rgb",
|
|
27
|
+
"demosaic_bilinear",
|
|
28
|
+
"average_from_frame_iter",
|
|
29
|
+
"robust_background_mad_stack",
|
|
30
|
+
"robust_background_topk",
|
|
31
|
+
]
|
cine_reader/_lookup.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Lookup table copied from Vision Research 10-bit unpack C implementation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
LOOKUP_TABLE = np.array([
|
|
8
|
+
2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18,
|
|
9
|
+
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33,
|
|
10
|
+
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48,
|
|
11
|
+
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63,
|
|
12
|
+
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
|
13
|
+
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
14
|
+
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
|
15
|
+
110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
|
|
16
|
+
125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138,
|
|
17
|
+
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
|
|
18
|
+
156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172,
|
|
19
|
+
173, 175, 176, 177, 178, 179, 181, 182, 183, 184, 186, 187, 188, 189, 191, 192,
|
|
20
|
+
193, 194, 196, 197, 198, 200, 201, 202, 204, 205, 206, 208, 209, 210, 212, 213,
|
|
21
|
+
215, 216, 217, 219, 220, 222, 223, 225, 226, 227, 229, 230, 232, 233, 235, 236,
|
|
22
|
+
238, 239, 241, 242, 244, 245, 247, 249, 250, 252, 253, 255, 257, 258, 260, 261,
|
|
23
|
+
263, 265, 266, 268, 270, 271, 273, 275, 276, 278, 280, 281, 283, 285, 287, 288,
|
|
24
|
+
290, 292, 294, 295, 297, 299, 301, 302, 304, 306, 308, 310, 312, 313, 315, 317,
|
|
25
|
+
319, 321, 323, 325, 327, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348,
|
|
26
|
+
350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 377, 379, 381,
|
|
27
|
+
383, 385, 387, 389, 391, 394, 396, 398, 400, 402, 404, 407, 409, 411, 413, 416,
|
|
28
|
+
418, 420, 422, 425, 427, 429, 431, 434, 436, 438, 441, 443, 445, 448, 450, 452,
|
|
29
|
+
455, 457, 459, 462, 464, 467, 469, 472, 474, 476, 479, 481, 484, 486, 489, 491,
|
|
30
|
+
494, 496, 499, 501, 504, 506, 509, 511, 514, 517, 519, 522, 524, 527, 529, 532,
|
|
31
|
+
535, 537, 540, 543, 545, 548, 551, 553, 556, 559, 561, 564, 567, 570, 572, 575,
|
|
32
|
+
578, 581, 583, 586, 589, 592, 594, 597, 600, 603, 606, 609, 611, 614, 617, 620,
|
|
33
|
+
623, 626, 629, 632, 635, 637, 640, 643, 646, 649, 652, 655, 658, 661, 664, 667,
|
|
34
|
+
670, 673, 676, 679, 682, 685, 688, 691, 694, 698, 701, 704, 707, 710, 713, 716,
|
|
35
|
+
719, 722, 726, 729, 732, 735, 738, 742, 745, 748, 751, 754, 758, 761, 764, 767,
|
|
36
|
+
771, 774, 777, 781, 784, 787, 790, 794, 797, 800, 804, 807, 811, 814, 817, 821,
|
|
37
|
+
824, 828, 831, 834, 838, 841, 845, 848, 852, 855, 859, 862, 866, 869, 873, 876,
|
|
38
|
+
880, 883, 887, 890, 894, 898, 901, 905, 908, 912, 916, 919, 923, 927, 930, 934,
|
|
39
|
+
938, 941, 945, 949, 952, 956, 960, 964, 967, 971, 975, 979, 982, 986, 990, 994,
|
|
40
|
+
998, 1001, 1005, 1009, 1013, 1017, 1021, 1025, 1028, 1032, 1036, 1040, 1044, 1048, 1052, 1056,
|
|
41
|
+
1060, 1064, 1068, 1072, 1076, 1080, 1084, 1088, 1092, 1096, 1100, 1104, 1108, 1112, 1116, 1120,
|
|
42
|
+
1124, 1128, 1132, 1137, 1141, 1145, 1149, 1153, 1157, 1162, 1166, 1170, 1174, 1178, 1183, 1187,
|
|
43
|
+
1191, 1195, 1200, 1204, 1208, 1212, 1217, 1221, 1225, 1230, 1234, 1238, 1243, 1247, 1251, 1256,
|
|
44
|
+
1260, 1264, 1269, 1273, 1278, 1282, 1287, 1291, 1295, 1300, 1304, 1309, 1313, 1318, 1322, 1327,
|
|
45
|
+
1331, 1336, 1340, 1345, 1350, 1354, 1359, 1363, 1368, 1372, 1377, 1382, 1386, 1391, 1396, 1400,
|
|
46
|
+
1405, 1410, 1414, 1419, 1424, 1428, 1433, 1438, 1443, 1447, 1452, 1457, 1462, 1466, 1471, 1476,
|
|
47
|
+
1481, 1486, 1490, 1495, 1500, 1505, 1510, 1515, 1520, 1524, 1529, 1534, 1539, 1544, 1549, 1554,
|
|
48
|
+
1559, 1564, 1569, 1574, 1579, 1584, 1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634,
|
|
49
|
+
1639, 1644, 1649, 1655, 1660, 1665, 1670, 1675, 1680, 1685, 1691, 1696, 1701, 1706, 1711, 1717,
|
|
50
|
+
1722, 1727, 1732, 1738, 1743, 1748, 1753, 1759, 1764, 1769, 1775, 1780, 1785, 1791, 1796, 1801,
|
|
51
|
+
1807, 1812, 1818, 1823, 1828, 1834, 1839, 1845, 1850, 1856, 1861, 1867, 1872, 1878, 1883, 1889,
|
|
52
|
+
1894, 1900, 1905, 1911, 1916, 1922, 1927, 1933, 1939, 1944, 1950, 1956, 1961, 1967, 1972, 1978,
|
|
53
|
+
1984, 1989, 1995, 2001, 2007, 2012, 2018, 2024, 2030, 2035, 2041, 2047, 2053, 2058, 2064, 2070,
|
|
54
|
+
2076, 2082, 2087, 2093, 2099, 2105, 2111, 2117, 2123, 2129, 2135, 2140, 2146, 2152, 2158, 2164,
|
|
55
|
+
2170, 2176, 2182, 2188, 2194, 2200, 2206, 2212, 2218, 2224, 2231, 2237, 2243, 2249, 2255, 2261,
|
|
56
|
+
2267, 2273, 2279, 2286, 2292, 2298, 2304, 2310, 2317, 2323, 2329, 2335, 2341, 2348, 2354, 2360,
|
|
57
|
+
2366, 2373, 2379, 2385, 2392, 2398, 2404, 2411, 2417, 2423, 2430, 2436, 2443, 2449, 2455, 2462,
|
|
58
|
+
2468, 2475, 2481, 2488, 2494, 2501, 2507, 2514, 2520, 2527, 2533, 2540, 2546, 2553, 2559, 2566,
|
|
59
|
+
2572, 2579, 2586, 2592, 2599, 2605, 2612, 2619, 2625, 2632, 2639, 2645, 2652, 2659, 2666, 2672,
|
|
60
|
+
2679, 2686, 2693, 2699, 2706, 2713, 2720, 2726, 2733, 2740, 2747, 2754, 2761, 2767, 2774, 2781,
|
|
61
|
+
2788, 2795, 2802, 2809, 2816, 2823, 2830, 2837, 2844, 2850, 2857, 2864, 2871, 2878, 2885, 2893,
|
|
62
|
+
2900, 2907, 2914, 2921, 2928, 2935, 2942, 2949, 2956, 2963, 2970, 2978, 2985, 2992, 2999, 3006,
|
|
63
|
+
3013, 3021, 3028, 3035, 3042, 3049, 3057, 3064, 3071, 3078, 3086, 3093, 3100, 3108, 3115, 3122,
|
|
64
|
+
3130, 3137, 3144, 3152, 3159, 3166, 3174, 3181, 3189, 3196, 3204, 3211, 3218, 3226, 3233, 3241,
|
|
65
|
+
3248, 3256, 3263, 3271, 3278, 3286, 3294, 3301, 3309, 3316, 3324, 3331, 3339, 3347, 3354, 3362,
|
|
66
|
+
3370, 3377, 3385, 3393, 3400, 3408, 3416, 3423, 3431, 3439, 3447, 3454, 3462, 3470, 3478, 3486,
|
|
67
|
+
3493, 3501, 3509, 3517, 3525, 3533, 3540, 3548, 3556, 3564, 3572, 3580, 3588, 3596, 3604, 3612,
|
|
68
|
+
3620, 3628, 3636, 3644, 3652, 3660, 3668, 3676, 3684, 3692, 3700, 3708, 3716, 3724, 3732, 3740,
|
|
69
|
+
3749, 3757, 3765, 3773, 3781, 3789, 3798, 3806, 3814, 3822, 3830, 3839, 3847, 3855, 3863, 3872,
|
|
70
|
+
3880, 3888, 3897, 3905, 3913, 3922, 3930, 3938, 3947, 3955, 3963, 3972, 3980, 3989, 3997, 4006,
|
|
71
|
+
4014, 4022, 4031, 4039, 4048, 4056, 4064, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095,
|
|
72
|
+
], dtype=np.uint16)
|