For immediate seizure video-data syncing for clinical viewing:

 

  1. Use Adobe Premiere on the Video Monitoring Laptop to export the

audio data from the video capture to a wav file. File->Export->Audio. Save it to the FireWire drive, not the main drive.

2 – Transfer the wav file to the nspike system recording directory

for the capture. USB thumb drive or portable HD works.

3 – Start matlab on nspike, cd to seizure capture directory, load the

rec-and-exp mat file.  Load experiment variable.

>recording_root = ‘NY67v2_CMC_RT_Tact_01’

>load ./NY67v2_CMC_RT_Tact_01-exp.mat

4 – Process the comedi file to extract the timecodes for the

videosync, for example:

>ntools_procComediVideoSync(recording_root)

This outputs NY67v2_CMC_RT_Tact_01.comedivideosync.txt

5 – Process the wav file to extract timecodes for the videosync, for

example:

>ntools_procWavVideoSync(recording_root)

This outputs NY67v2_CMC_RT_Tact_01.wavvideosync.txt

6 – If necessary to reduce size of ieeg.dat file, downsample on Nspike

>NTools_Process

Select “Sampling” (ex. 400) and “Data type” (ex. float32), click “Convert” and

select ieeg.dat file.

7 – Transfer the two text files, ieeg.dat, hdrxml, and exp.mat file to the Video

Monitoring Laptop and place in a directory with the video file.

Check that the experiment variable has correct sampling rate and data format,

if you downsampled. Also check that experiment.processing.ieeg

contains format and byte_size.

All files should be renamed to have the same prefix:

ie

NY67v2_CMC_RT_Tact_01.wavvideosync.txt

NY67v2_CMC_RT_Tact_01.comedivideosync.txt

NY67v2_CMC_RT_Tact_01.ieeg.dat

NY67v2_CMC_RT_Tact_01-exp.mat

NY67v2_CMC_RT_Tact_01.low.nspike.hdrxml

NY67v2_CMC_RT_Tact_01.avi

8 – Open Matlab on the Video Monitoring Laptop, and navigate to seizure data directory

>cd(‘C:\Documents and Settings\Nspike.VIDEOMON\Desktop\NY67v2 090125 Seizure’)

9 – Initialize the path so that the nsuite directories are in the

path.

>addpath(genpath(‘NSUITEPATH’));

10 – Initialize the path so that timesurfer directories are in the

path:

>addpath(genpath(‘TIMESURFERPATH’));

11 – Make sure play_video.m is in the path – simply copy it from the

previous NY67v2 Seizure directory to this new directory. This should have been added when software upgrades were done.

>which ts_browseraw

>which play_video

>cd(‘C:\Documents and Settings\Nspike.VIDEOMON\Desktop\NY67v2 seizure data’)

12 – View the data with the timesurfer browser

>ts_browseraw_graph(‘NY67v2_CMC_RT_Tact_01.low.nspike.dat’)

13 – Play the video for select time segments, 10 seconds or less in

duration.  For example, to play NY67v2_CMC_RT_Tact_01.avi from second

430 to second 440:

>video_file = ‘NY67v2_CMC_RT_Tact_01’

>play_video(video_file, 1638, 1643)

14 – Iterate play_video, delete old figures to keep things simple.

 

*REFERENCE*

Listed below are the matlab commands from NY194 syncing for reference (some variables were manually overwritten in the code, but should have been corrected). The hdrxml file also had to be regenerated on nspike.

 

On Nspike:

help ntools_hdrxml_read

[sfreq, num_channels, num_samples, precision, chan_names] = ntools_hdrxml_read(‘NY194_090728_prf_04.low.nspike.hdrxml’)

help ntools_hdrxml_write

hdr_name = ‘test.hdrxml’

ntools_hdrxml_write(hdr_name, sfreq, num_channels, [], precision, chan_names);

hdr_name = ‘NY194_090728_prf_04.low.nspike.hdrxml’

ntools_hdrxml_write(hdr_name, sfreq, num_channels, [], precision, chan_names);

NTools_Process

 

recording_root = ‘NY194_090728_prf_04’

help ntools_procComediVideoSync

ntools_procComediVideoSync(recording_root)

load *.mat

load ./NY194_090728_prf_04-exp.mat

experiment.recording

experiment.recording.comedi

global experiment

load ./NY194_090728_prf_04-exp.mat

ntools_procComediVideoSync(recording_root)

ntools_procWavVideoSync(recording_root)

 

help wavread

ls

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

whos y

plot(y(:,1))

 

pwd

cd matlab/

ls

cd ..

ls

addpath(genpath(‘svn_code/nsuite;))

addpath(genpath(‘svn_code/nsuite’))

strip_svn_dirs

cd svn_code/nsuite/

ls

cd ntools/

ls

cd proc

ls

open ntools_procWavVideoSync

cd /mnt/esata/NY194

ls

cd 090728/008

ls

y = wavread(‘NY194_090728_prf_04.wav’);

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

plot(y(:,1))

plot(y(:,2))

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

plot(y(:,2))

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

plot(y(:,2))

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

y = wavread(‘NY194_090728_prf_04.wav’,1e6);

y = wavread(‘NY194_090728_prf_04.wav’,1e5);

y = wavread(‘NY194_090728_prf_04.wav’,1e6);

plot(y(:,2))

pwd

ntools_procWavVideoSync(‘NY194_090728_prf_04’)

ls

!more NY194_090728_prf_04.wavvideosync.txt

!more NY194_090728_prf_04.comedivideosync.txt

 

which ts_browseraw_graph.m

 

ls

ls esata/

cd esata/NY177/090622/003/

ls

ts_browseraw_graph(‘NY177_090622_FWIO_03.low.nspike.dat’)

exp_defn_FWIO_10kHz

ts_browseraw_graph(‘NY177_090622_FWIO_03.low.nspike.dat’)

ts_browseraw(‘NY177_090622_FWIO_03.low.nspike.dat’)

which ts_browseraw

ts_browseraw(‘NY177_090622_FWIO_03.low.nspike.dat’)

ls

 

 

On the Video Monitoring laptop:

which ts_browseraw

edit ts_browseraw.m

edit ts_browseraw_graph.m

which play_video

cd(‘C:\Documents and Settings\Nspike.VIDEOMON\Desktop\NY194 seizure data’)

help play_video

edit play_video

recording_root = ‘NY194_090728_prf_04’

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

global experiment

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

experiment.processing

experiment.processing.ieeg.byte_size = 4;

save NY194_090728_prf_04-exp.mat experiment

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

experiment.processing.ieeg.format = ‘float’;

save NY194_090728_prf_04-exp.mat experiment

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

dbstop error

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

parms.readchans

diag(scale_facts(parms.readchans))

data

dbquit

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

doc odd

ts_browseraw_graph(‘NY194_090728_prf_04-1000Hz.low.nspike.dat’)

mod(size(data, 1), 2)

size(data)

video_file = ‘NY194_090728_prf_04.avi’

edit play_video

play_video(video_file, 1638, 1643)

dbquit

video_file = ‘NY194_090728_prf_04’

play_video(video_file, 1638, 1643)