Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yehaojie
plugin-GUI
Commits
8f4ea8d0
Commit
8f4ea8d0
authored
12 years ago
by
jsiegle
Browse files
Options
Downloads
Patches
Plain Diff
Rudimentary header implemented in data files
parent
3429a92f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/Processors/Channel.cpp
+1
-1
1 addition, 1 deletion
Source/Processors/Channel.cpp
Source/Processors/RecordNode.cpp
+40
-3
40 additions, 3 deletions
Source/Processors/RecordNode.cpp
Source/Processors/RecordNode.h
+7
-21
7 additions, 21 deletions
Source/Processors/RecordNode.h
with
48 additions
and
25 deletions
Source/Processors/Channel.cpp
+
1
−
1
View file @
8f4ea8d0
...
...
@@ -65,6 +65,6 @@ void Channel::reset()
void
Channel
::
createDefaultName
()
{
name
=
String
(
"C
hannel
"
);
name
=
String
(
"C
H
"
);
name
+=
num
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Source/Processors/RecordNode.cpp
+
40
−
3
View file @
8f4ea8d0
...
...
@@ -223,12 +223,16 @@ void RecordNode::setParameter (int parameterIndex, float newValue)
File
f
=
File
(
channelPointers
[
i
]
->
filename
);
bool
fileExists
=
f
.
exists
();
channelPointers
[
i
]
->
file
=
fopen
(
channelPointers
[
i
]
->
filename
.
toUTF8
(),
"a+b"
);
if
(
!
f
.
e
xists
()
)
if
(
!
f
ileE
xists
)
{
// create header (needs more details, obviously)
String
header
=
"THIS IS A HEADER."
;
// create header
String
header
=
generateHeader
(
channelPointers
[
i
]);
std
::
cout
<<
"Header size: "
<<
header
.
getNumBytesAsUTF8
()
<<
std
::
endl
;
fwrite
(
header
.
toUTF8
(),
1
,
header
.
getNumBytesAsUTF8
(),
channelPointers
[
i
]
->
file
);
}
...
...
@@ -271,14 +275,47 @@ void RecordNode::setParameter (int parameterIndex, float newValue)
if
(
isRecording
)
{
std
::
cout
<<
"OPENING FILE: "
<<
channelPointers
[
currentChannel
]
->
filename
<<
std
::
endl
;
File
f
=
File
(
channelPointers
[
currentChannel
]
->
filename
);
bool
fileExists
=
f
.
exists
();
channelPointers
[
currentChannel
]
->
file
=
fopen
(
channelPointers
[
currentChannel
]
->
filename
.
toUTF8
(),
"a+b"
);
if
(
!
fileExists
)
{
// create header
String
header
=
generateHeader
(
channelPointers
[
currentChannel
]);
fwrite
(
header
.
toUTF8
(),
1
,
header
.
getNumBytesAsUTF8
(),
channelPointers
[
currentChannel
]
->
file
);
}
}
}
}
}
}
String
RecordNode
::
generateHeader
(
Channel
*
ch
)
{
String
header
=
"header.description = 'OPEN EPHYS DATA FORMAT v0.0;'
\n
"
;
header
+=
"header.channel = '"
;
header
+=
ch
->
name
;
header
+=
"';
\n
"
;
header
+=
"header.bitVolts = "
;
header
+=
String
(
ch
->
bitVolts
);
header
+=
";
\n
"
;
header
=
header
.
paddedRight
(
' '
,
HEADER_SIZE
);
std
::
cout
<<
header
<<
std
::
endl
;
return
header
;
}
void
RecordNode
::
closeAllFiles
()
{
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/RecordNode.h
+
7
−
21
View file @
8f4ea8d0
...
...
@@ -36,6 +36,8 @@
#include
"GenericProcessor.h"
#include
"Channel.h"
#define HEADER_SIZE 1024
/**
Receives inputs from all processors that want to save their data.
...
...
@@ -135,34 +137,18 @@ private:
*/
Time
timer
;
/** Holds information for a given channel to be recorded to
its own file.
*/
// struct Channel
// {
// int nodeId;
// int chan;
// String name;
// bool isRecording;
// String filename;
// FILE* file;
// };
/** Closes all open files after recording has finished.
*/
void
closeAllFiles
();
/** Pointers to all continuous channels */
Array
<
Channel
*>
channelPointers
;
Array
<
Channel
*>
eventChannelPointers
;
/** Map of continuous channels.
*/
//std::map<int, Channel> continuousChannels;
/** Pointers to all event channels */
Array
<
Channel
*>
eventChannelPointers
;
/** Map of event channels.
*/
//std::map<int, std::map<int,Channel> > eventChannels;
/** Generates a header for a given channel */
String
generateHeader
(
Channel
*
ch
);
/** Method for writing continuous buffers to disk.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment