123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- %% CorSE Algorithm for Functional Connectivity
- % This algorithm calculates the correlated spectral entropy (CorSE) based functional
- %connectivity between % two time series. For more information,
- %<http://journal.frontiersin.org/article/10.3389/fncom.2016.00112/full Kapucu et al.(2016)>. Please cite the paper if you have used or inspired by the method.
- %Copyright (c) 2016, Kapucu
- %All rights reserved.
- %Redistribution and use in source and binary forms, with or without
- %modification, are permitted provided that the following conditions are met:
- %* Redistributions of source code must retain the above copyright notice, this
- %list of conditions and the following disclaimer.
- %* Redistributions in binary form must reproduce the above copyright notice,
- %this list of conditions and the following disclaimer in the documentation
- %and/or other materials provided with the distribution
- %THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- %AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- %IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- %DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- %FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- %DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- %SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- %CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- %OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- %OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- %Select the .h5 file for yor analysis
- [file,path] = uigetfile('*.h5');
- TargetFile=[path file];
- Plate_type=h5readatt(TargetFile, '/DataInfo/', 'Plate type');
- if strcmp(Plate_type, '12-well plate')
- final_ch_col = 8;
- final_ch_row = 8;
- final_well_col = 4;
- final_well_row = 3;
- elseif strcmp(Plate_type, '48-well plate')
- final_ch_col = 4;
- final_ch_row = 4;
- final_well_col = 8;
- final_well_row = 6;
- else
- disp('Unknown MEA layout!')
-
-
-
- end
- ExcludedWells=h5read(TargetFile, '/DataInfo/ExcludedWells');
- disp('Note the excluded wells!:')
- disp(ExcludedWells)
- InactiveChannels=h5read(TargetFile, '/DataInfo/InactiveChannels');
- disp('Inactive channels!:')
- disp(InactiveChannels)
- %%
- prompt='Select your well.Please, use capital letters, e.g. A1:';
- MyWell = inputdlg(prompt);
- MyWell=MyWell{:};
- %%
- well_row=double(MyWell(1)-64);
- well_col=str2double(MyWell(2:end));
- %%
- splitter=@(x) strsplit(x, '/');
- RecordedWells={h5info(TargetFile).Groups(1).Groups.Name};
- if ~any(strcmp(cellfun(@(z) z{end}, cellfun(splitter,RecordedWells, 'UniformOutput',false), 'UniformOutput',false), MyWell))
- error(['Either well ' MyWell ' ' 'is excluded or it does not exist in the corresponding layout!']);
- end
-
-
- %%
-
-
- for i = 1 : final_ch_row
-
- for j = 1 : final_ch_col
-
- try
- temp = h5read(TargetFile, strcat('/Data/', MyWell, '/', num2str(i) , num2str(j)));
- catch
- disp(['The channel ' MyWell '_' num2str(i) num2str(j) ' is not recorded in the file'])
- temp=[];
- end
- DataCell{final_ch_row*(i-1)+j,7} = temp';
- DataCell{final_ch_row*(i-1)+j,1} = ['CH' num2str(i) num2str(j)];
-
- end
- end
-
- Spectral_entropy_HighPass_data_adaptive;
|