NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

[Bug]: Broken comments in MultiChannelVolumeSeries.m #548

Closed RR-N closed 9 months ago

RR-N commented 9 months ago

What happened?

Trying to load any .nwb file containing a MultiChannelVolumeSeries results in an error pointing to the line 16 in MultiChannelVolumeSeries.m:

    format; %  (char) Format of image. If this is 'external', then the attribute 'external_file'
                             contains the path information to the image files. If this is 'raw', then the raw
                             (single-channel) binary data is stored in the 'data' dataset. If this attribute
                             is not present, then the default format='raw' case is assumed.     

    starting_frame; %  (int32) Each external image may contain one or more consecutive frames of the full
                             ImageSeries. This attribute serves as an index to indicate which frames each file
                             contains, to faciliate random access. The 'starting_frame' attribute, hence,
                             contains a list of frame numbers within the full ImageSeries of the first frame
                             of each file listed in the parent 'external_file' dataset. Zero-based indexing is
                             used (hence, the first element will always be zero). For example, if the
                             'external_file' dataset has three paths to files and the first file has 5 frames,
                             the second file has 10 frames, and the third file has 20 frames, then this
                             attribute will have values [0, 5, 15]. If there is a single external file that
                             holds all of the frames of the ImageSeries (and so there is a single element in
                             the 'external_file' dataset), then this attribute should have value [0].

Wrapping all new lines in comments fixes the issue:

    format; %  (char) Format of image. If this is 'external', then the attribute 'external_file'
                             % contains the path information to the image files. If this is 'raw', then the raw
                             % (single-channel) binary data is stored in the 'data' dataset. If this attribute
                             % is not present, then the default format='raw' case is assumed.     

    starting_frame; %  (int32) Each external image may contain one or more consecutive frames of the full
                             % ImageSeries. This attribute serves as an index to indicate which frames each file
                             % contains, to faciliate random access. The 'starting_frame' attribute, hence,
                             % contains a list of frame numbers within the full ImageSeries of the first frame
                             % of each file listed in the parent 'external_file' dataset. Zero-based indexing is
                             % used (hence, the first element will always be zero). For example, if the
                             % 'external_file' dataset has three paths to files and the first file has 5 frames,
                             % the second file has 10 frames, and the third file has 20 frames, then this
                             % attribute will have values [0, 5, 15]. If there is a single external file that
                             % holds all of the frames of the ImageSeries (and so there is a single element in
                             % the 'external_file' dataset), then this attribute should have value [0].
>> nwb = nwbRead('E:\scape-data\neuropal20220729_worm1run2.nwb', 'ignorecache')

nwb = 

  NwbFile with properties:

                                             nwb_version: '2.6.0'
                                        file_create_date: [1×1 types.untyped.DataStub]
                                              identifier: '20220729/worm-1/run-2'
                                                           ...

Steps to Reproduce

1. Install NeurodataWithoutBorders/matnwb from MATLAB Add-On Explorer.
2. Open any NWB file containing a MultiChannelVolumeSeries:
   `nwb = nwbRead('E:\scape-data\neuropal20220729_worm1run2.nwb', 'ignorecache')`

Error Message

>> nwb = nwbRead('E:\scape-data\neuropal20220729_worm1run2.nwb', 'ignorecache')
Error using types.ndx_multichannel_volume.MultiChannelVolumeSeries
File: MultiChannelVolumeSeries.m Line: 16 Column: 43
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

Error in io.parseGroup (line 85)
    parsed = eval([Type.typename '(kwargs{:})']);

Error in io.parseGroup (line 38)
    subg = io.parseGroup(filename, group, Blacklist);

Error in io.parseGroup (line 38)
    subg = io.parseGroup(filename, group, Blacklist);

Error in io.parseGroup (line 38)
    subg = io.parseGroup(filename, group, Blacklist);

Error in nwbRead (line 79)
    nwb = io.parseGroup(filename, h5info(filename), Blacklist);

Operating System

Windows

Matlab Version

