Skip to content

Nihon Kohden V2.0 support #14502

Open
Open

Description

@cleemesser

Description of the problem

Currently, mne-python's nihon kohden file reader read_raw_nihon silently mis-parses high-density EEG-1200A files. These have an extended block layout on disk.

#13448 enabled the EEG-1200A V01.00 device string in mne-io/nihon/nihon.py but no parser for the file layout exists. The data is stored in an extended block chain. The current low-density parsing path reads the legacy data block, whose channel-count byte usually for just channel.

The result: mne.io.read_raw_nihon() accepts these files and returns a one-channel Raw object with the wrong duration. No warning or error.

How the layout differs (verified against real files)

  • A uint32 at file offset 0x3EE is 0 on every V1 file inspected, and
    points to an extended-block chain on every EEG-1200A high-density file
    inspected. It is a reliable discriminator; the device string is not (the
    same string also appears on files that must keep the V1 path).

Proposed fixes, two options:

  1. safety - raise NotImplementedError when we detect the extend-block chain format.
  2. Add extended block support. I have a working fix which is about 100 lines long which has been tested on real files. These are compared with NK's own EDF export files and are bit-for-bit matches. (This also covers a silent scaling bug which I will submit separately.) I will also submit a document with my current understanding of the file format if that is desired.

additions to mne-testing-data

I have prepared a few small file examples of the extended block format which have no patient data in them. I would be able to submit them for including in the mne-python test data. These files also caught a couple of bugs in the version 1 format parsing path.

Steps to reproduce

create a `EEG-1200A V01.00` file on an NK acquisition machne. with this amplifier. call name the stem of the file name XXXX. So have {"XXXX.eeg", "XXXX.21e", "XXXX.log", "XXXX.pnt"


import mne
raw = mne.io.read_raw_nihon("XXXX.eeg", preload=False)
print(raw.info["nchan"], raw.n_times)   # 1 channel, wrong length; no error

Link to data

Here is a link to three small studies data files on google drive

Expected results

I will put the outputs of expected results here with the test files as the generic result using the example above is not meaningful.

Actual results

ditto

Additional information

This is being tested on ubuntu 22.04, 24.01 and mac OS 27

Activity

  1. larsoner commented on Nov 6, 2026

    @larsoner
    Member

    Yes a fix would be great! Documentation of the dataset would be good to have. It would be awesome if you could supply some tiny (1s?) recording and add it to mne-testing-data as well.

  2. cleemesser commented on Nov 6, 2026

    @cleemesser
    Author

    Yes a fix would be great! Documentation of the dataset would be good to have. It would be awesome if you could supply some tiny (1s?) recording and add it to mne-testing-data as well.

    Ok, I've added a link to the data files. They are small, but not 1 second small so that I can test interrupted recordings and multiple annotations.

    I will work on the option 2 PR next. It is close to ready

  3. larsoner commented on Nov 10, 2026

    @larsoner
    Member

    Okay I put those in mne-testing-data and cut a 0.177 release with hash md5:8138c566b97550b6936e155882209ffc

  4. bishaldas5112007-lang commented on Nov 20, 2026

    @bishaldas5112007-lang

    I’d like to take this one. I have a working implementation of option 2 (extended block chain parsing, ~100 lines), tested against real EEG-1200A files and compared with NK’s own EDF exports (bit-for-bit match).

    Plan:

    PR 1: Detect the extended block chain via the uint32 at 0x3EE (non-zero means extended layout, 0 means V1 path). Parse it, with tests.
    PR 1 or a follow-up: Fix the scaling bug, if maintainers prefer it separate.
    PR to mne-testing-data: add small anonymized example files (no patient data), plus the expected channel count and duration for each.
    Optional: a short file-format notes document, if wanted.

    If maintainers would rather merge a safety net first, I can open a small PR that raises NotImplementedError on the extended layout, then follow with full support.

    Could someone assign this to me?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions