Skip to content

Commit

Permalink
IO: Support for Spike2 .smrx files
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed Aug 17, 2020
1 parent 29d559d commit b18a1bf
Show file tree
Hide file tree
Showing 35 changed files with 1,445 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deploy/bst_javabuilder_2015b_spm.prj
@@ -1,5 +1,5 @@
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration build-checksum="3119021350" file="C:\Work\Dev\brainstorm3\deploy\bst_javabuilder_2015b_spm.prj" location="C:\Work\Dev\brainstorm3\deploy" name="bst_javabuilder_2015b_spm" target="target.ezdeploy.library" target-name="Library Compiler">
<configuration build-checksum="2802116058" file="C:\Work\Dev\brainstorm3\deploy\bst_javabuilder_2015b_spm.prj" location="C:\Work\Dev\brainstorm3\deploy" name="bst_javabuilder_2015b_spm" target="target.ezdeploy.library" target-name="Library Compiler">
<param.appname>bst_javabuilder_2015b</param.appname>
<param.icon />
<param.icons />
Expand Down
2 changes: 1 addition & 1 deletion doc/license.html
Expand Up @@ -5,7 +5,7 @@
<body alink="#fff000" link="#fff000" vlink="#fff000">
<h4><span style="font-family: Arial Black; color: #ffffff;"><strong>THERE IS NO UNDO BUTTON - SET UP A BACKUP OF YOUR DATABASE</strong></span></h4>
<HR>
<!-- LICENCE_START -->Version: 3.200816 (16-Aug-2020)<br>
<!-- LICENCE_START -->Version: 3.200817 (17-Aug-2020)<br>
<span style="font-style: italic;">COPYRIGHT &copy; 2000-2020
USC &amp; McGill University.<br>
</span>
Expand Down
1 change: 1 addition & 0 deletions doc/updates.txt
@@ -1,6 +1,7 @@
---------------------------------------------------------------
August 2020
- Anatomy: Display surfaces/sources as flat 2D maps (Mollweide projection)
- IO: Support for Spike2 .smrx files
---------------------------------------------------------------
July 2020
- Anatomy: Added 13 infant templates 0.5-25 months (O'Reilly)
Expand Down
2 changes: 1 addition & 1 deletion doc/version.txt
@@ -1,2 +1,2 @@
% Brainstorm
% v. 3.200816 (16-Aug-2020)
% v. 3.200817 (17-Aug-2020)
120 changes: 120 additions & 0 deletions external/CEDS64ML/CEDMarker.m
@@ -0,0 +1,120 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

classdef CEDMarker < handle

properties (GetAccess = public, SetAccess = private)
m_Time;
m_Code1;
m_Code2;
m_Code3;
m_Code4;
end

methods
% methods, including the constructor are defined in this bloc
function obj = CEDMarker(Time, Code1, Code2, Code3, Code4)
% class constructor
% set everthing to zero then overwrite it if we have an
% argument
obj.m_Time = int64(0);
obj.m_Code1 = uint8(0);
obj.m_Code2 = uint8(0);
obj.m_Code3 = uint8(0);
obj.m_Code4 = uint8(0);

if(nargin > 0)
if (isinteger(Time) && Time > 0)
obj.m_Time = int64(Time);
end
end
if(nargin > 1)
obj.m_Code1 = uint8(Code1(1));
end
if(nargin > 2)
obj.m_Code2 = uint8(Code2(1));
end
if(nargin > 3)
obj.m_Code3 = uint8(Code3(1));
end
if(nargin > 4)
obj.m_Code4 = uint8(Code4(1));
end
end

function Code = GetCode(obj, iN)
switch (iN)
case 1
Code = obj.m_Code1;
case 2
Code = obj.m_Code2;
case 3
Code = obj.m_Code3;
case 4
Code = obj.m_Code4;
otherwise
Code = -22;
end
end

function err = SetCode(obj, iN, Code)
err = 0;
switch (iN)
case 1
obj.m_Code1 = uint8(Code(1));
case 2
obj.m_Code2 = uint8(Code(1));
case 3
obj.m_Code3 = uint8(Code(1));
case 4
obj.m_Code4 = uint8(Code(1));
otherwise
err = -22;
end
end

function Time = GetTime(obj)
Time = obj.m_Time;
end

function err = SetTime(obj, Time)
if (isnumeric(Time) && Time > 0)
obj.m_Time = int64(Time);
err = 0;
else
err = - 22;
end
end

function [ r, c ] = Size(obj)
r = 0;
c = 0;
end

function err = GetData(obj)
err = -22;
end

function err = SetData(obj, Data)
err = -22;
end
end
end
53 changes: 53 additions & 0 deletions external/CEDS64ML/CEDS64ChanComment.m
@@ -0,0 +1,53 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

function [ iOk, sCommentOut ] = CEDS64ChanComment( fhand, iChan, sCommentIn )
%CEDS64CHANCOMMENT Gets and sets the comment for a channel
% [ iOk, sCommentOut ] = CEDS64ChanComment( fhand, iChan {, sCommentIn} )
% fhand - An integer handle to an open file
% iChan - A channel number
% sCommentIn - (Optional) A string containing the new comment
% Output
% iOk - 0 if the comment was set correctly otherwise a negative error code
% sCommentOut - A string containing the old comment

if (nargin == 2 || nargin == 3) % always get the comment
%step 1 find out how big the comment is
dummystring = blanks(1);
[iSize] = calllib('ceds64int', 'S64GetChanComment', fhand, iChan, dummystring, -1);
%step 2 create a string buffer of the correct size
stringptr = blanks(iSize+1);
[iOk, sCommentOut] = calllib('ceds64int', 'S64GetChanComment', fhand, iChan, stringptr, 0);
else
iOk = -22;
end

% has there been an error?
if iOk < 0
return;
end

% if not set the comment if we're given one
if (nargin == 3)
iOk = calllib('ceds64int', 'S64SetChanComment', fhand, iChan, sCommentIn);
end
end

36 changes: 36 additions & 0 deletions external/CEDS64ML/CEDS64ChanDiv.m
@@ -0,0 +1,36 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

function [ i64Div ] = CEDS64ChanDiv( fhand, iChan )
%CEDS64CHANDIV The sample interval in Ticks
% [ i64Div ] = CEDS64ChanDiv( fhand, iChan )
% Inputs
% fhand - Integer file handle
% iChan - Channel number
% Outputs
% i64Div - The sample interval in Ticks or a negative error code
if(nargin == 2)
i64Div = calllib('ceds64int', 'S64ChanDivide', fhand, iChan);
else
i64Div = -22;
end
end

54 changes: 54 additions & 0 deletions external/CEDS64ML/CEDS64ChanTitle.m
@@ -0,0 +1,54 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

function [ iOk, sTitleOut ] = CEDS64ChanTitle( fhand, iChan, sTitleIn )
%CEDS64CHANTITLE Gets and sets a channel title
% [ iOk, sTitleOut ] = CEDS64ChanTitle( fhand, iChan {, sTitleIn} )
% Input
% fhand - An integer handle to an open file
% iChan - A channel number
% sTitleIn - (Optional) A string containing the new title
% Output
% iOk - 0 if the title was set correctly otherwise a negative error code
% sTitleOut - A string containing the old title

if (nargin == 2 || nargin == 3) % always get the old title
%step 1 find out how big the title is is
dummystring = blanks(1);
[iSize] = calllib('ceds64int', 'S64GetChanTitle', fhand, iChan, dummystring, -1);
%step 2 create a string buffer of the correct size
stringptr = blanks(iSize+1);
[iOk, sTitleOut] = calllib('ceds64int', 'S64GetChanTitle', fhand, iChan, stringptr, 0);
else
iOk = -22;
end

% has there been an error?
if iOk < 0
return;
end

% if not set the new title if we're given one
if (nargin == 3)
iOk = calllib('ceds64int', 'S64SetChanTitle', fhand, iChan, sTitleIn);
end
end

46 changes: 46 additions & 0 deletions external/CEDS64ML/CEDS64ChanType.m
@@ -0,0 +1,46 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

function [ iType ] = CEDS64ChanType( fhand, iChan )
%CEDS64CHANTYPE Returns an integer code corresponding to the channel type
% [ iType ] = CEDS64ChanType( fhand, iChan )
% Inputs
% fhand - Integer file handle
% iChan - Channel number
% Outputs
% iType - 0 no channel
% 1 Waveform channel
% 2 Event (falling)
% 3 Event (rising)
% 4 Event (both)
% 5 Marker
% 6 Wavemark
% 7 Realmark
% 8 TextMark
% 9 Realwave
% or a negative error code
if(nargin == 2)
iType = calllib('ceds64int', 'S64ChanType', fhand, iChan);
else
iType = -22;
end
end

54 changes: 54 additions & 0 deletions external/CEDS64ML/CEDS64ChanUnits.m
@@ -0,0 +1,54 @@
%{
Copyright (C) Cambridge Electronic Design Limited 2014
Author: James Thompson
Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk
This file is part of CEDS64ML, a MATLAB interface to the SON64 library.
CEDS64ML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CEDS64ML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CEDS64ML. If not, see <http://www.gnu.org/licenses/>.
%}

function [ iOk, sUnitsOut ] = CEDS64ChanUnits( fhand, iChan, sUnitsIn )
%CEDS64CHANUNITS Gets and sets channels units
% [ iOk {, sUnitsOut} ] = CEDS64ChanUnits( fhand, iChan{, sUnitsIn} )
% Input
% fhand - An integer handle to an open file
% iChan - A channel number
% sUnitsIn - (Optional) A string conatining the new units
% Output
% iOk - 0 if the units were set correctly otherwise a negative error code.
% sUnitsOut - A string containing the old units

if (nargin == 2 || nargin == 3) % always get the old units
%step 1 find out how big the comment is
dummystring = blanks(1);
[iSize] = calllib('ceds64int', 'S64GetChanUnits', fhand, iChan, dummystring, -1);
%step 2 create a string buffer of the correct size
stringptr = blanks(iSize+1);
[iOk, sUnitsOut] = calllib('ceds64int', 'S64GetChanUnits', fhand, iChan, stringptr, 0);
else
iOk = -22;
end

% has there been an error?
if iOk < 0
return;
end

% if not set the new units if we're given some
if (nargin == 3)
iOk = calllib('ceds64int', 'S64SetChanUnits', fhand, iChan, sUnitsIn);
end
end

0 comments on commit b18a1bf

Please sign in to comment.