-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.13.0.2193358 (R2022b) Update 5
MATLAB License Number: 40702059
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.13        (R2022b)      License 40702059
Simulink                                              Version 10.6        (R2022b)      License 40702059
5G Toolbox                                            Version 2.5         (R2022b)      License 40702059
AUTOSAR Blockset                                      Version 3.0         (R2022b)      License 40702059
Antenna Toolbox                                       Version 5.3         (R2022b)      License 40702059
Audio Toolbox                                         Version 3.3         (R2022b)      License 40702059
Automated Driving Toolbox                             Version 3.6         (R2022b)      License 40702059
Bioinformatics Toolbox                                Version 4.16.1      (R2022b)      License 40702059
Bluetooth Toolbox                                     Version 1.1         (R2022b)      License 40702059
Communications Toolbox                                Version 7.8         (R2022b)      License 40702059
Computer Vision Toolbox                               Version 10.3        (R2022b)      License 40702059
Control System Toolbox                                Version 10.12       (R2022b)      License 40702059
Curve Fitting Toolbox                                 Version 3.8         (R2022b)      License 40702059
DDS Blockset                                          Version 1.3         (R2022b)      License 40702059
DSP HDL Toolbox                                       Version 1.1         (R2022b)      License 40702059
DSP System Toolbox                                    Version 9.15        (R2022b)      License 40702059
Data Acquisition Toolbox                              Version 4.6         (R2022b)      License 40702059
Database Toolbox                                      Version 10.4        (R2022b)      License 40702059
Datafeed Toolbox                                      Version 6.3         (R2022b)      License 40702059
Deep Learning HDL Toolbox                             Version 1.4         (R2022b)      License 40702059
Deep Learning Toolbox                                 Version 14.5        (R2022b)      License 40702059
Econometrics Toolbox                                  Version 6.1         (R2022b)      License 40702059
Embedded Coder                                        Version 7.9         (R2022b)      License 40702059
Filter Design HDL Coder                               Version 3.1.12      (R2022b)      License 40702059
Financial Instruments Toolbox                         Version 3.5         (R2022b)      License 40702059
Financial Toolbox                                     Version 6.4         (R2022b)      License 40702059
Fixed-Point Designer                                  Version 7.5         (R2022b)      License 40702059
Fuzzy Logic Toolbox                                   Version 3.0         (R2022b)      License 40702059
GPU Coder                                             Version 2.4         (R2022b)      License 40702059
Global Optimization Toolbox                           Version 4.8         (R2022b)      License 40702059
HDL Coder                                             Version 4.0         (R2022b)      License 40702059
HDL Verifier                                          Version 7.0         (R2022b)      License 40702059
Image Acquisition Toolbox                             Version 6.7         (R2022b)      License 40702059
Image Processing Toolbox                              Version 11.6        (R2022b)      License 40702059
Industrial Communication Toolbox                      Version 6.1         (R2022b)      License 40702059
Instrument Control Toolbox                            Version 4.7         (R2022b)      License 40702059
LTE Toolbox                                           Version 3.8         (R2022b)      License 40702059
Lidar Toolbox                                         Version 2.2         (R2022b)      License 40702059
MATLAB Coder                                          Version 5.5         (R2022b)      License 40702059
MATLAB Compiler                                       Version 8.5         (R2022b)      License 40702059
MATLAB Compiler SDK                                   Version 7.1         (R2022b)      License 40702059
MATLAB Report Generator                               Version 5.13        (R2022b)      License 40702059
Mapping Toolbox                                       Version 5.4         (R2022b)      License 40702059
Medical Imaging Toolbox                               Version 1.0         (R2022b)      License 40702059
Mixed-Signal Blockset                                 Version 2.3         (R2022b)      License 40702059
Model Predictive Control Toolbox                      Version 8.0         (R2022b)      License 40702059
Model-Based Calibration Toolbox                       Version 5.13        (R2022b)      License 40702059
Motor Control Blockset                                Version 1.5         (R2022b)      License 40702059
Navigation Toolbox                                    Version 2.3         (R2022b)      License 40702059
Optimization Toolbox                                  Version 9.4         (R2022b)      License 40702059
Parallel Computing Toolbox                            Version 7.7         (R2022b)      License 40702059
Partial Differential Equation Toolbox                 Version 3.9         (R2022b)      License 40702059
Phased Array System Toolbox                           Version 4.8         (R2022b)      License 40702059
Powertrain Blockset                                   Version 1.12        (R2022b)      License 40702059
Predictive Maintenance Toolbox                        Version 2.6         (R2022b)      License 40702059
RF Blockset                                           Version 8.4         (R2022b)      License 40702059
RF PCB Toolbox                                        Version 1.2         (R2022b)      License 40702059
RF Toolbox                                            Version 4.4         (R2022b)      License 40702059
ROS Toolbox                                           Version 1.6         (R2022b)      License 40702059
Radar Toolbox                                         Version 1.3         (R2022b)      License 40702059
Reinforcement Learning Toolbox                        Version 2.3         (R2022b)      License 40702059
Requirements Toolbox                                  Version 2.1         (R2022b)      License 40702059
Risk Management Toolbox                               Version 2.1         (R2022b)      License 40702059
Robotics System Toolbox                               Version 4.1         (R2022b)      License 40702059
Robust Control Toolbox                                Version 6.11.2      (R2022b)      License 40702059
Satellite Communications Toolbox                      Version 1.3         (R2022b)      License 40702059
Sensor Fusion and Tracking Toolbox                    Version 2.4         (R2022b)      License 40702059
SerDes Toolbox                                        Version 2.4         (R2022b)      License 40702059
Signal Integrity Toolbox                              Version 1.2         (R2022b)      License 40702059
Signal Processing Toolbox                             Version 9.1         (R2022b)      License 40702059
SimBiology                                            Version 6.4         (R2022b)      License 40702059
SimEvents                                             Version 5.13        (R2022b)      License 40702059
Simscape                                              Version 5.4         (R2022b)      License 40702059
Simscape Battery                                      Version 1.0         (R2022b)      License 40702059
Simscape Driveline                                    Version 3.6         (R2022b)      License 40702059
Simscape Electrical                                   Version 7.8         (R2022b)      License 40702059
Simscape Fluids                                       Version 3.5         (R2022b)      License 40702059
Simscape Multibody                                    Version 7.6         (R2022b)      License 40702059
Simulink 3D Animation                                 Version 9.5         (R2022b)      License 40702059
Simulink Check                                        Version 6.1         (R2022b)      License 40702059
Simulink Code Inspector                               Version 4.2         (R2022b)      License 40702059
Simulink Coder                                        Version 9.8         (R2022b)      License 40702059
Simulink Compiler                                     Version 1.5         (R2022b)      License 40702059
Simulink Control Design                               Version 6.2         (R2022b)      License 40702059
Simulink Coverage                                     Version 5.5         (R2022b)      License 40702059
Simulink Design Optimization                          Version 3.12        (R2022b)      License 40702059
Simulink Design Verifier                              Version 4.8         (R2022b)      License 40702059
Simulink Desktop Real-Time                            Version 5.15        (R2022b)      License 40702059
Simulink PLC Coder                                    Version 3.7         (R2022b)      License 40702059
Simulink Real-Time                                    Version 8.1         (R2022b)      License 40702059
Simulink Report Generator                             Version 5.13        (R2022b)      License 40702059
Simulink Test                                         Version 3.7         (R2022b)      License 40702059
SoC Blockset                                          Version 1.7         (R2022b)      License 40702059
Spreadsheet Link                                      Version 3.4.8       (R2022b)      License 40702059
Stateflow                                             Version 10.7        (R2022b)      License 40702059
Statistics and Machine Learning Toolbox               Version 12.4        (R2022b)      License 40702059
Symbolic Math Toolbox                                 Version 9.2         (R2022b)      License 40702059
System Composer                                       Version 2.3         (R2022b)      License 40702059
System Identification Toolbox                         Version 10.0        (R2022b)      License 40702059
Text Analytics Toolbox                                Version 1.9         (R2022b)      License 40702059
UAV Toolbox                                           Version 1.4         (R2022b)      License 40702059
Vehicle Dynamics Blockset                             Version 1.9         (R2022b)      License 40702059
Vehicle Network Toolbox                               Version 5.3         (R2022b)      License 40702059
Vision HDL Toolbox                                    Version 2.6         (R2022b)      License 40702059
WLAN Toolbox                                          Version 3.5         (R2022b)      License 40702059
Wavelet Toolbox                                       Version 6.2         (R2022b)      License 40702059
Wireless HDL Toolbox                                  Version 2.5         (R2022b)      License 40702059
Wireless Testbench                                    Version 1.1         (R2022b)      License 40702059

