|
@@ -4,15 +4,14 @@ clear
|
|
|
clc
|
|
|
|
|
|
%% Directory of the repository and the NIX library
|
|
|
-strMainPath = 'human_amygdala_mua_seeg_fearvideo';
|
|
|
-strMainPath = 'Human_Amygdala_MUA_sEEG_FearVideo';
|
|
|
+strMainPath = 'Human_Amygdala_MUA_sEEG_FearVideo'; % 'human_amygdala_mua_seeg_fearvideo'
|
|
|
strNIXLibraryPath = 'nix-mx_Win64_1.4.1'; % or 'nix_mx_macOS_1.4.2_Matlab2020a'
|
|
|
|
|
|
%% Add necessary folders to the MATLAB path
|
|
|
addpath([strMainPath filesep 'code_MATLAB' filesep])
|
|
|
addpath(genpath(strNIXLibraryPath))
|
|
|
|
|
|
-warning('strMainPath should be the full path of the folder Human_Amygdala_MUA_sEEG_FearVideo')
|
|
|
+warning('strMainPath should be the full path of the folder for the repository Human_Amygdala_MUA_sEEG_FearVideo (or human_amygdala_mua_seeg_fearvideo)')
|
|
|
warning('strNIXLibraryPath should be the full path of the NIX library ''nix-mx_Win64_1.4.1''')
|
|
|
|
|
|
%% NIX data files
|
|
@@ -22,7 +21,7 @@ strNIXFileNames = {strNIXFileNames.name}';
|
|
|
assert(~isempty(strNIXFileNames),'strMainPath should be the full path of the folder Human_Amygdala_MUA_sEEG_FearVideo')
|
|
|
|
|
|
%% Select NIX file to open
|
|
|
-nFile = 5;
|
|
|
+nFile = 1;
|
|
|
|
|
|
%% Open NIX file
|
|
|
strFilePath = [strMainPath filesep 'data_NIX' filesep strNIXFileNames{nFile}];
|
|
@@ -163,20 +162,21 @@ ylabel(['Voltage (',dataArray_iEEG.unit,')'])
|
|
|
xlim([tiEEG(1),tiEEG(end)])
|
|
|
legend(striEEGLabels)
|
|
|
|
|
|
-%% Sources of the iEEG data
|
|
|
-sourceUnit = dataArray_iEEG.sources{1};
|
|
|
-% Electrode label
|
|
|
-sourceUnit.sources{1}.name
|
|
|
-% Anatomical location
|
|
|
-sourceUnit.sources{2}.name
|
|
|
-
|
|
|
-%% Use electrode map to get properties of the macroelectrode the unit is on
|
|
|
+%% Electrode information
|
|
|
groupiEEGElecrodes = block.openGroup('iEEG electrode information');
|
|
|
|
|
|
-nElectrode = find(strcmpi(cellfun(@(x) x.name,groupiEEGElecrodes.sources,'UniformOutput',0),sourceUnit.name));
|
|
|
-
|
|
|
-% MNI coordinates of the electrode
|
|
|
-groupiEEGElecrodes.multiTags{1}.retrieveFeatureData(nElectrode,'iEEG_Electrode_MNI_Coordinates')
|
|
|
+%% Sources of the iEEG data
|
|
|
+for nSource = 1:dataArray_iEEG.sourceCount
|
|
|
+ sourceUnit = dataArray_iEEG.sources{nSource};
|
|
|
+ % Electrode label
|
|
|
+ sourceUnit.sources{1}.name
|
|
|
+ % Anatomical location
|
|
|
+ sourceUnit.sources{2}.name
|
|
|
+
|
|
|
+ nElectrode = find(strcmpi(cellfun(@(x) x.name,groupiEEGElecrodes.sources,'UniformOutput',0),sourceUnit.name));
|
|
|
+ % MNI coordinates of the electrode
|
|
|
+ groupiEEGElecrodes.multiTags{1}.retrieveFeatureData(nElectrode,'iEEG_Electrode_MNI_Coordinates')
|
|
|
+end
|
|
|
|
|
|
%% Units
|
|
|
group_SpikeTimesMultitags = block.openGroup('Spike times multitags');
|
|
@@ -185,54 +185,52 @@ if(group_SpikeTimesMultitags.multiTagCount==0)
|
|
|
warning('This subject does not have any units')
|
|
|
|
|
|
else
|
|
|
-%% Select unit and trial
|
|
|
-nUnit = 1;
|
|
|
-nTrial = 5;
|
|
|
-% MultiTag for the selected unit and trial
|
|
|
-indUnitSpikeTimes = contains(cellfun(@(x) x.name,group_SpikeTimesMultitags.multiTags,'UniformOutput',0),['Unit_',num2str(nUnit),'_'])&...
|
|
|
- contains(cellfun(@(x) x.name,group_SpikeTimesMultitags.multiTags,'UniformOutput',0),['Trial_',num2str(nTrial,'%.2d')]);
|
|
|
-multiTag_SpikeTimes = group_SpikeTimesMultitags.multiTags{indUnitSpikeTimes};
|
|
|
-
|
|
|
-%% Spike times
|
|
|
-dataArray_SpikeTimes = multiTag_SpikeTimes.openPositions;
|
|
|
-% Read data
|
|
|
-SpikeTimes = dataArray_SpikeTimes.readAllData;
|
|
|
-
|
|
|
-figure
|
|
|
-stem(dataArray_SpikeTimes.readAllData,ones(length(SpikeTimes),1))
|
|
|
-title(['Spike times - Unit ',num2str(nUnit),' - Trial ',num2str(nTrial)])
|
|
|
-xlabel(['Time (',dataArray_SpikeTimes.dimensions{1}.unit,')'])
|
|
|
-
|
|
|
-%% Waveform for the unit
|
|
|
-dataArray_Waveform = multiTag_SpikeTimes.features{1}.openData;
|
|
|
-% Time axis
|
|
|
-tWaveform = (0:(double(dataArray_Waveform.dataExtent(2))-1))*dataArray_Waveform.dimensions{2}.samplingInterval+dataArray_Waveform.dimensions{2}.offset;
|
|
|
-% Read data
|
|
|
-waveform = dataArray_Waveform.readAllData;
|
|
|
-% Plot
|
|
|
-figure
|
|
|
-plot(tWaveform,waveform(1,:),'b')
|
|
|
-hold on
|
|
|
-plot(tWaveform,waveform(1,:)+waveform(2,:),'b--')
|
|
|
-plot(tWaveform,waveform(1,:)-waveform(2,:),'b--')
|
|
|
-title(['Waveform - Unit ',num2str(nUnit)])
|
|
|
-xlabel(['Time (',dataArray_Waveform.dimensions{2}.unit,')'])
|
|
|
-ylabel(['Voltage (',dataArray_Waveform.unit,')'])
|
|
|
-legend({'Mean','Std'})
|
|
|
-
|
|
|
-%% Source of the unit
|
|
|
-sourceUnit = dataArray_SpikeTimes.sources{1};
|
|
|
-% Electrode label
|
|
|
-sourceUnit.sources{1}.name
|
|
|
-% Anatomical location
|
|
|
-sourceUnit.sources{2}.name
|
|
|
-
|
|
|
-%% Use electrode map to get properties of the macroelectrode the unit is on
|
|
|
-groupiEEGElecrodes = block.openGroup('iEEG electrode information');
|
|
|
-
|
|
|
-nElectrode = find(strcmpi(cellfun(@(x) x.name,groupiEEGElecrodes.sources,'UniformOutput',0),sourceUnit.name));
|
|
|
-
|
|
|
-% MNI coordinates of the electrode
|
|
|
-groupiEEGElecrodes.multiTags{1}.retrieveFeatureData(nElectrode,'iEEG_Electrode_MNI_Coordinates')
|
|
|
-
|
|
|
+ %% Select unit and trial
|
|
|
+ nUnit = 1;
|
|
|
+ nTrial = 5;
|
|
|
+ % MultiTag for the selected unit and trial
|
|
|
+ indUnitSpikeTimes = contains(cellfun(@(x) x.name,group_SpikeTimesMultitags.multiTags,'UniformOutput',0),['Unit_',num2str(nUnit),'_'])&...
|
|
|
+ contains(cellfun(@(x) x.name,group_SpikeTimesMultitags.multiTags,'UniformOutput',0),['Trial_',num2str(nTrial,'%.2d')]);
|
|
|
+ multiTag_SpikeTimes = group_SpikeTimesMultitags.multiTags{indUnitSpikeTimes};
|
|
|
+
|
|
|
+ %% Spike times
|
|
|
+ dataArray_SpikeTimes = multiTag_SpikeTimes.openPositions;
|
|
|
+ % Read data
|
|
|
+ SpikeTimes = dataArray_SpikeTimes.readAllData;
|
|
|
+
|
|
|
+ figure
|
|
|
+ stem(dataArray_SpikeTimes.readAllData,ones(length(SpikeTimes),1))
|
|
|
+ title(['Spike times - Unit ',num2str(nUnit),' - Trial ',num2str(nTrial)])
|
|
|
+ xlabel(['Time (',dataArray_SpikeTimes.dimensions{1}.unit,')'])
|
|
|
+
|
|
|
+ %% Waveform for the unit
|
|
|
+ dataArray_Waveform = multiTag_SpikeTimes.features{1}.openData;
|
|
|
+ % Time axis
|
|
|
+ tWaveform = (0:(double(dataArray_Waveform.dataExtent(2))-1))*dataArray_Waveform.dimensions{2}.samplingInterval+dataArray_Waveform.dimensions{2}.offset;
|
|
|
+ % Read data
|
|
|
+ waveform = dataArray_Waveform.readAllData;
|
|
|
+ % Plot
|
|
|
+ figure
|
|
|
+ plot(tWaveform,waveform(1,:),'b')
|
|
|
+ hold on
|
|
|
+ plot(tWaveform,waveform(1,:)+waveform(2,:),'b--')
|
|
|
+ plot(tWaveform,waveform(1,:)-waveform(2,:),'b--')
|
|
|
+ title(['Waveform - Unit ',num2str(nUnit)])
|
|
|
+ xlabel(['Time (',dataArray_Waveform.dimensions{2}.unit,')'])
|
|
|
+ ylabel(['Voltage (',dataArray_Waveform.unit,')'])
|
|
|
+ legend({'Mean','Std'})
|
|
|
+
|
|
|
+ %% Source of the unit
|
|
|
+ sourceUnit = dataArray_SpikeTimes.sources{1};
|
|
|
+ % Electrode label
|
|
|
+ sourceUnit.sources{1}.name
|
|
|
+ % Anatomical location
|
|
|
+ sourceUnit.sources{2}.name
|
|
|
+
|
|
|
+ %% Use electrode map to get properties of the macroelectrode the unit is on
|
|
|
+ nElectrode = find(strcmpi(cellfun(@(x) x.name,groupiEEGElecrodes.sources,'UniformOutput',0),sourceUnit.name));
|
|
|
+
|
|
|
+ % MNI coordinates of the electrode
|
|
|
+ groupiEEGElecrodes.multiTags{1}.retrieveFeatureData(nElectrode,'iEEG_Electrode_MNI_Coordinates')
|
|
|
+
|
|
|
end
|