Commit 39cffe19 authored by Jay's avatar Jay
Browse files

v1.20.2

-- Change Snirf code to save in row-major storage order to agree with HDF5 storage order. Qianqian noticed that this might be an issue.
-- Add SNIRF file reader in Python to check that it Matlab Snirf reader/write is compatible with row-major languages. It reads all the files in the Snirf/Examples folder same one used by
parent 82c28a28
Loading
Loading
Loading
Loading

.gitignore

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line

groupResults.mat
*.mat
processOpt_default.cfg
+2 −2
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@
processOpt_default.cfg

% Regression Test Active
false
true

% Include Archived User Functions
No
Yes

% Default Processing Stream Style
SNIRF
+15 −11
Original line number Diff line number Diff line
@@ -23,48 +23,52 @@ classdef FileLoadSaveClass < matlab.mixin.Copyable
        
        
        % ---------------------------------------------------------
        function Load(obj, filename, format)
        function Load(obj, filename, format, params)
            if ~exist('filename','var')
                filename = obj.filename;
            end
            
            if ~exist('format','var')
                format = obj.fileformat;
            elseif obj.Supported(format)
                obj.fileformat = format;
            end
            if ~exist('params','var')
                params = [];
            end            
                        
            switch(lower(format))
                case obj.supportedFomats.matlab
                    if ismethod(obj, 'LoadMat')
                    if ismethod(obj, 'LoadMat', params)
                        obj.LoadMat(filename);
                    end
                case obj.supportedFomats.hdf5
                    if ismethod(obj, 'LoadHdf5')
                        obj.LoadHdf5(filename);
                        obj.LoadHdf5(filename, params);
                    end
            end
        end
        
        
        % ---------------------------------------------------------
        function Save(obj, filename, format)
        function Save(obj, filename, format, params)
            if ~exist('filename','var')
                filename = obj.filename;
            end            
            
            if ~exist('format','var')
                format = obj.fileformat;
            end
            if ~exist('params','var')
                params = [];
            end            
                       
            switch(lower(format))
                case obj.supportedFomats.matlab
                    if ismethod(obj, 'SaveMat')
                        obj.SaveMat(filename);
                        obj.SaveMat(filename, params);
                    end
                case obj.supportedFomats.hdf5
                    if ismethod(obj, 'SaveHdf5')
                        obj.SaveHdf5(filename);
                        obj.SaveHdf5(filename, params);
                    end
            end
        end
+17 −6
Original line number Diff line number Diff line
function val = HDF5_DatasetLoad(gid, name, val)
function val = HDF5_DatasetLoad(gid, name, val0, options)

if nargin==2
    val = []; 
if ~exist('val0','var')
    val0 = [];
end
if ~exist('options','var')
    options = '';
end

try
    dsetid = H5D.open(gid, name);

    % NOTE: HDF5 stores contiguous muti-dimensional arrays in row-major order.
    % Matlab stores them in row-major order. We want to transpose the loaded data 
    % it back to Matlab's column-major storage order and thus get back the 
    % original array.  
    val = H5D.read(dsetid);    
    val = HDF5_PostProcessing(val, val0, options);

    % val = H5D.read(dsetid);
    H5D.close(dsetid);    
catch ME
    switch(class(val))
catch
    switch(class(val0))
        case 'char'
            val = '';
        case 'cell'
+16 −0
Original line number Diff line number Diff line
function val = HDF5_PostProcessing(val, val0, options)

if ~exist('val0','var')
    val0 = [];
end
if ~exist('options','var')
    options = '';
end
val = HDF5_Transpose(val, options);

% Convert muti-row char array to cell string array
if ischar(val) && ~iscell(val0)
    val = convertHDF5StrToMatlabStr(val);
elseif ischar(val)
    val = convertHDF5StrToMatlabStr(val, 'cell');
end
Loading