Skip to content

Feat/eit parser complete#30

Merged
Kernel236 merged 20 commits into
devfrom
feat/eit-parser-complete
Mar 27, 2026
Merged

Feat/eit parser complete#30
Kernel236 merged 20 commits into
devfrom
feat/eit-parser-complete

Conversation

@Kernel236
Copy link
Copy Markdown
Owner

No description provided.

- parse() reads preamble via np.memmap, resolves spec by frame-size
  divisibility, memory-maps binary frames with FRAME_EIT_DTYPE
- calibration pipeline (EIDORS read_draeger_file.m, Adler 2016):
    vv     = FT_A * trans_A - FT_B * trans_B   [calibrated transimpedance]
    I_real = injection_current / FC_CURRENT     [A]
    V_diff = (voltage_A - voltage_B) / FV_VOLTAGE  [V]
- aux_signals: timestamp, trans_A/B raw, I_real, V_diff, frame_counter, medibus
- warns if Framerate [Hz] missing from header before defaulting to 50 Hz
- RawImpedanceData: add aux_signals field; clarify measurements docstring
- README: DragerEitParser status Scaffold -> Implemented; add .eit
  quick-start example; update RawImpedanceData table entry
- docs/data_model.md: document aux_signals field in RawImpedanceData
  with all keys, shapes, and units
- Parse patient01.eit and .bin, verify measurements shape and sanity
- Check timestamps monotonic, print calibration constants
- Compare frame count between .eit and .bin
- test_header_formats.py: registry contents, get_eit_specs(), frozen spec
- test_eit_dtypes.py: itemsize 5495, field offsets trans_A=16 trans_B=2592,
  frombuffer round-trip
- test_eit_utils.py: parse_eit_header() valid/error cases, field map keys,
  calibration constants, Time colon edge case
- test_eit_parser.py: validate(), parse() shape/metadata/calibration/
  aux_signals, fs warning, truncated file error, 5 real-file tests
tests/models/     — base_data, reconstructed_data
tests/parsers/    — base_parser, routing, header_formats
tests/parsers/draeger/ — bin dtypes/parser/utils, asc parser, eit dtypes/parser/utils
tests/parsers/timpel/  — timpel dtypes, parser

All 242 tests pass. git mv used to preserve history.
- Add eit_greit.py: reconstruct_greit() and build_greit() wrapping pyEIT
  GREIT solver for RawImpedanceData (208 measurements → 32×32 images).
  Handles external reference frames for cross-recording EELI comparison.
  Ref: Adler et al., Physiol. Meas. 30 (2009) S35–S55, DOI 10.1088/0967-3334/30/6/S03
- Update parsers/__init__.py: document DragerEitParser as implemented;
  add reconstruction utilities section
- Update README: add GREIT quickstart snippet with pyeit optional dep
- Update docs/data_model.md: document RawImpedanceData.measurements
  protocol note (208 = 16 elec × 13 pairs, adjacent drive)
- Fix ruff: sort imports, remove unused variable (walrus operator),
  remove unused numpy import across 4 test files
…fmmu and §10 cross-correlation

- Translate all Italian markdown cells to English throughout
- §9: protocol diagnostic — std vs fmmu measurement ordering with
  side-by-side reconstruction at peak inspiration; explains why fmmu
  is expected to match Dräger hardware sweep order
- §10: frame alignment check via cross-correlation of .eit global
  signal vs .bin global_signal; confirms lag=0 prerequisite for
  paired ML dataset construction
- Summary table at end covering all validation checks
- Narrative reframed: bridge .eit → pyEIT is functional; spatial
  quality gap vs vendor .bin motivates data-driven reconstruction
  (documented in summary, will be addressed in feat/ml-reconstruction)
- docs/data_model.md: now covers only data container specs (BaseData,
  ReconstructedFrameData, ContinuousSignalData, RawImpedanceData);
  overview table moved to parsers.md
- docs/parsers.md (new): parser reference for all implemented parsers
  (DragerBinParser, DragerEitParser, DragerAscParser, TimpelTabularParser);
  includes binary frame layouts, calibration constants, measurement
  protocol note, GREIT bridge API, and loader utilities
- README: update Documentation section with three-file structure
- tasks.csv: mark 2.5.2 done (measurement protocol documented);
  add 7.0.1 done (GREIT bridge), 7.0.2/7.0.3 in_progress
  (std/fmmu + cross-correlation — cells written, need Riccardo to run);
  add ML.1/ML.2/ML.3 todo (data-driven reconstruction branch)
- learning_journal: full session entry — GREIT spatial diagnosis,
  std vs fmmu explanation, ML reconstruction rationale, eitprocessing
  finding, EELI cross-recording strategy, branch status
…r convention

Measurement ordering:
- Change parser_meas from 'std' to 'fmmu' in build_greit().
  The PulmoVista 500 sweeps voltage measurements starting from the
  electrode adjacent to the current sink for each drive pattern.
  This matches pyEIT's fmmu (rotating) protocol, not std (absolute).
  Source: Dräger PulmoVista 500 IFU SW 1.3n p. 144 (measurement diagram).

Image orientation — third correction added (fliplr):
- Existing: negate (impedance convention) + rot90(k=1) (electrode 1 at
  12 o'clock = anterior at top).
- New: np.fliplr() after rot90 to match caudal-cranial CT convention.
  Dräger displays images viewed from feet: left of image = right of
  patient. pyEIT produces the anatomical mirror; fliplr corrects this.
  Source: IFU p. 146 — "il lato sinistro dell'immagine visualizza il
  lato destro del paziente".

docs/parsers.md: update §3 (fmmu confirmed) and §6 (three-step
orientation pipeline with IFU page citations).
…ot parallel

The PulmoVista 500 records only the .eit file. The .bin is generated
by Dräger's software applying Newton-Raphson reconstruction to each
.eit frame in sequence. Frame-level alignment is therefore guaranteed
by construction, not empirically — a temporal offset is architecturally
impossible. Cross-correlation lag=0 is a verification, not a prerequisite.

Also updates ML rationale: the paired dataset has zero misalignment
noise because .bin[k] is the deterministic transform of .eit[k].
@Kernel236 Kernel236 added this to the .eit Parser milestone Mar 27, 2026
@Kernel236 Kernel236 added the enhancement New feature or request label Mar 27, 2026
@Kernel236 Kernel236 merged commit d98a232 into dev Mar 27, 2026
7 checks passed
@Kernel236 Kernel236 deleted the feat/eit-parser-complete branch March 27, 2026 18:05
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 25.49020% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/fasteit/parsers/draeger/eit/eit_pyeit_bridge.py 0.00% 38 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants