Commit 7439c56f authored by jayd1860's avatar jayd1860
Browse files

v1.14.3

-- Fix issue reported by Robert Oostenveld and Meryem Yucel with demo_snirf_readfile.m
-- Add Get method to MetaDataTagsClass
parent c7c177c2
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -4,26 +4,26 @@ NOTE: This documentation is a work in progress. More detailed documentation will

Introduction:
=============
SNIRF is a HDF5-based file format for storing and sharing NIRS data independently of any platform-specific file format such as Matlab. SNIRFReaderWriter is an implementation in Matlab of a SNIRF reader/writer application (as the name implies). 
SNIRF is a HDF5-based file format for storing and sharing NIRS data independently of any platform-specific file format such as Matlab. Snirf_homer3 is a standalone implementation in Matlab of a SNIRF reader/writer application that is used by the Homer3. 


Downloading SNIRFReaderWriter:
Downloading snirf_homer3:
==============================
First download the SNIRFReaderWriter package. Go online to https://github.com/fNIRS/snirf-code and click the green "Clone or download" button on right. Then click "Download ZIP" right below the green button. Once you have downloaded the zip file, unzip it.
First download the snirf_homer3 package. Go online to https://github.com/fNIRS/snirf_homer3 and click the green "Clone or download" button on right. Then click "Download ZIP" right below the green button. Once you have downloaded the zip file, unzip it.


Installing SNIRFReaderWriter
Installing snirf_homer3
==============================

1. Open Matlab and in the command window, change the current folder to the SNIRFReaderWriter root folder that you downloaded. In the command window, type
1. Open Matlab and in the command window, change the current folder to the snirf_homer3 root folder that you downloaded. In the command window, type

   >> setpaths

This will set all the required matlab search paths for SNIRFReaderWriter. Note: this step should be done every time a new Matlab session is started. 
This will set all the required matlab search paths for snirf_homer3. Note: this step should be done every time a new Matlab session is started. 

At this point you should be ready to start SNIRFReaderWriter from the Matlab command window. 
At this point you should be ready to start snirf_homer3 from the Matlab command window. 

2. Running the SNIRF demo:

Run the demos demo_snirf.m and demo_snirf_readfile.m (which should be available on the Matlab command line after running setpaths). They demonstrate how to use SnirfClass reader/writer to save, load and read SNIRF files. Make sure to run demo_snirf before demo_snirf_readfile.m since it expects the snirf files generated by demo_snirf to be present (otherwise it displays a message box stating this if it doesn't find them). The SNIRFReaderWriter project includes sample .nirs files (DataTree/AcquiredData/Snirf/Examples) which the demo converts to .snirf files and then shows how to load them back into memory. 
Run the demos demo_snirf.m and demo_snirf_readfile.m (which should be available on the Matlab command line after running setpaths). They demonstrate how to use SnirfClass reader/writer to save, load and read SNIRF files. Make sure to run demo_snirf before demo_snirf_readfile.m since it expects the snirf files generated by demo_snirf to be present (otherwise it displays a message box stating this if it doesn't find them). The snirf_homer3 project includes sample .nirs files (DataTree/AcquiredData/Snirf/Examples) which the demo converts to .snirf files and then shows how to load them back into memory. 
+2 −1
Original line number Diff line number Diff line
@@ -28,8 +28,9 @@ snirf = SnirfClass();
% Read meta data tags from file
fprintf('Read metaDataTags from %s.\n', fnamefullpath);
snirf.LoadMetaDataTags(fnamefullpath,'/nirs');      % Use the SnirfClass LoadYYYY method to load whichever field you want 
tags = snirf.GetMetaDataTags();      % Use the SnirfClass LoadYYYY method to load whichever field you want 
for ii=1:length(snirf.metaDataTags)
    fprintf('metaDataTag(%d): {key = ''%s'', value = ''%s''}\n', ii, snirf.metaDataTags(ii).key, snirf.metaDataTags(ii).value);
    fprintf('metaDataTag(%d): {key = ''%s'', value = ''%s''}\n', ii, tags(ii).key, tags(ii).value);
end
fprintf('\n');

+13 −1
Original line number Diff line number Diff line
@@ -112,10 +112,22 @@ classdef MetaDataTagsClass < FileLoadSaveClass
        end
        
        
        
        % ----------------------------------------------------------------------------------
        function tags = Get(obj)
            fields = propnames(obj.tags);
            tags = repmat(struct('key','','value',[]),length(fields),1);
            for ii=1:length(fields)
                eval(sprintf('tags(ii).key = ''%s'';', fields{ii}));
                eval(sprintf('tags(ii).value = obj.tags.%s;', fields{ii}));
            end
        end
        
        
        % ----------------------------------------------------------------------------------
        function nbytes = MemoryRequired(obj)
            nbytes = 0;
            fields = properties(obj.tags);
            fields = propnames(obj.tags);
            for ii=1:length(fields)
                nbytes = nbytes + eval(sprintf('sizeof(obj.tags.%s)', fields{ii}));
            end
+1 −1
Original line number Diff line number Diff line
@@ -552,7 +552,7 @@ classdef SnirfClass < AcqDataClass & FileLoadSaveClass
        
        % ---------------------------------------------------------
        function val = GetMetaDataTags(obj)
            val = obj.metaDataTags;
            val = obj.metaDataTags.Get();
        end
        
    end