Code of Conduct

RR-N commented 9 months ago

Looks like this is a dynamically generated file pulled from an nwb extension. Closing issue as it doesn't relate to this repo.

rly commented 9 months ago

@RR-N did you use MatNWB to generate MultiChannelVolumeSeries.m? If so, I think this is still an issue that should be solved -- that is, the dynamical extension generation should create long comments correctly.

lawrence-mbf commented 9 months ago

fyi, there are no issues with MultiChannelVolumeSeries generation at the tip of master (for both ndx-multichannel-volume and MatNWB) so it might have been an issue in a previous version.

RR-N commented 9 months ago

Yes, I reached out to Daniel (author of the extension) and they pushed a fix yesterday.

And yes, that .m file was generated with matnwb, so handling long comments (or, more specifically, newlines in comments) is definitely something that ought to be looked at.

On Tue, Oct 3, 2023, 09:46 Lawrence @.***> wrote:

fyi, there are no issues with MultiChannelVolumeSeries generation at the tip of master (for both ndx-multichannel-volume https://urldefense.com/v3/__https://github.com/focolab/ndx-multichannel-volume__;!!IBzWLUs!SSrSUbJF7TcBbf8TDdd0C5GmVBkcUMTE9M1n-3QEPZ6MxZzdtVdNtf-7tCIS7o2F4T3xgfyNHAumxmFkRyd3D40xrvMn$ and MatNWB) so it might have been an issue in a previous version.

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/NeurodataWithoutBorders/matnwb/issues/548*issuecomment-1745013247__;Iw!!IBzWLUs!SSrSUbJF7TcBbf8TDdd0C5GmVBkcUMTE9M1n-3QEPZ6MxZzdtVdNtf-7tCIS7o2F4T3xgfyNHAumxmFkRyd3D5S5YS0_$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AF4UHMZNKVBXAXDKDOC3M2LX5QJJZAVCNFSM6AAAAAA5OYJNJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGAYTGMRUG4__;!!IBzWLUs!SSrSUbJF7TcBbf8TDdd0C5GmVBkcUMTE9M1n-3QEPZ6MxZzdtVdNtf-7tCIS7o2F4T3xgfyNHAumxmFkRyd3D0ENb2sQ$ . You are receiving this because you were mentioned.Message ID: @.***>

lawrence-mbf commented 9 months ago

@RR-N Noted and will look into that.