OSCR

Dynamic alterations in cardiac autonomic regulation during recurrent generalized seizures.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § STAR★Methods › Quantification and statistical analysis ↔ Source Code - OWS and dFdt update/ElectroMap.m, lines 64–134 · score 0.52 · spatially filtered, ElectroMap, Gaussian, signals, mapping
  2. [2] § STAR★Methods › Quantification and statistical analysis ↔ Source Code/ElectroMap.m, lines 64–131 · score 0.52 · spatially filtered, ElectroMap, Gaussian, signals, mapping

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 4,115 lines · 134 KB · BSD-3-Clause · 1 match

  1. function varargout = ElectroMap(varargin)
  2. % Main function for running ElectroMap.
  3. % Chris O'Shea and Ting Yue Yu, University of Birmingham
  4. % Maintained by Chris O'Shea - Email [email hidden] for any queries
  5. % Version 1.0
  6. % Release Date -
  7. % For license information, please see 'license.txt' at ...
  8. % Last Updated -
  9. % Update Summary
  10. % ElectroMap MATLAB code for ElectroMap.fig
  11. % ElectroMap, by itself, creates a new ElectroMap or raises the existing
  12. % singleton*.
  13. %
  14. % H = ElectroMap returns the handle to a new ElectroMap or the handle to
  15. % the existing singleton*.
  16. %
  17. % ElectroMap('CALLBACK',hObject,eventData,handles,...) calls the local
  18. % function named CALLBACK in ElectroMap.M with the given input arguments.
  19. %
  20. % ElectroMap('Property','Value',...) creates a new ALLM or raises the
  21. % existing singleton*. Starting from the left, property value pairs are
  22. % applied to the GUI before ElectroMap_OpeningFcn gets called. An
  23. % unrecognized property name or invalid value makes property application
  24. % NUstop. All inputs are passed to ElectroMap_OpeningFcn via varargin.
  25. %
  26. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  27. % instance to run (singleton)"
  28. %
  29. % See also: GUIDE, GUIDATA, GUIHANDLESF
  30. % Edit the above text to modify the response to help ElectroMap
  31. % Last Modified by GUIDE v2.5 27-Nov-2019 18:13:25
  32. % Begin initialization code - DO NOT EDIT
  33. gui_Singleton = 1;
  34. gui_State = struct('gui_Name', mfilename, ...
  35. 'gui_Singleton', gui_Singleton, ...
  36. 'gui_OpeningFcn', @ElectroMap_OpeningFcn, ...
  37. 'gui_OutputFcn', @ElectroMap_OutputFcn, ...
  38. 'gui_LayoutFcn', [] , ...
  39. 'gui_Callback', []);
  40. if nargin && ischar(varargin{1})
  41. gui_State.gui_Callback = str2func(varargin{1});
  42. end
  43. if nargout
  44. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  45. else
  46. gui_mainfcn(gui_State, varargin{:});
  47. end
  48. % End initialization code - DO NOT EDIT
  49. % --- Executes just before ElectroMap is made visible.
  50. function ElectroMap_OpeningFcn(hObject, ~, handles, varargin)
  51. % Fucnction for setting values on interface intialisation
  52. handles.output = hObject;
  53. set(handles.invertopt,'Value',1); %inversion of signal
  54. set(handles.sfilt,'Value',2); %spatial filtering (gaussian)
  55. set(handles.velout, 'Value', 4); %Velociy outlier removal
  56. handles.bgon=1; %background on/off switch
  57. handles.bgcol='w'; %backgroung colour
  58. handles.folder_name=[]; %filled when directory folder chosen
  59. handles.fname='opening of GUI hold';
  60. handles.lastprocessedfname='opening of GUI hold'; %holds for loaded and processed files
  61. warning('off','all')
  62. handles.drawcon=0;
  63. handles.conbon=[];
  64. handles.medifilt=1;
  65. masterdir=cd;
  66. if isdeployed == 0
  67. addpath(masterdir,'-frozen');
  68. end
  69. handles.ttpstart=10;
  70. handles.ttpend=90; %time to peak defualt settings
  71. handles.roinum=1;
  72. handles.roisum=0; %roi defualt settings
  73. handles.snrt1=10;
  74. handles.snrt2=30;
  75. handles.pbefore=5;
  76. handles.pafter=5;
  77. handles.ep=0;
  78. handles.herefromroiload=0; %switch for load roi from .txt file
  79. set(handles.manthresh,'Enable','off') %slider off unless manual trheshold level set
  80. handles.rect=[];
  81. handles.loadedmask=[];
  82. set(handles.resegment,'Enable','off')
  83. set(handles.B2B,'Enable','off')
  84. set(handles.pushprocess,'Enable','off')
  85. set(handles.producemaps,'Enable','off')
  86. handles.herefromsegmentpush=0;
  87. handles.filming = 0; %switch for saving maps to video files
  88. %axis not visible until something is in them
  89. axes(handles.mapaxes); axis off
  90. axes(handles.bgimage);axis off
  91. axes(handles.axes2);axis off
  92. axes(handles.cb); axis off
  93. axes(handles.imageaxes); axis off
  94. zoom xon
  95. handles.isZoomed=0;
  96. handles.dFlevel=0;
  97. handles.i_framerate=16;
  98. handles.fmin=0.5;handles.fmax=10;handles.fbin=0.05;handles.dfwin=0; %Frequency mapping defaults
  99. % Update handles structure
  100. guidata(hObject, handles);
  101. % UIWAIT makes ElectroMap wait for user response (see UIRESUME)
  102. % uiwait(handles.ElectroMap);
  103. % --- Outputs from this function are returned to the command line.
  104. function varargout = ElectroMap_OutputFcn(~, ~, handles)
  105. % varargout cell array for returning output args (see VARARGOUT);
  106. % hObject handle to figure
  107. % eventdata reserved - to be defined in a future version of MATLAB
  108. % handles structure with handles and user data (see GUIDATA)
  109. % Get default command line output from handles structure
  110. varargout{1} = handles.output;
  111. % --- Executes on button press in pushselect.
  112. function pushselect_Callback(hObject, ~, ~)
  113. % hObject handle to pushselect (see GCBO)
  114. % eventdata reserved - to be defined in a future version of MATLAB
  115. % handles structure with handles and user data (see GUIDATA)
  116. handles = guidata(hObject);
  117. %% Populate listbox with .mat and .tif files
  118. set(handles.listbox1,'Value',1); %set value to 1 on each new file chosen to stop error
  119. [handles.folder_name]=uigetdir;
  120. workingdir=handles.folder_name;
  121. if isdeployed == 0
  122. cd(workingdir);
  123. end
  124. %get all files in directory
  125. allfiles = dir(handles.folder_name);
  126. if isdeployed == 0
  127. addpath(handles.folder_name);
  128. end
  129. file_list= {};
  130. count=0;
  131. %Find tif and mat files
  132. for i=1:length(allfiles)
  133. k = strfind(allfiles(i).name, '.TIF');
  134. d = strfind(allfiles(i).name, '.tif');
  135. m = strfind(allfiles(i).name, '.mat');
  136. %l = isfolder(allfiles(i).name);
  137. if isempty(k) ~= 1 %&& l ~= 1
  138. count=count+1;
  139. file=allfiles(i).name;
  140. file_list{count}=file;
  141. end
  142. if isempty(d) ~= 1 %&& l ~= 1
  143. count=count+1;
  144. file=allfiles(i).name;
  145. file_list{count}=file;
  146. end
  147. if isempty(m) ~= 1 %&& l ~= 1
  148. count=count+1;
  149. file=allfiles(i).name;
  150. file_list{count}=file;
  151. end
  152. end
  153. set(handles.listbox1,'String',file_list);
  154. guidata(hObject, handles);
  155. % --- Executes on selection change in listbox1.
  156. function listbox1_Callback(~, ~, ~)
  157. % hObject handle to listbox1 (see GCBO)
  158. % eventdata reserved - to be defined in a future version of MATLAB
  159. % handles structure with handles and user data (see GUIDATA)
  160. % --- Executes during object creation, after setting all properties.
  161. function listbox1_CreateFcn(hObject, ~, ~)
  162. % hObject handle to listbox1 (see GCBO)
  163. % eventdata reserved - to be defined in a future version of MATLAB
  164. % handles empty - handles not created until after all CreateFcns called
  165. % Hint: listbox controls usually have a white background on Windows.
  166. % See ISPC and COMPUTER.
  167. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  168. set(hObject,'BackgroundColor','white');
  169. end
  170. % --- Executes on button press in pushload.
  171. function pushload_Callback(hObject, ~, ~)
  172. handles = guidata(hObject);
  173. set(handles.listbox2,'Value',1);
  174. set(handles.pushprocess,'Enable','on')
  175. set(handles.producemaps,'Enable','off')
  176. %% Get image info from GUI
  177. %image
  178. handles.threshop=get(handles.threshopt,'Value'); %thershold choice
  179. handles.threshman=(get(handles.manthresh,'Value')); %manual thershold setting
  180. imchoice=get(handles.imagedisp,'Value'); %image to display
  181. cropchoice=get(handles.cropbox,'Value'); %crop image setting
  182. handles.cropchoice=cropchoice; %0 means no crop, 1 mean new crop, 2 means crop from before
  183. if cropchoice == 1
  184. handles.rect = [];
  185. end
  186. quinnieopt=get(handles.squareROI,'Value'); %custom ROI setting
  187. %% file info
  188. chosenfilecontents=cellstr(get(handles.listbox1,'String'));
  189. choice=get(handles.listbox1,'Value');
  190. fname=chosenfilecontents{choice};
  191. if ispc == 1 %change of file setting it mac or pc
  192. handles.fnamenew=[handles.folder_name,'\',fname];
  193. else
  194. handles.fnamenew=[handles.folder_name,'/',fname];
  195. end
  196. tf = strcmp(handles.fname,handles.fnamenew);
  197. if tf == 0
  198. handles.rect = [];
  199. handles.images=[];
  200. handles.lastprocessedfname='Pressing load or changing threshold hold';
  201. end
  202. handles.fname=handles.fnamenew;
  203. %% If custom roi chosen, get rid off manual thresholding
  204. if quinnieopt == 1 || handles.herefromroiload == 1
  205. handles.threshop = 2;
  206. handles.threshman = -50000;
  207. if handles.herefromroiload == 1
  208. quinnieopt = 0;
  209. end
  210. end
  211. %% load, crop and reset opt, threshold image
  212. inversion=get(handles.invertopt,'Value');
  213. camopt=0;
  214. axes(handles.imageaxes)
  215. set(handles.resegment,'Enable','off')
  216. set(handles.B2B,'Enable','off')
  217. %% Load new image using OMimload function
  218. if tf == 0
  219. [num_images,handles.newrect,mask,im,handles.I,boundaries,handles.camopt,handles.frame1,handles.fluoim,handles.rois,handles.rhsn,handles.tstack] = OMimload(handles.fname,cropchoice,quinnieopt,handles.threshop,handles.threshman,handles.rect,inversion,camopt,get(handles.imagedisp,'Value'),handles.roinum,handles.roisum);
  220. handles.mask=[];
  221. handles.mask=mask;
  222. handles.im=im; handles.num_images=num_images; handles.rect=handles.newrect;
  223. %handles.loadedmask=[];
  224. %handles.herefromroiload = 0;
  225. if isempty(handles.loadedmask) == 0 && handles.herefromroiload == 1
  226. handles.mask=[];
  227. handles.I=[];
  228. mask=handles.loadedmask;
  229. mask=uint16(mask);
  230. boundaries = bwboundaries(mask);
  231. handles.mask=mask;
  232. if size(im,1) ~= size(mask,1) || size(im,2) ~= size(mask,2)
  233. if abs(size(im,1)-size(mask,1)) <= 2 && abs(size(im,2)-size(mask,2)) <= 2
  234. choice = questdlg('ROI dimensons do not match Image but only slighty off. Would you like to reshape ROI?', ...
  235. 'ROI mismatch', ...
  236. 'Yes','No','Yes');
  237. switch choice
  238. case 'Yes'
  239. [rows,cols]=size(im);
  240. [rows2,cols2]=size(mask);
  241. if rows<=rows2
  242. rows3=rows;
  243. else
  244. rows3=rows2;
  245. end
  246. if cols<=cols2
  247. cols3=cols;
  248. else
  249. cols3=cols2;
  250. end
  251. newmask=zeros(rows,cols);
  252. for r=1:rows3
  253. for c=1:cols3
  254. newmask(r,c)=mask(r,c);
  255. end
  256. end
  257. mask=uint16(newmask);
  258. end
  259. else
  260. handles.herefromroiload = 0;
  261. handles.loadedmask=[];
  262. guidata(hObject,handles)
  263. h=errordlg('Loaded ROI dimensions do not match Image');
  264. waitfor(h)
  265. end
  266. end
  267. handles.I=im.*mask;
  268. handles.mask=mask;
  269. end
  270. set(handles.cropbox,'Value',0);
  271. handles.boundaries=boundaries;
  272. end
  273. %% Rethreshold loaded image set
  274. if tf == 1
  275. [num_images,handles.newrect,mask,im,handles.I,boundaries,handles.camopt,handles.frame1,handles.fluoim,handles.rois,handles.rhsn] = OMimload(handles.fname,cropchoice,quinnieopt,handles.threshop,handles.threshman,handles.rect,inversion,camopt,get(handles.imagedisp,'Value'),handles.roinum,handles.roisum);;
  276. handles.mask=[];
  277. handles.mask=mask;
  278. handles.im=im; handles.num_images=num_images; handles.rect=handles.newrect;
  279. %handles.loadedmask=[];
  280. %handles.herefromroiload = 0;
  281. if isempty(handles.loadedmask) == 0 && handles.herefromroiload == 1
  282. handles.mask=[];
  283. handles.I=[];
  284. mask=handles.loadedmask;
  285. mask=uint16(mask);
  286. boundaries = bwboundaries(mask);
  287. handles.mask=mask;
  288. if size(im,1) ~= size(mask,1) || size(im,2) ~= size(mask,2)
  289. if abs(size(im,1)-size(mask,1)) <= 2 && abs(size(im,2)-size(mask,2)) <= 2
  290. choice = questdlg('ROI dimensons do not match Image but only slighty off. Would you like to reshape ROI?', ...
  291. 'ROI mismatch', ...
  292. 'Yes','No','Yes');
  293. switch choice
  294. case 'Yes'
  295. [rows,cols]=size(im);
  296. [rows2,cols2]=size(mask);
  297. if rows2>rows && cols2>cols
  298. newmask=zeros(rows,cols);
  299. for r=1:rows
  300. for c=1:cols
  301. newmask(r,c)=mask(r,c);
  302. end
  303. end
  304. end
  305. if rows>rows2 && cols>cols2
  306. newmask=zeros(rows,cols);
  307. for r=1:rows2
  308. for c=1:cols2
  309. newmask(r,c)=mask(r,c);
  310. end
  311. end
  312. end
  313. mask=uint16(newmask);
  314. end
  315. else
  316. handles.herefromroiload = 0;
  317. handles.loadedmask=[];
  318. guidata(hObject,handles);
  319. h=errordlg('Loaded ROI dimensions do not match Image');
  320. waitfor(h)
  321. end
  322. end
  323. handles.I=im.*mask;
  324. handles.mask=mask;
  325. end
  326. set(handles.cropbox,'Value',0);
  327. handles.boundaries=boundaries;
  328. end
  329. %% change pic in GUI
  330. axes(handles.imageaxes);
  331. cla;
  332. if imchoice == 1
  333. imshow(handles.frame1,[],'InitialMagnification', 400)
  334. colormap('gray')
  335. freezeColors
  336. hold on
  337. for i=1:size(boundaries,1)
  338. plot(boundaries{i}(:,2),boundaries{i}(:,1),'r','LineWidth',2);
  339. end
  340. hold off
  341. end
  342. if imchoice == 2
  343. imshow(handles.fluoim,[],'InitialMagnification', 400)
  344. colormap('jet')
  345. freezeColors
  346. hold on
  347. for i=1:size(boundaries,1)
  348. plot(boundaries{i}(:,2),boundaries{i}(:,1),'k','LineWidth',2);
  349. end
  350. hold off
  351. end
  352. set(handles.pushprocess,'Enable','on')
  353. set(handles.producemaps,'Enable','off')
  354. guidata(hObject, handles);
  355. % --- Executes on button press in pushprocess.
  356. function pushprocess_Callback(hObject, ~, handles)
  357. % hObject handle to pushprocess (see GCBO)
  358. % eventdata reserved - to be defined in a future version of MATLAB
  359. % handles structure with handles and user data (see GUIDATA)
  360. %handles = guidata(hObject);
  361. %% get processing options from GUI
  362. %segmentation
  363. minpeakdist = str2double(get(handles.minpeak,'String'));
  364. minpeakdist = ceil(minpeakdist/(1/str2double(get(handles.framerate,'String'))));
  365. handles.minpeakdist=minpeakdist;
  366. segchoice = get(handles.segchoice,'Value');
  367. div=str2double(get(handles.segsize,'String'));
  368. minboundary=str2double(get(handles.minbound,'String'));
  369. minmumofpeaks=str2double(get(handles.minnum,'String'));
  370. handles.avgCL=[];
  371. %Baseline
  372. BLopt=(get(handles.BLopt,'Value'));
  373. %filtering
  374. tfilt=get(handles.tfilt,'Value');
  375. sfilt=get(handles.sfilt,'Value');
  376. sfiltsize=str2double(get(handles.sfiltsize,'String'));
  377. %outlieropts
  378. handles.outlier=get(handles.apdout,'Value');
  379. handles.outliervel=get(handles.velout,'Value');
  380. %inversion
  381. inversion=get(handles.invertopt,'Value');
  382. % frame removal
  383. handles.frameremove=get(handles.removef,'Value');
  384. %% is same file check and process images
  385. chosenfilecontents=cellstr(get(handles.listbox1,'String'));
  386. choice=get(handles.listbox1,'Value');
  387. newfname=chosenfilecontents{choice};
  388. tf = strcmp(newfname,handles.lastprocessedfname);
  389. if tf == 0
  390. loadnewims=1;
  391. handles.lastprocessedfname=newfname;
  392. elseif tf == 1 && handles.herefromsegmentpush == 0
  393. newsettingschoice = questdlg('Re-Process?', ...
  394. 'Re-Load same file', ...
  395. 'Yes','No - Just segment','No - Just segment');
  396. switch newsettingschoice
  397. case 'Yes'
  398. loadnewims = 1;
  399. case 'No - Just segment'
  400. loadnewims = 0;
  401. num_images=handles.num_images;
  402. end
  403. elseif tf == 1 && handles.herefromsegmentpush == 1
  404. loadnewims = 0;
  405. end
  406. if loadnewims == 1
  407. if isempty(handles.rect) == 0
  408. handles.cropchoice = 1;
  409. end
  410. handles.averages=[];
  411. tic
  412. [handles.preimages,images,averages,mask] = OMimprocess(handles.fname,handles.im,handles.rect,handles.num_images,handles.cropchoice,handles.mask,sfilt,sfiltsize,inversion,tfilt,handles.frameremove,handles.camopt,str2double(get(handles.sfiltsigma,'String')),handles.pbefore,handles.pafter,handles.rhsn,handles.tstack);
  413. toc
  414. handles.waverages=averages;
  415. handles.images=images;
  416. handles.averages=averages;
  417. num_images=handles.num_images;
  418. handles.mask=mask;
  419. end
  420. set(handles.resegment,'Enable','on')
  421. set(handles.B2B,'Enable','on')
  422. if loadnewims == 0
  423. averages=handles.averages;
  424. images=handles.images;
  425. num_images=handles.num_images;
  426. end
  427. %% Baseline Drift Correction
  428. %Top hat filter
  429. if BLopt == 1 || BLopt == 4
  430. th_len=str2double(get(handles.thlen,'String'));
  431. th_len=(th_len)/str2double(get(handles.framerate,'String'));
  432. th_len=round(th_len);
  433. se = strel('line', th_len, 0.5);
  434. BLAV = imopen(averages, se);
  435. %figure, plot(BL)
  436. end
  437. %Poly 4th degree
  438. if BLopt == 2 || BLopt == 5
  439. [p,~,mu]=polyfit(1:length(averages),averages,4);
  440. BLAV=polyval(p,1:length(averages),[],mu);
  441. end
  442. %Poly 11th degree
  443. if BLopt == 3 || BLopt == 6
  444. [p,~,mu]=polyfit(1:length(averages),averages,11);
  445. BLAV=polyval(p,1:length(averages),[],mu);
  446. end
  447. % No BL correction
  448. if BLopt == 7
  449. BLAV=min(averages);
  450. end
  451. handles.averages = (averages-BLAV); %Baseline subtraction
  452. %% Remove baseline from each pixel
  453. BLAV=BLAV-min(BLAV);
  454. if BLopt == 4 || BLopt == 5 || BLopt == 6
  455. for t = 1:size(images,3)
  456. images(:,:,t)=images(:,:,t)+BLAV(t);
  457. end
  458. end
  459. wb=waitbar(0.5,'Removing Baseline');
  460. signal=zeros(1,size(images,3));
  461. if BLopt == 1 || BLopt == 2 || BLopt == 3
  462. for row=1:size(images,1) %%MY BL REMOVAL
  463. for col=1:size(images,2)
  464. for frame = 1:size(images,3)
  465. signal(frame)=images(row,col,frame);
  466. end
  467. if inversion == 1
  468. signal=imcomplement(signal);
  469. end
  470. if BLopt == 1
  471. se = strel('line', th_len, 0.5);
  472. BL = imopen(signal, se);
  473. end
  474. if BLopt == 2
  475. [p,~,mu]=polyfit(1:length(signal),signal,4);
  476. BL=polyval(p,1:length(images(row,col,:)),[],mu);
  477. end
  478. if BLopt == 3
  479. [p,~,mu]=polyfit(1:length(signal),signal,11);
  480. BL=polyval(p,1:length(signal),[],mu);
  481. end
  482. for frame = 1:size(images,3)
  483. images(row,col,frame)=images(row,col,frame)+BL(frame);
  484. end
  485. images(row,col,:)=images(row,col,:) - min(images(row,col,:)); %make all mins zero
  486. end
  487. end
  488. end
  489. handles.images=images;
  490. waitbar(0.95,wb,'Segmenting Signal');
  491. wholav=handles.averages;
  492. %% Display Signal
  493. schoice = 1
  494. if schoice == 1
  495. handles.averages=handles.waverages;
  496. end
  497. if schoice == 2 || schoice == 3 || schoice == 4
  498. if schoice == 2 || schoice == 4
  499. figure,
  500. imshow(handles.frame1, [],'InitialMagnification', 800)
  501. title('Make your selection and press enter');
  502. [~,rec]=imcrop;
  503. cropfig=gcf;
  504. close(cropfig)
  505. rec=floor(rec);
  506. r1=rec(2);
  507. c1=rec(1);
  508. if r1 == 0
  509. r1=1;
  510. end
  511. if c1 == 0
  512. c1=1;
  513. end
  514. r2=floor(rec(2)+rec(4));
  515. c2=floor(rec(1)+rec(3));
  516. [ar,ac,numim]=size(handles.images);
  517. rmask=zeros(ar,ac);
  518. for r=r1:r2
  519. for c=c1:c2
  520. rmask(r,c)=1;
  521. end
  522. end
  523. rmask=uint16(rmask);
  524. newav=zeros(1,numim);
  525. for j=1:numim
  526. class(handles.images)
  527. class(rmask)
  528. roiim=handles.images(:,:,j).*rmask;
  529. newav(j)=sum(sum(roiim));
  530. end
  531. % figure,
  532. newav=imcomplement(newav);
  533. newav=newav-min(newav);
  534. end
  535. if schoice == 3 || schoice == 4
  536. if schoice == 3
  537. newav=handles.waverages;
  538. end
  539. dnewav=smooth(newav);
  540. dnewav=smooth(diff(dnewav));
  541. dnewav(1:10)=0;
  542. dnewav=dnewav-min(dnewav);
  543. dnewav(1:10)=0;
  544. newav=[0,dnewav'];
  545. end
  546. %save overall average for later
  547. wholav=handles.averages;
  548. handles.averages=newav;
  549. end
  550. set(handles.listbox2,'Value',1)
  551. axes(handles.axes2)
  552. plot(handles.averages)
  553. drawnow()
  554. %% BLremoval
  555. %% Baseline Drift Correction
  556. if schoice == 1 || schoice == 2
  557. if schoice == 1
  558. handles.averages=wholav;
  559. end
  560. if BLopt == 1 || BLopt == 4
  561. th_len=str2double(get(handles.thlen,'String'));
  562. th_len=(th_len)/str2double(get(handles.framerate,'String'));
  563. th_len=round(th_len);
  564. se = strel('line', th_len, 0.5);
  565. BLAV = imopen(handles.averages, se);
  566. %figure, plot(BL)
  567. end
  568. if BLopt == 2 || BLopt == 5
  569. [p,~,mu]=polyfit(1:length(handles.averages),handles.averages,4);
  570. BLAV=polyval(p,1:length(handles.averages),[],mu);
  571. end
  572. if BLopt == 3 || BLopt == 6
  573. [p,~,mu]=polyfit(1:length(handles.averages),handles.averages,11);
  574. BLAV=polyval(p,1:length(handles.averages),[],mu);
  575. end
  576. if BLopt == 7
  577. BLAV=min(handles.averages);
  578. end
  579. handles.averages = (handles.averages-BLAV);
  580. end
  581. axes(handles.axes2)
  582. plot(handles.averages)
  583. drawnow()
  584. %% DETECT PEAKS
  585. before=str2double(get(handles.beforeGUI,'String'));
  586. before=before*str2double(get(handles.framerate,'String'));
  587. before=round(before);
  588. after=str2double(get(handles.afterGUI,'String'));
  589. after=after*str2double(get(handles.framerate,'String'));
  590. after=round(after);
  591. handles.locs=[];handles.q2locs=[];handles.avgCL=[];
  592. [handles.locs,~,handles.q2locs,handles.avgCL,handles.numofpeaksoverall,handles.peakheight]=Omseg2...
  593. (handles.averages,str2double(get(handles.peakhigh,'String')),minpeakdist,str2double(get(handles.peakhigh,'String')),minpeakdist,minboundary,segchoice,minmumofpeaks,num_images,div,before,after);
  594. %% Zoomed Section
  595. axes(handles.axes2);
  596. origInfo = getappdata(gca, 'matlab_graphics_resetplotview');
  597. handles.isZoomed = 0;
  598. if isempty(origInfo)
  599. handles.isZoomed = 0;
  600. else
  601. handles.isZoomed = 1;
  602. end
  603. exposure=1/str2double(get(handles.framerate,'String'));
  604. handles.newlim=get(gca,'XLim')/exposure;
  605. handles.newlim(1)=floor(handles.newlim(1));
  606. handles.newlim(2)=ceil(handles.newlim(2));
  607. %% axes2
  608. handles.avgCL=handles.avgCL.*(1/str2double(get(handles.framerate,'String')));
  609. axes(handles.axes2)
  610. cla
  611. CM =['b','r','g','y','c','m','k'];
  612. exposure=1/str2double(get(handles.framerate,'String'));
  613. handles.averagestime=(0:1:(length(handles.averages)-1))*exposure;
  614. plot(handles.averagestime, handles.averages,'k'),
  615. xlabel('time (ms) \rightarrow');
  616. ylabel('Fluorescence Intensity');
  617. xlim([0 length(handles.averages)*exposure]);
  618. hold on
  619. plot(handles.averagestime(handles.locs),handles.averages(handles.locs), 'or');
  620. before=round(str2double(get(handles.beforeGUI,'String'))/exposure);
  621. after=round(str2double(get(handles.afterGUI,'String'))/exposure);
  622. if length(handles.locs) < 2
  623. handles.q2locs=handles.locs;
  624. handles.avgCL(2,1)=0;
  625. end
  626. for i = 1:length(handles.q2locs(:,1))
  627. c=mod(i,6);
  628. if c == 0
  629. c=6;
  630. end
  631. handles.q2locs;
  632. A=(handles.q2locs(i,:));
  633. if isempty(A) == 1
  634. errordlg('No constant cycle length regions found. Please adjust pre-process settings')
  635. end
  636. if min(A(A>0)) < before %if first peak v.close to beginning it is ignored to stop dim error
  637. k = find(A);
  638. A(k(1))=0;
  639. end
  640. tstart=min(A(A>0))-before;
  641. if tstart == 0
  642. tstart = 1;
  643. end
  644. tend=max(A)+after;
  645. if tend > length(handles.averagestime)
  646. if length(A)>1
  647. tend = A(end-1)+after;
  648. elseif length(A) == 1
  649. tend=length(handles.averagestime);
  650. c=7;
  651. end
  652. end
  653. if tend>length(handles.averagestime)
  654. tend=length(handles.averagestime);
  655. end
  656. plot(handles.averagestime(tstart:tend),handles.averages(tstart:tend),'color',CM(c));
  657. end
  658. %end
  659. colorbar off
  660. hold off
  661. set(gca,'FontSize',8);
  662. ax=gca;
  663. line(get(ax,'XLim'),[handles.peakheight handles.peakheight],'Color','b')
  664. %populate section listbox
  665. section = {};
  666. if handles.numofpeaksoverall == 1
  667. section{1}=('N/A');
  668. else
  669. for i = 1:length(handles.q2locs(:,1))
  670. length(handles.q2locs(:,1));
  671. handles.q2locs;
  672. handles.avgCL;
  673. section{i}=[num2str(i),' (',num2str((handles.avgCL(2,i))),'ms)'];
  674. end
  675. end
  676. %% add zoomed section
  677. if handles.isZoomed == 1
  678. handles.q2locs
  679. if length(handles.q2locs(1,:)) < 2 %for single peak seg
  680. handles.q2locs(:,end+1)=0;
  681. end
  682. newline=zeros(1,length(handles.q2locs(1,:)));
  683. newline(1)=handles.newlim(1);
  684. newline(2)=handles.newlim(2);
  685. handles.q2locs=[handles.q2locs;newline];
  686. newsection='Zoomed Section';
  687. section{length(section)+1}=newsection;
  688. end
  689. handles.section=section;
  690. %% Couple sections to auto windows
  691. %peak count set to 1 because of first ignored peak, should be changes
  692. handles.winopt=1;
  693. if length(handles.locs) == 1 || length(handles.locs) == 2
  694. if length(handles.locs) == 1
  695. handles.q2locs(1,1)=handles.locs;
  696. end
  697. if length(handles.locs) == 2
  698. handles.q2locs=[];
  699. handles.q2locs=handles.locs;
  700. CL2=handles.locs(2)-handles.locs(1)*exposure;
  701. handles.section;
  702. handles.section{1}=[num2str(CL2),'ms'];
  703. section=handles.section;
  704. end
  705. end
  706. set(handles.listbox2,'String',section);
  707. axes(handles.mapaxes);
  708. pretty=get(handles.colmap,'String');
  709. jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  710. jetcolormap(1,:) = [1, 1, 1];
  711. colormap(jetcolormap);
  712. delete(wb);
  713. if schoice == 2 || schoice == 3
  714. handles.averages=wholav;
  715. end
  716. set(handles.pushprocess,'Enable','on')
  717. set(handles.producemaps,'Enable','on')
  718. guidata(hObject, handles);
  719. % --- Executes on selection change in listbox2.
  720. function listbox2_Callback(hObject, eventdata, ~)
  721. handles = guidata(hObject);
  722. axes(handles.axes2)
  723. %handles.filming = 0;
  724. exposure=1/str2double(get(handles.framerate,'String'));
  725. handles.averagestime=(0:1:(length(handles.averages(1,:))-1))*exposure;
  726. plot(handles.averagestime, handles.averages,'k'),
  727. xlabel('time (ms) \rightarrow');
  728. ylabel('Fluorescence Intensity');
  729. xlim([0 length(handles.averages)*exposure]);
  730. hold on
  731. plot(handles.averagestime(handles.locs),handles.averages(handles.locs), 'or');
  732. before=round(str2double(get(handles.beforeGUI,'String'))/exposure);
  733. after=round(str2double(get(handles.afterGUI,'String'))/exposure);
  734. section_choice=get(handles.listbox2,'Value');
  735. A=(handles.q2locs(section_choice,:));
  736. if isempty(A) == 1
  737. errordlg('No constant cycle length regions found. Please adjust pre-process settings')
  738. end
  739. if min(A(A>0)) < before %if first peak v.close to beginning it is ignored to stop dim error
  740. k = find(A);
  741. A(k(1))=0;
  742. end
  743. tstart=min(A(A>0))-before;
  744. if tstart == 0
  745. tstart = 1;
  746. end
  747. tend=max(A)+after;
  748. if tend > length(handles.averagestime)
  749. tend = length(handles.averagestime);
  750. end
  751. plot(handles.averagestime(tstart:tend),handles.averages(tstart:tend),'color','r');
  752. ax=gca;
  753. line(get(ax,'XLim'),[handles.peakheight handles.peakheight],'Color','b')
  754. set(gca,'FontSize',8);
  755. producemaps_Callback(hObject, eventdata, handles)
  756. % --- Executes during object creation, after setting all properties.
  757. function listbox2_CreateFcn(hObject, ~, ~)
  758. % hObject handle to listbox2 (see GCBO)
  759. % eventdata reserved - to be defined in a future version of MATLAB
  760. % handles empty - handles not created until after all CreateFcns called
  761. % Hint: listbox controls usually have a white background on Windows.
  762. % See ISPC and COMPUTER.
  763. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  764. set(hObject,'BackgroundColor','white');
  765. end
  766. % --- Executes on selection change in tfilt.
  767. function segchoice_Callback(~, ~, ~)
  768. % --- Executes during object creation, after setting all properties.
  769. function segchoice_CreateFcn(hObject, ~, ~)
  770. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  771. set(hObject,'BackgroundColor','white');
  772. end
  773. function segsize_Callback(~, ~, ~)
  774. % --- Executes during object creation, after setting all properties.
  775. function segsize_CreateFcn(hObject, ~, ~)
  776. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  777. set(hObject,'BackgroundColor','white');
  778. end
  779. % --- Executes on selection change in BLopt.
  780. function BLopt_Callback(~, ~, ~)
  781. % --- Executes during object creation, after setting all properties.
  782. function BLopt_CreateFcn(hObject, ~, ~)
  783. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  784. set(hObject,'BackgroundColor','white');
  785. end
  786. % --- Executes on selection change in tfilt.
  787. function tfilt_Callback(~, ~, ~)
  788. % --- Executes during object creation, after setting all properties.
  789. function tfilt_CreateFcn(hObject, ~, ~)
  790. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  791. set(hObject,'BackgroundColor','white');
  792. end
  793. function minpeak_Callback(~, ~, ~)
  794. % --- Executes during object creation, after setting all properties.
  795. function minpeak_CreateFcn(hObject, ~, ~)
  796. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  797. set(hObject,'BackgroundColor','white');
  798. end
  799. function minnum_Callback(~, ~, ~)
  800. % --- Executes during object creation, after setting all properties.
  801. function minnum_CreateFcn(hObject, ~, ~)
  802. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  803. set(hObject,'BackgroundColor','white');
  804. end
  805. function minbound_Callback(~, ~, ~)
  806. % --- Executes during object creation, after setting all properties.
  807. function minbound_CreateFcn(hObject, ~, ~)
  808. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  809. set(hObject,'BackgroundColor','white');
  810. end
  811. % --- Executes on button press in invertopt.
  812. function invertopt_Callback(~, ~, ~)
  813. % hObject handle to invertopt (see GCBO)
  814. % eventdata reserved - to be defined in a future version of MATLAB
  815. % handles structure with handles and user data (see GUIDATA)
  816. % Hint: get(hObject,'Value') returns toggle state of invertopt
  817. % --- Executes on selection change in sfilt.
  818. function sfilt_Callback(~, ~, ~)
  819. % --- Executes during object creation, after setting all properties.
  820. function sfilt_CreateFcn(hObject, ~, ~)
  821. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  822. set(hObject,'BackgroundColor','white');
  823. end
  824. function sfiltsize_Callback(~, ~, ~)
  825. % --- Executes during object creation, after setting all properties.
  826. function sfiltsize_CreateFcn(hObject, ~, ~)
  827. % hObject handle to sfiltsize (see GCBO)
  828. % eventdata reserved - to be defined in a future version of MATLAB
  829. % handles empty - handles not created until after all CreateFcns called
  830. % Hint: edit controls usually have a white background on Windows.
  831. % See ISPC and COMPUTER.
  832. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  833. set(hObject,'BackgroundColor','white');
  834. end
  835. % --- Executes on selection change in Mapchoice.
  836. function Mapchoice_Callback(hObject, ~, ~)
  837. % hObject handle to Mapchoice (see GCBO)
  838. % eventdata reserved - to be defined in a future version of MATLAB
  839. % handles structure with handles and user data (see GUIDATA)
  840. handles = guidata(hObject);
  841. choice=get(handles.Mapchoice,'Value');
  842. axes(handles.bgimage);
  843. if handles.bgon == 0
  844. imshow(handles.frame1,[],'InitialMagnification', 400)
  845. colormap('gray')
  846. freezeColors
  847. else
  848. cla reset
  849. axis off
  850. end
  851. [rows,cols]=size(handles.frame1)
  852. axes(handles.mapaxes);
  853. cla reset
  854. axis off
  855. drawnow()
  856. imshow(zeros(rows,cols))
  857. isochoice=get(handles.isoopt,'Value');
  858. CVmap=[];
  859. if choice == 10
  860. cla reset
  861. set(handles.meanchange,'String','');
  862. set(handles.textchange,'String','');
  863. [map,~,alll,~]=snrs(handles.averageBeat,handles.mask,handles.snrt1,handles.snrt2,(get(handles.tfilt,'Value')));
  864. if isempty(map) == 1
  865. map=0;
  866. alll=0;
  867. end
  868. dmap=map; %displau map. values altered so displyaed so bg=white etc. Display and expoterd stats NOT based on this map.
  869. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  870. colormap(jetcolormap);
  871. if get(handles.apdscale,'Value') == 1
  872. dmap(dmap==0)= NaN;
  873. him=imshow(dmap,[], 'InitialMagnification', 800);
  874. set(him, 'AlphaData', ~isnan(dmap))
  875. if handles.bgon == 1
  876. axis on
  877. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  878. end
  879. caxis([floor(min(min(alll))) ceil(max(max(alll)))])
  880. end
  881. if get(handles.apdscale,'Value') == 2
  882. dmap(dmap==0)=NaN;
  883. him=imshow(dmap,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  884. set(him, 'AlphaData', ~isnan(dmap))
  885. if handles.bgon == 1
  886. axis on
  887. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  888. end
  889. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  890. end
  891. title('SNR Map')
  892. freezeColors
  893. % colorbar
  894. axes(handles.cb);
  895. cla reset
  896. hcb=colorbar;
  897. pretty=get(handles.colmap,'String');
  898. colormap(colormap(pretty{get(handles.colmap,'Value')}));
  899. hcb.Location = 'southoutside';
  900. cpos = hcb.Position;
  901. cpos(4) = 4*cpos(4);
  902. hcb.Position = cpos;
  903. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  904. if get(handles.apdscale,'Value') == 1
  905. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  906. hcb.TickLabels=(floor(min(min(alll))):stepp:ceil(max(max(alll))));
  907. hcb.Ticks=[0.01,0.2:0.2:1];
  908. hcb.Label.String='Signal/Noise';
  909. axis off
  910. end
  911. if get(handles.apdscale,'Value') == 2
  912. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  913. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  914. hcb.Ticks=[0.01,0.2:0.2:1];
  915. hcb.Label.String='Signal/Noise';
  916. axis off
  917. end
  918. pos = get(hcb,'Position');
  919. hcb.Label.Position=[pos(1) pos(2)-1.2];
  920. stdall=std(alll);
  921. palll=prctile(alll,[5,50,95]);
  922. handles.rdata(4,1)=mean(alll);handles.rdata(4,2)=stdall;handles.rdata(4,3)=stdall/sqrt(numel(alll));handles.rdata(4,4)=stdall*stdall;handles.rdata(4,5)=((palll(3)-palll(1))/palll(2));
  923. rownames{1}='APD';rownames{2}='CV';rownames{3}='Amp';rownames{4}='SNR';
  924. axes(handles.mapaxes);
  925. set(handles.rtable,'RowName',rownames);
  926. set(handles.rtable,'data',handles.rdata);
  927. end
  928. if choice == 1
  929. cla reset
  930. set(handles.meanchange,'String','');
  931. set(handles.textchange,'String','');
  932. t=str2double(get(handles.t,'String'));
  933. map=handles.apdmap;
  934. alll=handles.apalll;
  935. if isempty(map) == 1
  936. map=0;
  937. alll=0;
  938. end
  939. dmap=map; %displau map. values altered so displyaed so bg=white etc. Display and expoterd stats NOT based on this map.
  940. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  941. colormap(jetcolormap);
  942. if get(handles.apdscale,'Value') == 1
  943. dmap(dmap==0)= NaN;
  944. him=imshow(dmap,[], 'InitialMagnification', 800);
  945. set(him, 'AlphaData', ~isnan(dmap))
  946. if handles.bgon == 1
  947. axis on
  948. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  949. end
  950. caxis([floor(min(min(alll))) ceil(max(max(alll)))])
  951. end
  952. if get(handles.apdscale,'Value') == 2
  953. dmap(dmap==0)=NaN;
  954. him=imshow(dmap,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  955. set(him, 'AlphaData', ~isnan(dmap))
  956. if handles.bgon == 1
  957. axis on
  958. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  959. end
  960. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  961. end
  962. freezeColors
  963. % colorbar
  964. axes(handles.cb);
  965. cla reset
  966. hcb=colorbar;
  967. pretty=get(handles.colmap,'String');
  968. colormap(colormap(pretty{get(handles.colmap,'Value')}));
  969. hcb.Location = 'southoutside';
  970. cpos = hcb.Position;
  971. cpos(4) = 4*cpos(4);
  972. hcb.Position = cpos;
  973. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  974. if get(handles.apdscale,'Value') == 1
  975. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  976. hcb.TickLabels=[floor(min(min(alll))):stepp:ceil(max(max(alll)))];
  977. hcb.Ticks=[0.01,0.2:0.2:1];
  978. hcb.Label.String='Duration (ms)';
  979. axis off
  980. end
  981. if get(handles.apdscale,'Value') == 2
  982. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  983. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  984. hcb.Ticks=[0.01,0.2:0.2:1];
  985. hcb.Label.String='Duration (ms)';
  986. axis off
  987. end
  988. pos = get(hcb,'Position');
  989. hcb.Label.Position=[pos(1) pos(2)-1.2];
  990. stdall=std(alll);
  991. palll=prctile(alll,[5,50,95]);
  992. handles.rdata(1,1)=mean(alll);handles.rdata(1,2)=stdall;handles.rdata(1,3)=stdall/sqrt(numel(alll));handles.rdata(1,4)=stdall*stdall;handles.rdata(1,5)=((palll(3)-palll(1))/palll(2));
  993. [~,~,allSNRr,allSNRdb]=snrs(handles.averageBeat,handles.mask,handles.snrt1,handles.snrt2,(get(handles.tfilt,'Value')));
  994. handles.rdata(4,1)=mean(allSNRr);handles.rdata(4,2)=mean(allSNRdb);
  995. rownames=get(handles.rtable,'RowName');
  996. rownames{4}='SNR';
  997. axes(handles.mapaxes);
  998. title(['APD', num2str(t)]);
  999. set(handles.rtable,'RowName',rownames);
  1000. set(handles.rtable,'data',handles.rdata);
  1001. end
  1002. if choice == 2
  1003. cla
  1004. set(handles.meanchange,'String','');
  1005. set(handles.textchange,'String','');
  1006. map=handles.actmap;
  1007. if isochoice == 1
  1008. mini=0;
  1009. maxi=max(max(map));
  1010. elseif isochoice == 2
  1011. mini=str2double(get(handles.isomin,'String'));
  1012. maxi=str2double(get(handles.isomax,'String'));
  1013. end
  1014. dmap=map;
  1015. dmap(dmap==0)= NaN;
  1016. him=imshow(dmap, [0 maxi], 'InitialMagnification', 800);
  1017. hold on
  1018. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1019. colormap(jetcolormap);
  1020. caxis([mini maxi]);
  1021. set(him, 'AlphaData', ~isnan(dmap))
  1022. if handles.bgon == 1
  1023. axis on
  1024. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1025. end
  1026. title('Activation Map');
  1027. freezeColors
  1028. %colorbar
  1029. axes(handles.cb);
  1030. cla reset
  1031. hcb=colorbar;
  1032. hcb.Location = 'southoutside';
  1033. cpos = hcb.Position;
  1034. cpos(4) = 4*cpos(4);
  1035. hcb.Position = cpos;
  1036. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1037. stepp=(maxi-mini)/5;
  1038. hcb.TickLabels=[mini:stepp:maxi];
  1039. hcb.Ticks=[0.01,0.2:0.2:1];
  1040. hcb.Label.String='Time of activation (ms)';
  1041. axis off
  1042. handles.rdata(4,1)=NaN;handles.rdata(4,2)=NaN;handles.rdata(4,3)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,5)=NaN;
  1043. rownames=get(handles.rtable,'RowName');
  1044. rownames{4}='';
  1045. set(handles.rtable,'RowName',rownames);
  1046. set(handles.meanchange,'String',rownames{4});
  1047. set(handles.rtable,'data',handles.rdata);
  1048. end
  1049. if choice == 3
  1050. cla
  1051. set(handles.meanchange,'String','');
  1052. set(handles.textchange,'String','');
  1053. map=handles.actmap;
  1054. quivers_X=handles.quivers_X;
  1055. quivers_Y=handles.quivers_Y;
  1056. quivers_vx=handles.quivers_vx;
  1057. quivers_vy=handles.quivers_vy;
  1058. if isochoice == 1
  1059. mini=0;
  1060. maxi=max(max(map));
  1061. elseif isochoice == 2
  1062. mini=str2double(get(handles.isomin,'String'));
  1063. maxi=str2double(get(handles.isomax,'String'));
  1064. end
  1065. dmap=map;
  1066. dmap(dmap==0)= NaN;
  1067. him=imshow(dmap, [0 maxi], 'InitialMagnification', 800);
  1068. hold on
  1069. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1070. colormap(jetcolormap);
  1071. caxis([mini maxi]);
  1072. set(him, 'AlphaData', ~isnan(dmap))
  1073. if handles.bgon == 1
  1074. axis on
  1075. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1076. end
  1077. scal = str2double(get(handles.scal,'String'));
  1078. hold on
  1079. quiver(quivers_X,quivers_Y,scal*quivers_vx,scal*quivers_vy,0,'k')
  1080. % Compile CV map
  1081. % factor=str2double(get(handles.pixelsize,'String'))/10;
  1082. % [rows,cols] = size(map);
  1083. % CVXmap=zeros(rows,cols);
  1084. % CVXmap(sub2ind(size(CVXmap),quivers_Y,quivers_X)) = quivers_vx;
  1085. % sCVXmap=CVXmap.*CVXmap;
  1086. % CVYmap=zeros(rows,cols);
  1087. % CVYmap(sub2ind(size(CVYmap),quivers_Y,quivers_X)) = quivers_vy;
  1088. % sCVYmap=CVYmap.*CVYmap;
  1089. % %construct cv map
  1090. % CVmap=sqrt(sCVXmap+sCVYmap);
  1091. % CVmap=CVmap*factor;
  1092. hold off
  1093. title('Activation Map');
  1094. freezeColors
  1095. %colorbar
  1096. axes(handles.cb);
  1097. cla reset
  1098. hcb=colorbar;
  1099. hcb.Location = 'southoutside';
  1100. cpos = hcb.Position;
  1101. cpos(4) = 4*cpos(4);
  1102. hcb.Position = cpos;
  1103. hcb.TicksMode='manual'; hcb.TickLabelsMode='manual';
  1104. stepp=(maxi-mini)/5;
  1105. hcb.TickLabels=[mini:stepp:maxi];
  1106. hcb.Ticks=[0.01,0.2:0.2:1];
  1107. hcb.Label.String='Time of activation (ms)';
  1108. axis off
  1109. handles.rdata(4,1)=NaN;handles.rdata(4,2)=NaN;handles.rdata(4,3)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,5)=NaN;
  1110. rownames=get(handles.rtable,'RowName');
  1111. rownames{4}='';
  1112. set(handles.rtable,'RowName',rownames);
  1113. set(handles.meanchange,'String',rownames{4});
  1114. set(handles.rtable,'data',handles.rdata);
  1115. map=CVmap;
  1116. end
  1117. if choice == 4
  1118. cla
  1119. set(handles.meanchange,'String','');
  1120. set(handles.textchange,'String','');
  1121. map=handles.actmap;
  1122. quivers_Xout=handles.quivers_Xout;
  1123. quivers_Yout=handles.quivers_Yout;
  1124. quivers_vxout=handles.quivers_vxout;
  1125. quivers_vyout=handles.quivers_vyout;
  1126. if isochoice == 1
  1127. mini=0;
  1128. maxi=max(max(map));
  1129. elseif isochoice == 2
  1130. mini=str2double(get(handles.isomin,'String'));
  1131. maxi=str2double(get(handles.isomax,'String'));
  1132. end
  1133. axes(handles.mapaxes)
  1134. dmap=map;
  1135. dmap(dmap==0)= NaN;
  1136. him=imshow(dmap, [0 maxi], 'InitialMagnification', 800);
  1137. hold on
  1138. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1139. colormap(jetcolormap);
  1140. caxis([mini maxi]);
  1141. set(him, 'AlphaData', ~isnan(dmap))
  1142. if handles.bgon == 1
  1143. axis on
  1144. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1145. end
  1146. scal = str2double(get(handles.scal,'String'));
  1147. hold on
  1148. quiver(quivers_Xout,quivers_Yout,scal*quivers_vxout,scal*quivers_vyout,0,'k')
  1149. hold off
  1150. % Compile CV map
  1151. % factor=str2double(get(handles.pixelsize,'String'))/10;
  1152. % [rows cols] = size(map);
  1153. % CVmap=zeros(rows,cols);
  1154. % CVXmap=zeros(rows,cols);
  1155. % CVXmap(sub2ind(size(CVXmap),quivers_Yout,quivers_Xout)) = quivers_vxout;
  1156. % sCVXmap=CVXmap.*CVXmap;
  1157. % CVYmap=zeros(rows,cols);
  1158. % CVYmap(sub2ind(size(CVYmap),quivers_Yout,quivers_Xout)) = quivers_vyout;
  1159. % sCVYmap=CVYmap.*CVYmap;
  1160. % %construct cv map
  1161. % CVmap=sqrt(sCVXmap+sCVYmap);
  1162. % CVmap=CVmap*factor;
  1163. title('Activation Map');
  1164. freezeColors
  1165. axes(handles.cb);
  1166. cla reset
  1167. hcb=colorbar;
  1168. hcb.Location = 'southoutside';
  1169. cpos = hcb.Position;
  1170. cpos(4) = 4*cpos(4);
  1171. hcb.Position = cpos;
  1172. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1173. stepp=(maxi-mini)/5;
  1174. hcb.TickLabels=[mini:stepp:maxi];
  1175. hcb.Ticks=[0.01,0.2:0.2:1];
  1176. hcb.Label.String='Time of activation (ms)';
  1177. axis off
  1178. handles.rdata(4,1)=NaN;handles.rdata(4,2)=NaN;handles.rdata(4,3)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,5)=NaN;
  1179. rownames=get(handles.rtable,'RowName');
  1180. rownames{4}='';
  1181. set(handles.rtable,'RowName',rownames);
  1182. set(handles.meanchange,'String',rownames{4});
  1183. set(handles.rtable,'data',handles.rdata);
  1184. map=CVmap;
  1185. end
  1186. if choice == 5
  1187. cla
  1188. axes(handles.mapaxes);
  1189. axis off
  1190. %wb=waitbar(0.9,'Calculating Frequencies');
  1191. tic
  1192. [map]=domfreq(handles.mask,handles.imagerange,str2double(get(handles.framerate,'String')),handles.fmin,handles.fmax,handles.fbin,handles.dfwin,get(handles.tfilt,'Value'));
  1193. toc
  1194. dfs=map(map>0);
  1195. dmap=map;
  1196. if get(handles.apdscale,'Value') == 1
  1197. dmap(dmap==0)= NaN;
  1198. him=imshow(dmap,[min(min(dfs)) max(max(dfs))], 'InitialMagnification', 800);
  1199. set(him, 'AlphaData', ~isnan(dmap))
  1200. if handles.bgon == 1
  1201. axis on
  1202. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1203. end
  1204. caxis([floor(min(min(dfs))) ceil(max(max(dfs)))])
  1205. title('Dominant Frequency Map')
  1206. axes(handles.cb);
  1207. cla reset
  1208. hcb=colorbar;
  1209. hcb.Location = 'southoutside';
  1210. cpos = hcb.Position;
  1211. cpos(4) = 4*cpos(4);
  1212. hcb.Position = cpos;
  1213. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1214. hcb.TickLabels=[min(min(dfs)) max(max(dfs))];
  1215. hcb.Ticks=[0 1];
  1216. hcb.Label.String='Dominant Frequency (Hz)';
  1217. end
  1218. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1219. colormap(jetcolormap);
  1220. if get(handles.apdscale,'Value') == 2
  1221. dmap(dmap==0)= NaN;
  1222. him=imshow(dmap,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  1223. set(him, 'AlphaData', ~isnan(dmap))
  1224. if handles.bgon == 1
  1225. axis on
  1226. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1227. end
  1228. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  1229. axes(handles.cb);
  1230. cla reset
  1231. hcb=colorbar;
  1232. hcb.Location = 'southoutside';
  1233. cpos = hcb.Position;
  1234. cpos(4) = 4*cpos(4);
  1235. hcb.Position = cpos;
  1236. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1237. hcb.TickLabels=[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))];
  1238. hcb.Ticks=[0 1];
  1239. hcb.Label.String='Dominant Frequency (Hz)';
  1240. end
  1241. freezeColors
  1242. axis off
  1243. dfs=map(map>0);
  1244. dfsp=prctile(dfs,[5,50,95]);
  1245. handles.rdata(4,1)=mean(dfs);handles.rdata(4,2)=std(dfs);handles.rdata(4,3)=std(dfs)/numel(dfs);handles.rdata(4,4)=std(dfs)*std(dfs);handles.rdata(4,4)=std(dfs)*std(dfs);handles.rdata(4,5)=((dfsp(3)-dfsp(1))/dfsp(2));
  1246. rownames=get(handles.rtable,'RowName');
  1247. rownames{4}='DF';
  1248. set(handles.rtable,'RowName',rownames);
  1249. set(handles.rtable,'data',handles.rdata);
  1250. end
  1251. if choice == 6
  1252. wb=waitbar(0.5,'Producing Diastolic Map');
  1253. section_choice=get(handles.listbox2,'Value');
  1254. A=handles.q2locs(section_choice,:);
  1255. A=A(A~=0);
  1256. frame_1=A(1);
  1257. frame_last=A(end);
  1258. exposure = 1/str2double(get(handles.framerate,'String'));
  1259. after=str2double(get(handles.afterGUI,'String'));
  1260. after=round(after/exposure);
  1261. if frame_last+after>handles.num_images
  1262. frame_last=A(end-1);
  1263. end
  1264. [map,~,alll]=DInt(str2double(get(handles.framerate,'String')),handles.I,handles.images,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.afterGUI,'String')),str2double(get(handles.minpeak,'String')),frame_1,frame_last,str2double(get(handles.t,'String')));
  1265. if isempty(alll) == 1
  1266. map=0;
  1267. alll=0;
  1268. end
  1269. numel(alll)
  1270. map(isnan(map)) = 0;
  1271. axes(handles.mapaxes);
  1272. imshow(map,[], 'InitialMagnification', 800);
  1273. title(['Diastolic Interval Distribution']);
  1274. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1275. jetcolormap(1,:) = [1, 1, 1];
  1276. colormap(jetcolormap);
  1277. if get(handles.apdscale,'Value') == 1
  1278. caxis([floor(min(min(alll))) ceil(max(max(alll)))])
  1279. end
  1280. if get(handles.apdscale,'Value') == 2
  1281. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  1282. end
  1283. freezeColors
  1284. % colorbar
  1285. axes(handles.cb);
  1286. cla reset
  1287. hcb=colorbar;
  1288. hcb.Location = 'southoutside';
  1289. cpos = hcb.Position;
  1290. cpos(4) = 4*cpos(4);
  1291. hcb.Position = cpos;
  1292. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1293. if get(handles.apdscale,'Value') == 1
  1294. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  1295. hcb.TickLabels=(floor(min(min(alll))):stepp:ceil(max(max(alll))));
  1296. hcb.Ticks=[0.01,0.2:0.2:1];
  1297. hcb.Label.String='Diastolic Interval (ms)';
  1298. axis off
  1299. end
  1300. if get(handles.apdscale,'Value') == 2
  1301. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1302. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1303. hcb.Ticks=[0.01,0.2:0.2:1];
  1304. hcb.Label.String='Diastolic Interval (ms)';
  1305. axis off
  1306. end
  1307. dis=alll;
  1308. disper=prctile(dis,[5,50,95]);
  1309. handles.rdata(4,1)=mean(dis);handles.rdata(4,2)=std(dis);handles.rdata(4,3)=std(dis)/numel(dis);handles.rdata(4,4)=std(dis)*std(dis);handles.rdata(4,4)=std(dis)*std(dis);handles.rdata(4,5)=((disper(3)-disper(1))/disper(2));
  1310. rownames=get(handles.rtable,'RowName');
  1311. rownames{4}='DI';
  1312. set(handles.rtable,'RowName',rownames);
  1313. set(handles.rtable,'data',handles.rdata);
  1314. delete(wb)
  1315. end
  1316. if choice == 7
  1317. cla
  1318. t=str2double(get(handles.t,'String'));
  1319. [map,~,alll]=ttpnew(handles.ttpstart,handles.ttpend,str2double(get(handles.framerate,'String')),t,handles.I,handles.images,handles.averageBeat,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.beforeGUI,'String')),get(handles.apdbl,'Value'),str2double(get(handles.apdblnum,'String')));
  1320. dmap=map;
  1321. title('TTP');
  1322. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1323. colormap(jetcolormap);
  1324. dmap(dmap==0)= NaN;
  1325. if get(handles.apdscale,'Value') == 1
  1326. dmap(dmap==0)= NaN;
  1327. him=imshow(dmap,[], 'InitialMagnification', 800);
  1328. set(him, 'AlphaData', ~isnan(dmap))
  1329. if handles.bgon == 1
  1330. axis on
  1331. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1332. end
  1333. caxis([floor(min(min(alll))) ceil(max(max(alll)))])
  1334. end
  1335. if get(handles.apdscale,'Value') == 2
  1336. dmap(dmap==0)=NaN;
  1337. him=imshow(dmap,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  1338. set(him, 'AlphaData', ~isnan(dmap))
  1339. if handles.bgon == 1
  1340. axis on
  1341. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1342. end
  1343. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  1344. end
  1345. title('Time to peak Map');
  1346. freezeColors
  1347. % colorbar
  1348. axes(handles.cb);
  1349. cla reset
  1350. hcb=colorbar;
  1351. hcb.Location = 'southoutside';
  1352. cpos = hcb.Position;
  1353. cpos(4) = 4*cpos(4);
  1354. hcb.Position = cpos;
  1355. hcb.TicksMode='manual';hcb.TickLabelsMode='manual';
  1356. if get(handles.apdscale,'Value') == 1
  1357. max(max(alll))
  1358. min(min(alll))
  1359. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  1360. hcb.TickLabels=[floor(min(min(alll))):stepp:ceil(max(max(alll)))];
  1361. hcb.Ticks=[0.01,0.2:0.2:1];
  1362. hcb.Label.String='Duration (ms)';
  1363. axis off
  1364. end
  1365. if get(handles.apdscale,'Value') == 2
  1366. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1367. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1368. hcb.Ticks=[0.01,0.2:0.2:1];
  1369. hcb.Label.String='Time to Peak (ms)';
  1370. axis off
  1371. end
  1372. ttps=alll;
  1373. ttpsp=prctile(ttps,[5,50,95]);
  1374. handles.rdata(4,1)=mean(ttps);handles.rdata(4,2)=std(ttps);handles.rdata(4,3)=std(ttps)/numel(ttps);handles.rdata(4,4)=std(ttps)*std(ttps);handles.rdata(4,4)=std(ttps)*std(ttps);handles.rdata(4,5)=((ttpsp(3)-ttpsp(1))/ttpsp(2));
  1375. rownames=get(handles.rtable,'RowName');
  1376. rownames{4}='TTP';
  1377. set(handles.rtable,'RowName',rownames);
  1378. set(handles.rtable,'data',handles.rdata);
  1379. end
  1380. if choice == 8
  1381. cla
  1382. wb=waitbar(0.5,'Producing tau map');
  1383. [map,~,alll,~,~,~,~]=tautest3(str2double(get(handles.taustart,'String')),str2double(get(handles.taufinish,'String')),str2double(get(handles.framerate,'String')),handles.I,handles.images,handles.averageBeat,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.r2cut,'String')));
  1384. map(isnan(map)) = 0;
  1385. cla
  1386. axes(handles.mapaxes);
  1387. imshow(map,[], 'InitialMagnification', 800);
  1388. title('Relaxation Constant Map');
  1389. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1390. jetcolormap(1,:) = [1, 1, 1];
  1391. colormap(jetcolormap);
  1392. if get(handles.apdscale,'Value') == 1
  1393. caxis([floor(min(min(alll))) ceil(max(max(alll)))])
  1394. end
  1395. if get(handles.apdscale,'Value') == 2
  1396. caxis([str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))])
  1397. end
  1398. freezeColors
  1399. % colorbar
  1400. axes(handles.cb);
  1401. cla reset
  1402. hcb=colorbar;
  1403. hcb.Location = 'southoutside';
  1404. cpos = hcb.Position;
  1405. cpos(4) = 4*cpos(4);
  1406. hcb.Position = cpos;
  1407. if get(handles.apdscale,'Value') == 1
  1408. max(max(alll));
  1409. min(min(alll));
  1410. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  1411. hcb.TickLabels=[floor(min(min(alll))):stepp:ceil(max(max(alll)))];
  1412. hcb.Ticks=[0.01,0.2:0.2:1];
  1413. hcb.Label.String='Relaxation Constant (ms)';
  1414. axis off
  1415. end
  1416. if get(handles.apdscale,'Value') == 2
  1417. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1418. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1419. hcb.Ticks=[0.01,0.2:0.2:1];
  1420. hcb.Label.String='Relaxation Constant (ms)';
  1421. axis off
  1422. end
  1423. delete(wb)
  1424. taus=alll;
  1425. tausp=prctile(taus,[5,50,95]);
  1426. handles.rdata(4,1)=mean(taus);handles.rdata(4,2)=std(taus);handles.rdata(4,3)=std(taus)/numel(taus);handles.rdata(4,4)=std(taus)*std(taus);handles.rdata(4,4)=std(taus)*std(taus);handles.rdata(4,5)=((tausp(3)-tausp(1))/tausp(2));
  1427. rownames=get(handles.rtable,'RowName');
  1428. rownames{4}='Tau';
  1429. set(handles.rtable,'RowName',rownames);
  1430. set(handles.rtable,'data',handles.rdata);
  1431. end
  1432. if choice == 9
  1433. [map]=fluo_map(str2double(get(handles.framerate,'String')),handles.I,handles.images,get(handles.tfilt,'Value'),handles.averageBeat);
  1434. map(isnan(map)) = 0;
  1435. alll=map(map>0);
  1436. cla
  1437. axes(handles.mapaxes)
  1438. if get(handles.apdscale,'Value') == 1
  1439. imshow(map,[floor(min(min(alll))) ceil(max(max(alll)))], 'InitialMagnification', 800);
  1440. end
  1441. if get(handles.apdscale,'Value') == 2
  1442. imshow(map,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  1443. end
  1444. title('Amplitude Map');
  1445. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1446. jetcolormap(1,:) = [1, 1, 1];
  1447. colormap(jetcolormap);
  1448. freezeColors
  1449. % colorbar
  1450. axes(handles.cb);
  1451. cla reset
  1452. hcb=colorbar;
  1453. hcb.Location = 'southoutside';
  1454. cpos = hcb.Position;
  1455. cpos(4) = 4*cpos(4);
  1456. hcb.Position = cpos;
  1457. if get(handles.apdscale,'Value') == 1
  1458. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  1459. hcb.TickLabels=[floor(min(min(alll))):stepp:ceil(max(max(alll)))];
  1460. hcb.Ticks=[0.01,0.2:0.2:1];
  1461. hcb.Label.String='Relaxation Constant (ms)';
  1462. axis off
  1463. end
  1464. if get(handles.apdscale,'Value') == 2
  1465. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1466. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1467. hcb.Ticks=[0.01,0.2:0.2:1];
  1468. hcb.Label.String='Relaxation Constant (ms)';
  1469. axis off
  1470. end
  1471. hcb.Label.String='Signal Level';
  1472. axis off
  1473. handles.rdata(4,1)=NaN;handles.rdata(4,2)=NaN;handles.rdata(4,3)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,5)=NaN;
  1474. rownames=get(handles.rtable,'RowName');
  1475. rownames{4}='';
  1476. set(handles.meanchange,'String',rownames{4});
  1477. set(handles.rtable,'data',handles.rdata);
  1478. end
  1479. if choice == 11
  1480. tic
  1481. beforeframes = str2num(get(handles.beforeGUI,'String'))*str2num(get(handles.framerate,'String'));
  1482. sdsd=handles.wsmat;
  1483. [dmap]=wavesim(handles.wsmat,handles.mask,handles.ep,beforeframes);
  1484. %[dmap]=wavesim(handles.wsmat,handles.mask,ep(i),beforeframes);
  1485. toc
  1486. alll=dmap(dmap>0);
  1487. dmap(isnan(dmap)) = 0;
  1488. cla
  1489. axes(handles.mapaxes)
  1490. if get(handles.apdscale,'Value') == 1
  1491. dmap(dmap==0)= NaN
  1492. x=handles.wsmat;
  1493. handles.ep
  1494. dmap=medfilt2(dmap);
  1495. him=imshow(dmap,[], 'InitialMagnification', 800);
  1496. set(him, 'AlphaData', ~isnan(dmap))
  1497. if handles.bgon == 1
  1498. axis on
  1499. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1500. end
  1501. if (min(min(min(alll)))-(max(max(alll)))) ~= 0
  1502. caxis([(min(min(alll))) (max(max(alll)))])
  1503. else
  1504. caxis([min(min(alll))-0.1 min(min(alll))+0.1])
  1505. end
  1506. end
  1507. if get(handles.apdscale,'Value') == 2
  1508. dmap(dmap==0)=NaN;
  1509. dmap=medfilt2(dmap);
  1510. him=imshow(dmap,[str2num(get(handles.cmin,'String')) str2num(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  1511. set(him, 'AlphaData', ~isnan(dmap))
  1512. if handles.bgon == 1
  1513. axis on
  1514. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1515. end
  1516. caxis([str2num(get(handles.cmin,'String')) str2num(get(handles.cmax,'String'))])
  1517. end
  1518. title('Wave Similarity Map');
  1519. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1520. %jetcolormap(1,:) = [1, 1, 1];
  1521. colormap(flipud(jetcolormap));
  1522. freezeColors
  1523. % colorbar
  1524. axes(handles.cb);
  1525. cla reset
  1526. hcb=colorbar;
  1527. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1528. colormap(flipud(jetcolormap));
  1529. hcb.Location = 'southoutside';
  1530. ax = gca;
  1531. cpos = hcb.Position;
  1532. cpos(4) = 4*cpos(4);
  1533. hcb.Position = cpos;
  1534. if get(handles.apdscale,'Value') == 1
  1535. stepp=((max(max(alll)))-(min(min(alll))))/5;
  1536. hcb.TickLabels=[(min(min(alll)))-1:stepp:(max(max(alll)))-1];
  1537. hcb.Ticks=[0.01,0.2:0.2:1];
  1538. if handles.ep == 0;
  1539. hcb.Label.String='Optical Wave Similarity';
  1540. else
  1541. hcb.Label.String='Regularity Index';
  1542. end
  1543. axis off
  1544. end
  1545. if get(handles.apdscale,'Value') == 2
  1546. stepp=(str2num(get(handles.cmax,'String'))-str2num(get(handles.cmin,'String')))/5;
  1547. hcb.TickLabels=[str2num(get(handles.cmin,'String')):stepp:str2num(get(handles.cmax,'String'))];
  1548. hcb.Ticks=[0.01,0.2:0.2:1];
  1549. hcb.Label.String='Wave Similarity AU';
  1550. axis off
  1551. end
  1552. axis off
  1553. handles.rdata(4,1)=NaN;handles.rdata(4,2)=NaN;handles.rdata(4,3)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,4)=NaN;handles.rdata(4,5)=NaN;
  1554. rownames=get(handles.rtable,'RowName');
  1555. rownames{4}='';
  1556. set(handles.meanchange,'String',rownames{4});
  1557. set(handles.rtable,'data',handles.rdata);
  1558. map=dmap-1;
  1559. alll=map(map>-0.1); % return to actual map to get results
  1560. palll=prctile(alll,[5,50,95]);
  1561. handles.rdata(4,1)=mean(alll);handles.rdata(4,2)=std(alll);handles.rdata(4,3)=std(alll)/sqrt(numel(alll));handles.rdata(4,4)=std(alll)^2;handles.rdata(4,5)=((palll(3)-palll(1))/palll(2));
  1562. handles.wsm(1)=mean(alll);handles.wsm(2)=std(alll);handles.wsm(3)=std(alll)/sqrt(numel(alll));handles.wsm(4)=std(alll)^2;handles.wsm(5)=((palll(3)-palll(1))/palll(2));
  1563. guidata(hObject, handles);
  1564. if exist('handles.wscount') == 0
  1565. handles.wscount=1
  1566. end
  1567. xx1=get(handles.listbox2,'Value');
  1568. assignin('base',['WS_',num2str(xx1)],handles.wsm)
  1569. rownames=get(handles.rtable,'RowName');
  1570. if handles.ep == 0;
  1571. rownames{4}='OWS';
  1572. else
  1573. rownames{4}='RI';
  1574. end
  1575. guidata(hObject, handles);
  1576. set(handles.meanchange,'String',rownames{4});
  1577. set(handles.rtable,'data',handles.rdata);
  1578. set(handles.rtable,'RowName',rownames);
  1579. end
  1580. if choice == 12
  1581. cla reset
  1582. map=dFmap(handles.averageBeat,handles.mask,handles.dFlevel,str2double(get(handles.framerate,'String')),handles.i_framerate,get(handles.tfilt,'Value'),get(handles.invertopt,'Value'),0.55,0.45);
  1583. dmap=map;
  1584. alll=map(map>0);
  1585. alll=reshape(alll,1,numel(alll));
  1586. cla
  1587. axes(handles.mapaxes);
  1588. imshow(dmap,[], 'InitialMagnification', 800);
  1589. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1590. colormap(jetcolormap);
  1591. if get(handles.apdscale,'Value') == 1
  1592. dmap(dmap==0)= NaN;
  1593. him=imshow(dmap,[], 'InitialMagnification', 800);
  1594. set(him, 'AlphaData', ~isnan(dmap))
  1595. if handles.bgon == 1
  1596. axis on
  1597. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1598. end
  1599. caxis([(min(min(alll))) (max(max(alll)))])
  1600. end
  1601. if get(handles.apdscale,'Value') == 2
  1602. dmap(dmap==0)= NaN;
  1603. him=imshow(dmap,[str2double(get(handles.cmin,'String')) str2double(get(handles.cmax,'String'))], 'InitialMagnification', 800);
  1604. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1605. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1606. hcb.Ticks=[0.01,0.2:0.2:1];
  1607. hcb.Label.String='Relaxation Constant (ms)';
  1608. axis off
  1609. set(him, 'AlphaData', ~isnan(dmap))
  1610. if handles.bgon == 1
  1611. axis on
  1612. set(gca, 'XColor', 'none', 'yColor', 'none', 'xtick', [], 'ytick', [], 'Color', handles.bgcol)
  1613. end
  1614. end
  1615. if handles.dFlevel > 0
  1616. title(['dFdt ',num2str(handles.dFlevel), ' Map']);
  1617. else
  1618. title(['dFdt max Map']);
  1619. end
  1620. freezeColors
  1621. % colorbar
  1622. axes(handles.cb);
  1623. cla reset
  1624. hcb=colorbar;
  1625. hcb.Location = 'southoutside';
  1626. cpos = hcb.Position;
  1627. cpos(4) = 4*cpos(4);
  1628. hcb.Position = cpos;
  1629. if get(handles.apdscale,'Value') == 1
  1630. max(max(alll))
  1631. min(min(alll))
  1632. stepp=(ceil(max(max(alll)))-floor(min(min(alll))))/5;
  1633. hcb.TickLabels=[(min(min(alll))):stepp:(max(max(alll)))];
  1634. hcb.Ticks=[0.01,0.2:0.2:1];
  1635. hcb.Label.String='dFdt';
  1636. axis off
  1637. end
  1638. if get(handles.apdscale,'Value') == 2
  1639. stepp=(str2double(get(handles.cmax,'String'))-str2double(get(handles.cmin,'String')))/5;
  1640. hcb.TickLabels=[str2double(get(handles.cmin,'String')):stepp:str2double(get(handles.cmax,'String'))];
  1641. hcb.Ticks=[0.01,0.2:0.2:1];
  1642. hcb.Label.String='dFdt';
  1643. axis off
  1644. end
  1645. taus=alll;
  1646. tausp=prctile(taus,[5,50,95]);
  1647. handles.rdata(4,1)=mean(taus);handles.rdata(4,2)=std(taus);handles.rdata(4,3)=std(taus)/numel(taus);handles.rdata(4,4)=std(taus)*std(taus);handles.rdata(4,4)=std(taus)*std(taus);handles.rdata(4,5)=((tausp(3)-tausp(1))/tausp(2));
  1648. rownames=get(handles.rtable,'RowName');
  1649. rownames{4}='dFdt';
  1650. set(handles.rtable,'RowName',rownames);
  1651. set(handles.rtable,'data',handles.rdata);
  1652. end
  1653. % Draw Contours
  1654. drawcon = handles.drawcon;
  1655. if drawcon == 1
  1656. axes(handles.mapaxes);
  1657. hold on
  1658. for j = 0:str2double(handles.conbon):max(max(map))+str2double(handles.conbon)
  1659. mapmask=(map<=j);
  1660. A=map.*mapmask;
  1661. [cons]=bwboundaries(A);
  1662. for i=1:size(cons,1)
  1663. plot(cons{i}(:,2),cons{i}(:,1),'k','LineWidth',1);
  1664. end
  1665. end
  1666. end
  1667. % handles.mask=handles.hold_mask; %keep and reinsate overall mask at end
  1668. handles.holdmap=map;
  1669. handles.holdcvmap=CVmap;
  1670. drawnow()
  1671. guidata(hObject, handles);
  1672. drawnow()
  1673. % Hints: contents = cellstr(get(hObject,'String')) returns apdvaluechoice contents as cell array
  1674. % contents{get(hObject,'Value')} returns selected item from apdvaluechoice
  1675. % --- Executes during object creation, after setting all properties.
  1676. function Mapchoice_CreateFcn(hObject, ~, ~)
  1677. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1678. set(hObject,'BackgroundColor','white');
  1679. end
  1680. % --- Executes on selection change in mapoptions.
  1681. function mapoptions_Callback(~, ~, ~)
  1682. % hObject handle to mapoptions (see GCBO)
  1683. % eventdata reserved - to be defined in a future version of MATLAB
  1684. % handles structure with handles and user data (see GUIDATA)
  1685. % Hints: contents = cellstr(get(hObject,'String')) returns mapoptions contents as cell array
  1686. % contents{get(hObject,'Value')} returns selected item from mapoptions
  1687. % --- Executes during object creation, after setting all properties.
  1688. function mapoptions_CreateFcn(hObject, ~, ~)
  1689. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1690. set(hObject,'BackgroundColor','white');
  1691. end
  1692. % --- Executes on button press in ExportMap.
  1693. function ExportMap_Callback(~, ~, handles)
  1694. GUI_fig_children=get(gcf,'children');
  1695. Fig_Axes=findobj(GUI_fig_children,'type','Axes');
  1696. fig=figure;ax=axes;clf;
  1697. new_handle=copyobj(handles.mapaxes,fig);
  1698. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  1699. jetcolormap(1,:) = [1, 1, 1];
  1700. colormap(jetcolormap);
  1701. set(gca,'ActivePositionProperty','outerposition')
  1702. set(gca,'Units','normalized')
  1703. set(gca,'OuterPosition',[0 0 1 1])
  1704. set(gca,'position',[0.1300 0.1100 0.7750 0.8150])
  1705. % --- Executes on button press in actpoints.
  1706. function actpoints_Callback(hObject, ~, ~)
  1707. % hObject handle to actpoints (see GCBO)
  1708. % eventdata reserved - to be defined in a future version of MATLAB
  1709. % handles structure with handles and user data (see GUIDATA)
  1710. handles = guidata(hObject);
  1711. if get(handles.actfittimes,'Value') == 1
  1712. [~,act_x,act_y,act_t,~,~,~,~,~,~,~,~,~, ~,~,~,~,~] =...
  1713. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1714. 0,100,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1715. end
  1716. if get(handles.actfittimes,'Value') == 2
  1717. [~,act_x,act_y,act_t,~,~,~,~,~,~,~,~, ~,~,~,~,~] =...
  1718. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1719. str2double(get(handles.MINt,'String')),str2double(get(handles.MAXt,'String')),str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1720. end
  1721. figure, hold on
  1722. plot3(act_x,act_y,act_t,'.k')
  1723. title('activation points');
  1724. zlabel('time (ms)', 'FontSize', 20);
  1725. xlabel('x', 'FontSize', 20);
  1726. ylabel('y', 'FontSize', 20);
  1727. zlim([0 15])
  1728. hold off
  1729. % --- Executes on button press in velhist.
  1730. function velhist_Callback(hObject, ~, ~)
  1731. % hObject handle to velhist (see GCBO)
  1732. % eventdata reserved - to be defined in a future version of MATLAB
  1733. % handles structure with handles and user data (see GUIDATA)
  1734. handles = guidata(hObject);
  1735. if get(handles.actfittimes,'Value') == 1
  1736. [~,~,~,~,~,~,~,~,~,~,vout,~,~,~,~,~,~,~] =...
  1737. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1738. 0,100,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1739. end
  1740. if get(handles.actfittimes,'Value') == 2
  1741. [~,~,~,~,~,~,~,~,~,~,vout,~,~,~,~,~,~,~] =...
  1742. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1743. str2double(get(handles.MINt,'String')),str2double(get(handles.MAXt,'String')),str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1744. end
  1745. figure, histogram(vout,str2double(get(handles.binnumber,'String')));
  1746. hold on
  1747. %line([mean(vout) mean(vout)],[0 300],'Color','r','Linewidth',3)
  1748. xlabel('Conduction Velocity (cm/s)')
  1749. ylabel('Number of Pixels')
  1750. hold off
  1751. % --- Executes on button press in APDdist.
  1752. function APDdist_Callback(hObject, ~, ~)
  1753. % hObject handle to APDdist (see GCBO)
  1754. % eventdata reserved - to be defined in a future version of MATLAB
  1755. % handles structure with handles and user data (see GUIDATA)
  1756. handles = guidata(hObject);
  1757. alll=handles.apalll;
  1758. figure, histogram(alll,str2double(get(handles.binnumber,'String')));
  1759. hold on
  1760. xlabel('Action Potential Duration (ms)')
  1761. ylabel('Number of Pixels')
  1762. hold off
  1763. % --- Executes on selection change in apdout.
  1764. function apdout_Callback(hObject, eventdata, ~)
  1765. % hObject handle to apdout (see GCBO)
  1766. % eventdata reserved - to be defined in a future version of MATLAB
  1767. % handles structure with handles and user data (see GUIDATA)
  1768. handles = guidata(hObject);
  1769. Mapchoice_Callback(hObject, eventdata, handles)
  1770. % --- Executes during object creation, after setting all properties.
  1771. function apdout_CreateFcn(hObject, ~, ~)
  1772. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1773. set(hObject,'BackgroundColor','white');
  1774. end
  1775. function cmin_Callback(hObject, eventdata, handles)
  1776. % --- Executes during object creation, after setting all properties.
  1777. function cmin_CreateFcn(hObject, eventdata, handles)
  1778. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1779. set(hObject,'BackgroundColor','white');
  1780. end
  1781. function cmax_Callback(hObject, eventdata, handles)
  1782. % --- Executes during object creation, after setting all properties.
  1783. function cmax_CreateFcn(hObject, eventdata, handles)
  1784. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1785. set(hObject,'BackgroundColor','white');
  1786. end
  1787. % --- Executes on selection change in velout.
  1788. function velout_Callback(~, ~, handles)
  1789. % hObject handle to velout (see GCBO)
  1790. % eventdata reserved - to be defined in a future version of MATLAB
  1791. % handles structure with handles and user data (see GUIDATA)
  1792. if get(handles.velout, 'Value') == 9
  1793. set(handles.minvel,'String','0.2')
  1794. set(handles.maxvel,'String','0.8')
  1795. set(handles.text64,'String','(0-1)');
  1796. elseif get(handles.velout, 'Value') == 2
  1797. set(handles.minvel,'String','0')
  1798. set(handles.maxvel,'String','100')
  1799. set(handles.text64,'String','cm/s');
  1800. end
  1801. % Hints: contents = cellstr(get(hObject,'String')) returns velout contents as cell array
  1802. % contents{get(hObject,'Value')} returns selected item from velout
  1803. % --- Executes during object creation, after setting all properties.
  1804. function velout_CreateFcn(hObject, ~, ~)
  1805. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1806. set(hObject,'BackgroundColor','white');
  1807. end
  1808. function minvel_Callback(~, ~, ~)
  1809. % hObject handle to minvel (see GCBO)
  1810. % eventdata reserved - to be defined in a future version of MATLAB
  1811. % handles structure with handles and user data (see GUIDATA)
  1812. % Hints: get(hObject,'String') returns contents of minvel as text
  1813. % str2double(get(hObject,'String')) returns contents of minvel as a double
  1814. % --- Executes during object creation, after setting all properties.
  1815. function minvel_CreateFcn(hObject, ~, ~)
  1816. % hObject handle to minvel (see GCBO)
  1817. % eventdata reserved - to be defined in a future version of MATLAB
  1818. % handles empty - handles not created until after all CreateFcns called
  1819. % Hint: edit controls usually have a white background on Windows.
  1820. % See ISPC and COMPUTER.
  1821. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1822. set(hObject,'BackgroundColor','white');
  1823. end
  1824. function maxvel_Callback(~, ~, ~)
  1825. % hObject handle to maxvel (see GCBO)
  1826. % eventdata reserved - to be defined in a future version of MATLAB
  1827. % handles structure with handles and user data (see GUIDATA)
  1828. % Hints: get(hObject,'String') returns contents of maxvel as text
  1829. % str2double(get(hObject,'String')) returns contents of maxvel as a double
  1830. % --- Executes during object creation, after setting all properties.
  1831. function maxvel_CreateFcn(hObject, ~, ~)
  1832. % hObject handle to maxvel (see GCBO)
  1833. % eventdata reserved - to be defined in a future version of MATLAB
  1834. % handles empty - handles not created until after all CreateFcns called
  1835. % Hint: edit controls usually have a white background on Windows.
  1836. % See ISPC and COMPUTER.
  1837. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1838. set(hObject,'BackgroundColor','white');
  1839. end
  1840. % --- Executes on button press in pushrecal.
  1841. function pushrecal_Callback(hObject, eventdata, ~)
  1842. % hObject handle to pushrecal (see GCBO)
  1843. % eventdata reserved - to be defined in a future version of MATLAB
  1844. % handles structure with handles and user data (see GUIDATA)
  1845. handles = guidata(hObject);
  1846. contents = cellstr(get(handles.Mapchoice,'String'));
  1847. choice=get(handles.Mapchoice,'Value');
  1848. axes(handles.mapaxes);
  1849. handles.outlier=get(handles.apdout,'Value');
  1850. handles.outliervel=get(handles.velout,'Value');
  1851. wb=waitbar(0.4,'Calculating APD');
  1852. t=str2double(get(handles.t,'String'));
  1853. [apmap,meanapd,alll,onedev]=mapsbaby(get(handles.aptime1,'Value'),str2double(get(handles.framerate,'String')),t,handles.I,handles.images,handles.averageBeat,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.beforeGUI,'String')),get(handles.apdbl,'Value'),str2double(get(handles.apdblnum,'String')),handles.medifilt);
  1854. stdall=std(alll);
  1855. palll=prctile(alll,[5,50,95]);
  1856. handles.rdata(4,1)=mean(alll);handles.rdata(4,2)=stdall;handles.rdata(4,3)=stdall/sqrt(numel(alll));handles.rdata(4,4)=stdall*stdall;handles.rdata(4,5)=((palll(3)-palll(1))/palll(2));
  1857. waitbar(0.6,wb,'Calculating conduction velocity');
  1858. if get(handles.actfittimes,'Value') == 1
  1859. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevcv,varicv,SEcv] =...
  1860. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1861. 0,100,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1862. end
  1863. if get(handles.actfittimes,'Value') == 2
  1864. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevcv,varicv,SEcv] =...
  1865. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  1866. str2double(get(handles.MINt,'String')),str2double(get(handles.MAXt,'String')),str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  1867. end
  1868. %save AP,CV maps and vectors
  1869. handles.apdmap=apmap;
  1870. handles.apalll=alll;
  1871. handles.actmap=actmap;
  1872. handles.act_t=act_t;
  1873. handles.vout=vout;
  1874. handles.quivers_X=quivers_X;
  1875. handles.quivers_Y=quivers_Y;
  1876. handles.quivers_vx=quivers_vx;
  1877. handles.quivers_vy=quivers_vy;
  1878. handles.quivers_Xout=quivers_Xout;
  1879. handles.quivers_Yout=quivers_Yout;
  1880. handles.quivers_vxout=quivers_vxout;
  1881. handles.quivers_vyout=quivers_vyout;
  1882. %% update rtable
  1883. rdata=handles.rdata;
  1884. APp=prctile(alll,[5,50,95]);
  1885. CVp=prctile(vout,[5,50,95]);
  1886. handles.errCV=[onedevcv,SEcv,varicv,((CVp(3)-CVp(1))/CVp(2))];
  1887. guidata(hObject, handles);
  1888. rdata(1,1)=mean(alll);rdata(1,2)=handles.err(1);rdata(1,3)=handles.err(2);rdata(1,4)=handles.err(3);rdata(1,5)=handles.err(4);
  1889. rdata(2,1)=mean(vout);rdata(2,2)=handles.errCV(1);rdata(2,3)=handles.errCV(2);rdata(2,4)=handles.errCV(3);rdata(2,5)=handles.errCV(4);
  1890. handles.rdata=rdata;
  1891. set(handles.rtable,'data',handles.rdata);
  1892. %activation time
  1893. tim=act_t;
  1894. tim=tim-min(tim);
  1895. allpts=numel(tim);
  1896. xbins=0:0.01:max(tim);
  1897. tissueact=100*cumsum(hist(tim,xbins))/allpts;
  1898. actmax=str2double(get(handles.actmax,'String'));
  1899. actmin=str2double(get(handles.actmin,'String'));
  1900. Imax = find(tissueact > actmax);
  1901. Imin = find(tissueact > actmin);
  1902. if actmax < 100
  1903. Imax=Imax(1);
  1904. else Imax=max(tim);
  1905. end
  1906. Imin=Imin(1);
  1907. if actmax < 100
  1908. timmax=Imax*0.01;
  1909. else timmax=Imax
  1910. end
  1911. timmin=Imin*0.01;
  1912. timdiff=timmax-timmin;
  1913. if actmin == 0
  1914. timdiff=timmax;
  1915. end
  1916. if get(handles.checkbox8,'Value')==1
  1917. pixar=str2double(get(handles.pixelsize,'String'));
  1918. pixar=pixar*pixar;
  1919. pixar=pixar/1000000; %convert to mm2
  1920. normfac=pixar*allpts;
  1921. timdiff=timdiff/normfac;
  1922. end
  1923. set(handles.actquote, 'String', [num2str(timdiff),' ms']);
  1924. delete(wb)
  1925. %maps
  1926. Mapchoice_Callback(hObject, eventdata, handles)
  1927. % hold off
  1928. %scales the values to work with out camera frame rate and resolution
  1929. %factor = pix/exposure*100; % converts to cm/sec
  1930. %CV = mean(v)*factor;
  1931. % disp(['mean_cv: ', num2str(CV), 'cm/sec']);
  1932. %
  1933. % text(0,1,['CV: ',num2str(CV), 'cm/sec'], 'Units', 'Normalized')
  1934. guidata(hObject, handles);
  1935. % --- Executes on button press in pushmapapply.
  1936. function pushmapapply_Callback(hObject, eventdata, handles)
  1937. % hObject handle to pushmapapply (see GCBO)
  1938. % eventdata reserved - to be defined in a future version of MATLAB
  1939. % handles structure with handles and user data (see GUIDATA)
  1940. Mapchoice_Callback(hObject, eventdata, handles)
  1941. % --- Executes on button press in producemaps.
  1942. function producemaps_Callback(hObject, eventdata, ~)
  1943. % hObject handle to producemaps (see GCBO)
  1944. % eventdata reserved - to be defined in a future version of MATLAB
  1945. % handles structure with handles and user data (see GUIDATA)
  1946. handles = guidata(hObject);
  1947. %handles.filming=0;
  1948. %% Store each peak into array
  1949. before=str2double(get(handles.beforeGUI,'String'));
  1950. after=str2double(get(handles.afterGUI,'String'));
  1951. exposure=1/str2double(get(handles.framerate,'String'));
  1952. before = round(before/exposure); %1000 because we are dealing with ms
  1953. after = round(after/exposure);
  1954. if handles.filming == 0
  1955. wb=waitbar(0.1,'Preparing Images');
  1956. section_choice=get(handles.listbox2,'Value');
  1957. end
  1958. handles.filming
  1959. if handles.filming == 1
  1960. handles.filmcount=handles.filmcount+1;
  1961. section_choice=handles.filmcount;
  1962. section_choice
  1963. end
  1964. if strcmp(handles.section{section_choice},'Zoomed Section') == 1 && handles.filming ~= 1
  1965. sig=handles.averages(handles.q2locs(section_choice,1):handles.q2locs(section_choice,2));
  1966. %Peak Parameters
  1967. maxfluo = max(handles.averages);
  1968. mo = mode(handles.averages);
  1969. handles.peakheight = maxfluo*str2double(get(handles.peakhigh,'String'));
  1970. minpeakdist = str2double(get(handles.minpeak,'String'));
  1971. minpeakdist = ceil(minpeakdist/(1/str2double(get(handles.framerate,'String'))));
  1972. % find peaks
  1973. [~,m] = findpeaks(sig, 'MINPEAKHEIGHT', handles.peakheight, 'MINPEAKDISTANCE', minpeakdist)
  1974. m;
  1975. m=m+handles.q2locs(section_choice,1)-1;
  1976. else
  1977. m=handles.q2locs(section_choice,:);
  1978. end
  1979. f=m(m~=0);
  1980. peaks = (length(f)); % ignores last peak as the signal may cut out
  1981. %% OVERLAYING ALL BEATS TO MAKE AN AVERAGE BEAT
  1982. % total action potential duration
  1983. APtime = before+after;
  1984. [~,~,num]=size(handles.images(:,:,:))
  1985. % create empty matrix to fill later on
  1986. if APtime <= num
  1987. overlay = zeros(size(handles.im,1), size(handles.im,2), APtime);
  1988. else
  1989. overlay = zeros(size(handles.im,1), size(handles.im,2), num);
  1990. end
  1991. % skip the first and last AP to forgo any possible errors exceeding matrix
  1992. % dimensions
  1993. if f(1) <= before
  1994. startloc =2;
  1995. else startloc =1;
  1996. end
  1997. if f(end)+after > num
  1998. endloc=numel(f)-1;
  1999. else endloc = numel(f);
  2000. end
  2001. locRange = startloc:endloc;
  2002. if length(handles.q2locs) >1
  2003. end
  2004. % fill matrix
  2005. if isempty(locRange)== 1
  2006. errordlg('Peak too close to start/end of file to be analysed with current window settings, next peak analysed')
  2007. end
  2008. if f(locRange(end))+after > length(handles.images(1,1,:))
  2009. locRange=locRange(1:end-1);
  2010. end
  2011. wsmat=[];
  2012. tic
  2013. f1=f(locRange);
  2014. f1start=(f1(1)-before);
  2015. f1end=(f1(end)-after);
  2016. handles.imagerange=handles.images(:,:,f1start:f1end);
  2017. if length(locRange) > 1 %only need to overlay if more than 1 peak
  2018. wsmat=zeros(size(handles.images,1),size(handles.images,2),numel(-before:after),numel(locRange));
  2019. for x = -before:after
  2020. if f(locRange)+after < length(handles.images(1,1,:))
  2021. overlay(:,:,x+before+1) = sum(handles.images(:,:,f(locRange)+x),3)./numel(f);
  2022. overlay(:,:,x+before+1) = overlay(:,:,x+before+1).*double(handles.mask);
  2023. wsmat(:,:,x+before+1,locRange)=handles.images(:,:,f(locRange)+x);
  2024. end
  2025. end
  2026. end
  2027. handles.wsmat=wsmat;
  2028. toc
  2029. if length(locRange) == 1 %1 beat
  2030. for x = -before:after
  2031. overlay(:,:,x+before+1) = (handles.images(:,:,f(locRange)+x));
  2032. overlay(:,:,x+before+1) = overlay(:,:,x+before+1).*double(handles.mask);
  2033. end
  2034. end
  2035. handles.cvimages=overlay;
  2036. inversion=get(handles.invertopt,'Value');
  2037. %% WRITE TO TIFF STACK
  2038. % % normalise
  2039. %cos = 26/11/16 with new BL removal overlay all negative, so min and max
  2040. if handles.numofpeaksoverall > 1
  2041. minI = min(overlay(:));
  2042. maxI = max(overlay(:));
  2043. %
  2044. averageBeat = overlay - minI;
  2045. averageBeat = (2^16-1)*averageBeat./(maxI);
  2046. %
  2047. %make 16 bit
  2048. handles.averageBeat = uint16(averageBeat);
  2049. end
  2050. if handles.numofpeaksoverall == 1
  2051. disp('hi')
  2052. handles.averageBeat=handles.images;
  2053. %handles.cvimages=handles.images;
  2054. end
  2055. %% Get numbers
  2056. handles.outlier=get(handles.apdout,'Value');
  2057. if handles.filming == 0
  2058. waitbar(0.4,wb,'Producing APD map');
  2059. t=str2double(get(handles.t,'String'));
  2060. [apmap,meanapd,alll,onedev,var,SE]=mapsbaby(get(handles.aptime1,'Value'),str2double(get(handles.framerate,'String')),t,handles.I,handles.images,handles.averageBeat,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.beforeGUI,'String')),get(handles.apdbl,'Value'),str2double(get(handles.apdblnum,'String')),handles.medifilt);
  2061. waitbar(0.6,wb,'Producing Isochronal map');
  2062. if get(handles.actfittimes,'Value') == 1
  2063. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevCV,varCV,SECV]=...
  2064. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  2065. 0,400,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  2066. end
  2067. if get(handles.actfittimes,'Value') == 2
  2068. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevCV,varCV,SECV]=...
  2069. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  2070. str2double(get(handles.MINt,'String')),str2double(get(handles.MAXt,'String')),str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  2071. end
  2072. APp=prctile(alll,[5,50,95]);
  2073. CVp=prctile(vout,[5,50,95]);
  2074. handles.err=[onedev,SE,var,((APp(3)-APp(1))/APp(2))];
  2075. handles.errCV=[onedevCV,SECV,varCV,((CVp(3)-CVp(1))/CVp(2))];
  2076. rdata=zeros(4,4);
  2077. rdata(1,1)=mean(alll);rdata(1,2)=handles.err(1);rdata(1,3)=handles.err(2);rdata(1,4)=handles.err(3);rdata(1,5)=handles.err(4);
  2078. rdata(2,1)=mean(vout);rdata(2,2)=handles.errCV(1);rdata(2,3)=handles.errCV(2);rdata(2,4)=handles.errCV(3);rdata(2,5)=handles.errCV(4);
  2079. [fmap]=fluo_map(str2double(get(handles.framerate,'String')),handles.I,handles.images,get(handles.tfilt,'Value'),handles.averageBeat);
  2080. fmap(isnan(fmap))=0;
  2081. salll=fmap(fmap>0);
  2082. sp=prctile(salll,[5,50,95]);
  2083. rdata(3,1)=mean(salll);
  2084. rdata(3,2)=std(salll);
  2085. rdata(3,3)=std(salll)/sqrt(numel(salll));
  2086. rdata(3,4)=std(salll)*std(salll);
  2087. rdata(3,5)=((sp(3)-sp(1))/sp(2));
  2088. rdata(rdata==0)=NaN;
  2089. handles.rdata=rdata;
  2090. set(handles.rtable,'Data',rdata);
  2091. disp('2218')
  2092. %save AP,CV maps and vectors
  2093. handles.apdmap=apmap;
  2094. handles.apalll=alll;
  2095. handles.actmap=actmap;
  2096. handles.act_t=act_t;
  2097. handles.vout=vout;
  2098. handles.quivers_X=quivers_X;
  2099. handles.quivers_Y=quivers_Y;
  2100. handles.quivers_vx=quivers_vx;
  2101. handles.quivers_vy=quivers_vy;
  2102. handles.quivers_Xout=quivers_Xout;
  2103. handles.quivers_Yout=quivers_Yout;
  2104. handles.quivers_vxout=quivers_vxout;
  2105. handles.quivers_vyout=quivers_vyout;
  2106. %activation time
  2107. tim=act_t;
  2108. tim=tim-min(tim);
  2109. allpts=numel(tim);
  2110. xbins=0:0.01:max(tim);
  2111. tissueact=100*cumsum(hist(tim,xbins))/allpts;
  2112. actmax=str2double(get(handles.actmax,'String'));
  2113. actmin=str2double(get(handles.actmin,'String'));
  2114. Imax = find(tissueact > actmax);
  2115. Imin = find(tissueact > actmin);
  2116. if actmax < 100
  2117. Imax=Imax(1);
  2118. else Imax=max(tim);
  2119. end
  2120. Imin=Imin(1);
  2121. if actmax < 100
  2122. timmax=Imax*0.01;
  2123. else timmax=Imax
  2124. end
  2125. timmin=Imin*0.01;
  2126. timdiff=timmax-timmin;
  2127. if actmin == 0
  2128. timdiff=timmax;
  2129. end
  2130. if get(handles.checkbox8,'Value')==1
  2131. pixar=str2double(get(handles.pixelsize,'String'));
  2132. pixar=pixar*pixar;
  2133. pixar=pixar/1000000; %convert to mm2
  2134. normfac=pixar*allpts;
  2135. timdiff=timdiff/normfac;
  2136. end
  2137. set(handles.actquote, 'String', [num2str(timdiff),' ms']);
  2138. if strcmp(handles.section{1},'N/A') == 1
  2139. set(handles.CLdisp,'String',('N/A - only one peak'));
  2140. end
  2141. if strcmp(handles.section{1},'N/A') == 0
  2142. if strcmp(handles.section{section_choice},'Zoomed Section') == 1
  2143. set(handles.CLdisp,'String','N/A - Custom Section');
  2144. else
  2145. set(handles.CLdisp,'String',[num2str((handles.avgCL(2,section_choice))),' ms (Frequency = ',num2str(1000/round(handles.avgCL(2,section_choice),-1)),' Hz)']);
  2146. end
  2147. end
  2148. delete(wb)
  2149. end
  2150. guidata(hObject, handles);
  2151. axes(handles.mapaxes);
  2152. %% Upadte roi selector
  2153. % Make MAPS!!!!!
  2154. Mapchoice_Callback(hObject, eventdata, handles)
  2155. drawnow()
  2156. guidata(hObject, handles);
  2157. % --- Executes on selection change in threshopt.
  2158. function threshopt_Callback(hObject, ~, handles)
  2159. % hObject handle to threshopt (see GCBO)
  2160. % eventdata reserved - to be defined in a future version of MATLAB
  2161. % handles structure with handles and user data (see GUIDATA)
  2162. if get(handles.threshopt,'Value') == 1
  2163. set(handles.manthresh,'Enable','off')
  2164. end
  2165. if get(handles.threshopt,'Value') == 2
  2166. set(handles.manthresh,'Enable','on')
  2167. end
  2168. guidata(hObject, handles);
  2169. % Hints: contents = cellstr(get(hObject,'String')) returns threshopt contents as cell array
  2170. % contents{get(hObject,'Value')} returns selected item from threshopt
  2171. % --- Executes during object creation, after setting all properties.
  2172. function threshopt_CreateFcn(hObject, ~, ~)
  2173. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2174. set(hObject,'BackgroundColor','white');
  2175. end
  2176. function manthresh_Callback(hObject, eventdata, ~)
  2177. handles = guidata(hObject);
  2178. pushload_Callback(hObject, eventdata, handles)
  2179. % --- Executes during object creation, after setting all properties.
  2180. function manthresh_CreateFcn(hObject, ~, ~)
  2181. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2182. set(hObject,'BackgroundColor','white');
  2183. end
  2184. % --- Executes on button press in cropimage.
  2185. function cropimage_Callback(~, ~, ~)
  2186. % --- Executes on selection change in imagedisp.
  2187. function imagedisp_Callback(hObject, ~, ~)
  2188. handles = guidata(hObject);
  2189. imchoice=get(handles.imagedisp,'Value');
  2190. axes(handles.imageaxes);
  2191. cla;
  2192. [boundaries] = bwboundaries(handles.mask);
  2193. if imchoice == 1
  2194. imshow(handles.frame1,[],'InitialMagnification', 400)
  2195. colormap('gray')
  2196. freezeColors
  2197. hold on
  2198. for i=1:size(boundaries,1)
  2199. plot(boundaries{i}(:,2),boundaries{i}(:,1),'r','LineWidth',2);
  2200. end
  2201. hold off
  2202. end
  2203. if imchoice == 2
  2204. imshow(handles.fluoim,[],'InitialMagnification', 400)
  2205. colormap('jet')
  2206. freezeColors
  2207. hold on
  2208. for i=1:size(boundaries,1)
  2209. plot(boundaries{i}(:,2),boundaries{i}(:,1),'k','LineWidth',2);
  2210. end
  2211. hold off
  2212. end
  2213. axes(handles.mapaxes);
  2214. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  2215. jetcolormap(1,:) = [1, 1, 1];
  2216. colormap(jetcolormap);
  2217. guidata(hObject, handles);
  2218. % Hints: contents = cellstr(get(hObject,'String')) returns imagedisp contents as cell array
  2219. % contents{get(hObject,'Value')} returns selected item from imagedisp
  2220. % --- Executes during object creation, after setting all properties.
  2221. function imagedisp_CreateFcn(hObject, ~, ~)
  2222. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2223. set(hObject,'BackgroundColor','white');
  2224. end
  2225. % --- Executes on button press in cropbox.
  2226. function cropbox_Callback(~, ~, ~)
  2227. % --- Executes on button press in exportvalues.
  2228. function exportvalues_Callback(hObject, ~, ~)
  2229. handles = guidata(hObject);
  2230. [filename,pathname] = uiputfile({'*.csv';'*.txt';'*.mat'}, 'Save Map values (Isochronal maps with vector overlay can only be saved as .mat files)');
  2231. [~,~,ext] = fileparts(filename);
  2232. file=[pathname,filename];
  2233. choice=get(handles.Mapchoice,'Value');
  2234. map=handles.holdmap;
  2235. % mat file save
  2236. if strcmp('.mat',ext) == 1
  2237. if choice == 1
  2238. APD_Dist=map;
  2239. save(file,'APD_Dist');
  2240. end
  2241. if choice == 2;
  2242. activation_time=map;
  2243. save(file,'activation_time');
  2244. end
  2245. if choice == 3;
  2246. activation_time=map;
  2247. xpositions=X_pos;
  2248. ypositions=Y_pos;
  2249. xvelocities=X_vel;
  2250. yvelocities=Y_vel;
  2251. velocities=total_vel;
  2252. save(file,'activation_time','xpositions','ypositions','xvelocities','yvelocities','velocities','fractional_up');
  2253. end
  2254. if choice == 4;
  2255. activation_time=map;
  2256. xpositions=Xout_pos;
  2257. ypositions=Yout_pos;
  2258. xvelocities=Xout_vel;
  2259. yvelocities=Yout_vel;
  2260. velocities=total_velout;
  2261. save(file,'activation_time','xpositions','ypositions','xvelocities','yvelocities','velocities','fractional_up');
  2262. end
  2263. if choice == 6
  2264. DI=handles.holdmap;
  2265. save(file,'DI')
  2266. end
  2267. if choice == 8
  2268. tau=handles.holdmap;
  2269. save(file,'tau')
  2270. end
  2271. if choice == 9
  2272. [~,~,~,act_t,~,~,~,~,~,~,vout,~,~,~,~, onedevCV,varCV,SECV]=...
  2273. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  2274. 0,200,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  2275. cvmean = mean(vout);
  2276. CVdev=onedevCV;
  2277. save(file,'RT50','t1080','signal_level','gofmap1080','cvmean','CVdev')
  2278. disp('done')
  2279. end
  2280. end
  2281. % csv and txt files
  2282. if strcmp('.csv',ext) == 1 || strcmp('.txt',ext) == 1
  2283. cho = questdlg('How would you like to export the values?', ...
  2284. 'Export', ...
  2285. 'Map','List','List');
  2286. switch cho
  2287. case 'Map'
  2288. T=table(map);
  2289. writetable(T,file,'Delimiter',',','WriteVariableNames',false);
  2290. if choice == 2 || choice == 3 || choice == 4
  2291. cvfile=[pathname,'CV_',filename];
  2292. T2=table(handles.holdcvmap);
  2293. writetable(T2,cvfile,'Delimiter',',','WriteVariableNames',false);
  2294. end
  2295. case 'List'
  2296. listmap=reshape(map,numel(map),1);
  2297. listmap=listmap(listmap>0);
  2298. listmap=listmap(isnan(listmap)==0);
  2299. T=table(listmap);
  2300. writetable(T,file,'Delimiter',',','WriteVariableNames',false);
  2301. if choice == 2 || choice == 3 || choice == 4
  2302. cvfile=[pathname,'CV_',filename];
  2303. CVmap=handles.holdcvmap;
  2304. listcvmap=reshape(CVmap,numel(CVmap),1);
  2305. listcvmap=listcvmap(listcvmap>0);
  2306. listcvmap=listcvmap(isnan(listcvmap)==0);
  2307. T=table(listcvmap);
  2308. writetable(T,cvfile,'Delimiter',',','WriteVariableNames',false);
  2309. end
  2310. end
  2311. end
  2312. % --- Executes on button press in act_movie.
  2313. function act_movie_Callback(hObject, ~, ~)
  2314. handles = guidata(hObject);
  2315. meme=0;
  2316. gifsave=questdlg('Save File?','Gif Save','Yes','No','Yes');
  2317. switch gifsave
  2318. case 'Yes'
  2319. meme=1;
  2320. case 'No'
  2321. meme=0;
  2322. end
  2323. map=handles.actmap;
  2324. if meme == 1
  2325. [a,b]=uiputfile('*.gif');
  2326. filename=[b,a];
  2327. end
  2328. h=figure;
  2329. hold on
  2330. imshow(map,[],'InitialMagnification', 800);
  2331. map=map;
  2332. if get(handles.isoopt,'Value') == 1
  2333. mini=0;
  2334. maxi=max(max(map)); %ms
  2335. end
  2336. if get(handles.isoopt,'Value') == 2
  2337. maxi=str2double(get(handles.isomax,'String'));
  2338. mini=str2double(get(handles.isomin,'String'));
  2339. end
  2340. maxiall=max(max(map));
  2341. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  2342. jetcolormap(1,:) = [0, 0, 0];
  2343. colormap(jetcolormap);
  2344. caxis([0 maxi]);
  2345. delay=0.01;
  2346. for j = 1:0.1:ceil(maxiall);
  2347. mapmask=(map<j);
  2348. A=map.*mapmask;
  2349. imshow(A, [mini ceil(maxi)], 'Colormap',jetcolormap, 'InitialMagnification', 400)
  2350. if meme == 1
  2351. frame = getframe(h);
  2352. im = frame2im(frame);
  2353. [imind,cm] = rgb2ind(im,256);
  2354. % Write to the GIF File
  2355. if j == 1
  2356. imwrite(imind,cm,filename,'gif', 'Loopcount',inf,'DelayTime',delay);
  2357. else
  2358. imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',delay);
  2359. end
  2360. end
  2361. end
  2362. function isomin_Callback(hObject, eventdata, handles)
  2363. % --- Executes during object creation, after setting all properties.
  2364. function isomin_CreateFcn(hObject, eventdata, handles)
  2365. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2366. set(hObject,'BackgroundColor','white');
  2367. end
  2368. function isomax_Callback(hObject, eventdata, handles)
  2369. % --- Executes during object creation, after setting all properties.
  2370. function isomax_CreateFcn(hObject, eventdata, handles)
  2371. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2372. set(hObject,'BackgroundColor','white');
  2373. end
  2374. % --- Executes on selection change in isoopt.
  2375. function isoopt_Callback(hObject, eventdata, handles)
  2376. handles = guidata(hObject);
  2377. Mapchoice_Callback(hObject, eventdata, handles)
  2378. guidata(hObject, handles);
  2379. % --- Executes during object creation, after setting all properties.
  2380. function isoopt_CreateFcn(hObject, eventdata, handles)
  2381. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2382. set(hObject,'BackgroundColor','white');
  2383. end
  2384. % --- Executes on button press in applyiso.
  2385. function applyiso_Callback(hObject, eventdata, handles)
  2386. handles = guidata(hObject);
  2387. listbox2_Callback(hObject, eventdata, handles)
  2388. guidata(hObject, handles);
  2389. % --- Executes on button press in pushbutton17.
  2390. function pushbutton17_Callback(hObject, eventdata, handles)
  2391. handles = guidata(hObject);
  2392. axes(handles.mapaxes);
  2393. choice = questdlg('Video or Image?', ...
  2394. 'Thing', ...
  2395. 'Video','Image','Video');
  2396. switch choice
  2397. case 'Video'
  2398. [filename,pathname] = uiputfile({'*.avi'}, 'Save .avi image video file of currently displayed maps across all sections' );
  2399. [~,~,ext] = fileparts(filename);
  2400. file=[pathname,filename];
  2401. % if isdepolyed == 0
  2402. % cd(pathname)
  2403. % end
  2404. handles.filming = 1;
  2405. numsec=length(handles.section);
  2406. vidobj = VideoWriter(file);
  2407. vidobj.FrameRate=1;
  2408. open(vidobj);
  2409. set(gca,'nextplot','replacechildren');
  2410. guidata(hObject, handles);
  2411. %wb=waitbar(0.1,'Producing video file','WindowStyle', 'modal');
  2412. for k=1:numsec
  2413. handles.filmcount = k;
  2414. guidata(hObject,handles);
  2415. producemaps_Callback(hObject, eventdata, handles)
  2416. handles = guidata(hObject);
  2417. axes(handles.mapaxes);
  2418. currFrame = getframe;
  2419. writeVideo(vidobj,currFrame);
  2420. 0.1+0.9*(k/numsec)
  2421. %waitbar((0.1+0.9*(k/numsec)),wb);
  2422. end
  2423. close(vidobj);
  2424. %delete(wb)
  2425. set(handles.listbox2,'Value',numsec)
  2426. handles.filming = 0;
  2427. case 'Image'
  2428. handles.filming = 1;
  2429. numsec=length(handles.section);
  2430. for i=1:numsec
  2431. handles.filmcount = i;
  2432. handles.b2bimage=1;
  2433. guidata(hObject, handles);
  2434. Mapchoice_Callback(hObject, eventdata, handles);
  2435. GUI_fig_children=get(gcf,'children');
  2436. Fig_Axes=findobj(GUI_fig_children,'type','Axes');
  2437. fig=figure;
  2438. ax=axes;clf;
  2439. new_handle=copyobj(handles.mapaxes,fig);
  2440. pretty=get(handles.colmap,'String'); jetcolormap = (colormap(pretty{get(handles.colmap,'Value')}));
  2441. jetcolormap(1,:) = [1, 1, 1];
  2442. colormap(jetcolormap);
  2443. set(gca,'ActivePositionProperty','outerposition')
  2444. set(gca,'Units','normalized')
  2445. set(gca,'OuterPosition',[i/numsec-0.2 i/numsec-0.2 i/numsec i/numsec])
  2446. %set(gca,'position',[0.1300 0.1100 0.7750 0.8150])
  2447. guidata(hObject, handles);
  2448. end
  2449. handles.filming=0
  2450. guidata(hObject, handles);
  2451. end
  2452. % --- Executes on button press in segEP.
  2453. function segEP_Callback(~, ~, ~)
  2454. segEP
  2455. % --- Executes on button press in fold.
  2456. function fold_Callback(~, ~, ~)
  2457. function framerate_Callback(~, ~, ~)
  2458. % --- Executes during object creation, after setting all properties.
  2459. function framerate_CreateFcn(hObject, ~, ~)
  2460. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2461. set(hObject,'BackgroundColor','white');
  2462. end
  2463. function pixelsize_Callback(~, ~, ~)
  2464. % --- Executes during object creation, after setting all properties.
  2465. function pixelsize_CreateFcn(hObject, ~, ~)
  2466. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2467. set(hObject,'BackgroundColor','white');
  2468. end
  2469. function binnumber_Callback(~, ~, ~)
  2470. % --- Executes during object creation, after setting all properties.
  2471. function binnumber_CreateFcn(hObject, ~, ~)
  2472. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2473. set(hObject,'BackgroundColor','white');
  2474. end
  2475. % --- Executes on button press in getpixelinfo.
  2476. function getpixelinfo_Callback(hObject, ~, handles)
  2477. % hObject handle to getpixelinfo (see GCBO)
  2478. % eventdata reserved - to be defined in a future version of MATLAB
  2479. % handles structure with handles and user data (see GUIDATA)
  2480. compare
  2481. guidata(hObject, handles);
  2482. % --- Executes on button press in phasemap.
  2483. function phasemap_Callback(~, ~, ~)
  2484. % hObject handle to phasemap (see GCBO)
  2485. % eventdata reserved - to be defined in a future version of MATLAB
  2486. % handles structure with handles and user data (see GUIDATA)
  2487. phasemapping
  2488. % --- Executes on button press in compare.
  2489. function compare_Callback(~, ~, ~)
  2490. pixelinfo
  2491. % --- Executes on button press in pushbutton23.
  2492. function pushbutton23_Callback(~, ~, ~)
  2493. conduction
  2494. function beforeGUI_Callback(~, ~, ~)
  2495. % --- Executes during object creation, after setting all properties.
  2496. function beforeGUI_CreateFcn(hObject, ~, ~)
  2497. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2498. set(hObject,'BackgroundColor','white');
  2499. end
  2500. function afterGUI_Callback(~, ~, ~)
  2501. % --- Executes during object creation, after setting all properties.
  2502. function afterGUI_CreateFcn(hObject, ~, ~)
  2503. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2504. set(hObject,'BackgroundColor','white');
  2505. end
  2506. % --- Executes on selection change in velalgo.
  2507. function velalgo_Callback(hObject, eventdata, handles)
  2508. wb=waitbar(0.5,'Producing Isochronal map');
  2509. guidata(hObject, handles);
  2510. if get(handles.actfittimes,'Value') == 1
  2511. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevCV,varCV,SECV]=...
  2512. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  2513. 0,400,str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  2514. end
  2515. if get(handles.actfittimes,'Value') == 2
  2516. [actmap,~,~,act_t,quivers_X,quivers_Y,quivers_vx,quivers_vy,~,~,vout,quivers_Xout,quivers_Yout, quivers_vxout,quivers_vyout,onedevCV,varCV,SECV]=...
  2517. cvmap(str2double(get(handles.pixelsize,'String')),str2double(get(handles.framerate,'String')),handles.cvimages,handles.mask,get(handles.velout,'Value'),str2double(get(handles.minvel,'String')),str2double(get(handles.maxvel,'String')),get(handles.velalgo,'Value'),...
  2518. str2double(get(handles.MINt,'String')),str2double(get(handles.MAXt,'String')),str2double(get(handles.winsize,'String')),str2double(get(handles.beforeGUI,'String')),str2double(get(handles.wint,'String')),0,str2double(get(handles.t,'String')),get(handles.tfilt,'Value'),get(handles.usespline,'Value'),str2double(get(handles.splineN,'String')));
  2519. end
  2520. CVp=prctile(vout,[5,50,95]);
  2521. handles.errCV=[onedevCV,SECV,varCV,((CVp(3)-CVp(1))/CVp(2))];
  2522. rdata=handles.rdata;
  2523. rdata(2,1)=mean(vout);rdata(2,2)=handles.errCV(1);rdata(2,3)=handles.errCV(2);rdata(2,4)=handles.errCV(3);rdata(2,5)=handles.errCV(4);
  2524. handles.rdata=rdata;
  2525. set(handles.rtable,'Data',rdata);
  2526. disp('2768')
  2527. %save CV maps and vectors
  2528. handles.actmap=actmap;
  2529. handles.act_t=act_t;
  2530. handles.quivers_X=quivers_X;
  2531. handles.quivers_Y=quivers_Y;
  2532. handles.quivers_vx=quivers_vx;
  2533. handles.quivers_vy=quivers_vy;
  2534. handles.quivers_Xout=quivers_Xout;
  2535. handles.quivers_Yout=quivers_Yout;
  2536. handles.quivers_vxout=quivers_vxout;
  2537. handles.quivers_vyout=quivers_vyout;
  2538. delete(wb)
  2539. guidata(hObject, handles);
  2540. Mapchoice_Callback(hObject, eventdata, handles)
  2541. guidata(hObject, handles);
  2542. % Hints: contents = cellstr(get(hObject,'String')) returns velalgo contents as cell array
  2543. % contents{get(hObject,'Value')} returns selected item from velalgo
  2544. % --- Executes during object creation, after setting all properties.
  2545. function velalgo_CreateFcn(hObject, ~, ~)
  2546. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2547. set(hObject,'BackgroundColor','white');
  2548. end
  2549. % --- Executes on selection change in actopt.
  2550. function actopt_Callback(~, ~, ~)
  2551. % --- Executes during object creation, after setting all properties.
  2552. function actopt_CreateFcn(hObject, ~, ~)
  2553. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2554. set(hObject,'BackgroundColor','white');
  2555. end
  2556. function actmin_Callback(hObject, ~, ~)
  2557. handles = guidata(hObject);
  2558. tim=handles.act_t;
  2559. tim=tim-min(tim);
  2560. allpts=numel(tim);
  2561. xbins=0:0.01:max(tim);
  2562. tissueact=100*cumsum(hist(tim,xbins))/allpts;
  2563. actmax=str2double(get(handles.actmax,'String'));
  2564. actmin=str2double(get(handles.actmin,'String'));
  2565. Imax = find(tissueact > actmax);
  2566. Imin = find(tissueact > actmin);
  2567. if actmax < 100
  2568. Imax=Imax(1);
  2569. else
  2570. Imax=max(tim);
  2571. end
  2572. Imin=Imin(1);
  2573. if actmax < 100
  2574. timmax=Imax*0.01;
  2575. else
  2576. timmax=Imax;
  2577. end
  2578. timmin=Imin*0.01;
  2579. timdiff=timmax-timmin;
  2580. if actmin == 0
  2581. timdiff=timmax;
  2582. end
  2583. if get(handles.checkbox8,'Value')==1
  2584. normfac=225/allpts; %why 225?
  2585. timdiff=timdiff*normfac;
  2586. end
  2587. set(handles.actquote, 'String', [num2str(timdiff),' ms']);
  2588. guidata(hObject, handles);
  2589. % Hints: get(hObject,'String') returns contents of actmin as text
  2590. % str2double(get(hObject,'String')) returns contents of actmin as a double
  2591. % --- Executes during object creation, after setting all properties.
  2592. function actmin_CreateFcn(hObject, ~, ~)
  2593. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2594. set(hObject,'BackgroundColor','white');
  2595. end
  2596. function actmax_Callback(hObject, ~, ~)
  2597. handles = guidata(hObject);
  2598. tim=handles.act_t;
  2599. tim=tim-min(tim);
  2600. allpts=numel(tim);
  2601. xbins=0:0.01:max(tim);
  2602. tissueact=100*cumsum(hist(tim,xbins))/allpts;
  2603. actmax=str2double(get(handles.actmax,'String'));
  2604. actmin=str2double(get(handles.actmin,'String'));
  2605. Imax = find(tissueact > actmax);
  2606. Imin = find(tissueact > actmin);
  2607. if actmax < 100
  2608. Imax=Imax(1);
  2609. else Imax=max(tim);
  2610. end
  2611. Imin=Imin(1);
  2612. if actmax < 100
  2613. timmax=Imax*0.01;
  2614. else timmax=Imax
  2615. end
  2616. timmin=Imin*0.01;
  2617. timdiff=timmax-timmin;
  2618. if actmin == 0
  2619. timdiff=timmax;
  2620. end
  2621. if get(handles.checkbox8,'Value')==1
  2622. normfac=225/allpts;
  2623. timdiff=timdiff*normfac;
  2624. end
  2625. set(handles.actquote, 'String', [num2str(timdiff),' ms']);
  2626. guidata(hObject, handles);
  2627. % --- Executes during object creation, after setting all properties.
  2628. function actmax_CreateFcn(hObject, ~, ~)
  2629. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2630. set(hObject,'BackgroundColor','white');
  2631. end
  2632. % --- Executes on button press in checkbox8.
  2633. function checkbox8_Callback(hObject, ~, ~)
  2634. handles = guidata(hObject);
  2635. tim=handles.act_t;
  2636. tim=tim-min(tim);
  2637. allpts=numel(tim);
  2638. xbins=0:0.01:max(tim);
  2639. tissueact=100*cumsum(hist(tim,xbins))/allpts;
  2640. actmax=str2double(get(handles.actmax,'String'));
  2641. actmin=str2double(get(handles.actmin,'String'));
  2642. Imax = find(tissueact > actmax);
  2643. Imin = find(tissueact > actmin);
  2644. if actmax < 100
  2645. Imax=Imax(1);
  2646. else
  2647. Imax=max(tim);
  2648. end
  2649. Imin=Imin(1);
  2650. if actmax < 100
  2651. timmax=Imax*0.01;
  2652. else
  2653. timmax=Imax;
  2654. end
  2655. timmin=Imin*0.01;
  2656. timdiff=timmax-timmin;
  2657. if actmin == 0
  2658. timdiff=timmax;
  2659. end
  2660. if get(handles.checkbox8,'Value')==1
  2661. pixar=str2double(get(handles.pixelsize,'String'));
  2662. pixar=pixar*pixar;
  2663. pixar=pixar/1000000; %convert to mm2
  2664. normfac=pixar*allpts;
  2665. timdiff=timdiff/normfac;
  2666. end
  2667. set(handles.actquote, 'String', [num2str(timdiff),' ms']);
  2668. function t_Callback(hObject, eventdata, ~)
  2669. handles = guidata(hObject);
  2670. t=str2double(get(handles.t,'String'));
  2671. [apmap,meanapd,alll,onedev,var,SE]=mapsbaby(get(handles.aptime1,'Value'),str2double(get(handles.framerate,'String')),t,handles.I,handles.images,handles.averageBeat,handles.outlier,str2double(get(handles.cmin,'String')),str2double(get(handles.cmax,'String')),get(handles.tfilt,'Value'),str2double(get(handles.beforeGUI,'String')),get(handles.apdbl,'Value'),str2double(get(handles.apdblnum,'String')),handles.medifilt);
  2672. %alll=apmap(apmap>0);
  2673. APp=prctile(alll,[5,50,95]);
  2674. handles.err=[onedev,SE,var,((APp(3)-APp(1))/APp(2))];
  2675. %save AP,CV maps and vectors
  2676. handles.apdmap=apmap;
  2677. handles.apalll=alll;
  2678. rdata=handles.rdata;
  2679. rdata(1,1)=mean(alll);rdata(1,2)=handles.err(1);rdata(1,3)=handles.err(2);rdata(1,4)=handles.err(3);rdata(1,5)=handles.err(4);
  2680. handles.rdata=rdata;
  2681. guidata(hObject,handles)
  2682. set(handles.rtable,'Data',rdata);
  2683. disp('2977')
  2684. mapcho=get(handles.Mapchoice,'Value');
  2685. if mapcho == 1
  2686. Mapchoice_Callback(hObject, eventdata, handles);
  2687. end
  2688. guidata(hObject,handles)
  2689. % --- Executes during object creation, after setting all properties.
  2690. function t_CreateFcn(hObject, ~, ~)
  2691. % hObject handle to t (see GCBO)
  2692. % eventdata reserved - to be defined in a future version of MATLAB
  2693. % handles empty - handles not created until after all CreateFcns called
  2694. % Hint: edit controls usually have a white background on Windows.
  2695. % See ISPC and COMPUTER.
  2696. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2697. set(hObject,'BackgroundColor','white');
  2698. end
  2699. % --- Executes on selection change in apdscale.
  2700. function apdscale_Callback(hObject, eventdata, ~)
  2701. % hObject handle to apdscale (see GCBO)
  2702. % eventdata reserved - to be defined in a future version of MATLAB
  2703. % handles structure with handles and user data (see GUIDATA)
  2704. handles = guidata(hObject);
  2705. Mapchoice_Callback(hObject, eventdata, handles)
  2706. % --- Executes during object creation, after setting all properties.
  2707. function apdscale_CreateFcn(hObject, ~, ~)
  2708. % hObject handle to apdscale (see GCBO)
  2709. % eventdata reserved - to be defined in a future version of MATLAB
  2710. % handles empty - handles not created until after all CreateFcns called
  2711. % Hint: popupmenu controls usually have a white background on Windows.
  2712. % See ISPC and COMPUTER.
  2713. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2714. set(hObject,'BackgroundColor','white');
  2715. end
  2716. function MINt_Callback(~, ~, ~)
  2717. % --- Executes during object creation, after setting all properties.
  2718. function MINt_CreateFcn(hObject, ~, ~)
  2719. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2720. set(hObject,'BackgroundColor','white');
  2721. end
  2722. function MAXt_Callback(~, ~, ~)
  2723. % --- Executes during object creation, after setting all properties.
  2724. function MAXt_CreateFcn(hObject, eventdata, handles)
  2725. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2726. set(hObject,'BackgroundColor','white');
  2727. end
  2728. % --- Executes on selection change in actfittimes.
  2729. function actfittimes_Callback(~, ~, ~)
  2730. % --- Executes during object creation, after setting all properties.
  2731. function actfittimes_CreateFcn(hObject, ~, ~)
  2732. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2733. set(hObject,'BackgroundColor','white');
  2734. end
  2735. function winsize_Callback(~, ~, ~)
  2736. % --- Executes during object creation, after setting all properties.
  2737. function winsize_CreateFcn(hObject, ~, ~)
  2738. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2739. set(hObject,'BackgroundColor','white');
  2740. end
  2741. function taustart_Callback(hObject, eventdata, ~)
  2742. handles = guidata(hObject);
  2743. contents = cellstr(get(handles.Mapchoice,'String'));
  2744. choice=get(handles.Mapchoice,'Value');
  2745. if choice == 8
  2746. Mapchoice_Callback(hObject, eventdata, handles)
  2747. end
  2748. % --- Executes during object creation, after setting all properties.
  2749. function taustart_CreateFcn(hObject, ~, ~)
  2750. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2751. set(hObject,'BackgroundColor','white');
  2752. end
  2753. function r2cut_Callback(hObject, eventdata, ~)
  2754. handles = guidata(hObject);
  2755. contents = cellstr(get(handles.Mapchoice,'String'));
  2756. choice=get(handles.Mapchoice,'Value');
  2757. if choice == 8
  2758. Mapchoice_Callback(hObject, eventdata, handles)
  2759. end
  2760. % --- Executes during object creation, after setting all properties.
  2761. function r2cut_CreateFcn(hObject, ~, ~)
  2762. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2763. set(hObject,'BackgroundColor','white');
  2764. end
  2765. function apdblnum_Callback(~, ~, ~)
  2766. % --- Executes during object creation, after setting all properties.
  2767. function apdblnum_CreateFcn(hObject, ~, ~)
  2768. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2769. set(hObject,'BackgroundColor','white');
  2770. end
  2771. % --- Executes on selection change in apdbl.
  2772. function apdbl_Callback(hObject, eventdata, handles)
  2773. t_Callback(hObject, eventdata, handles)
  2774. % --- Executes during object creation, after setting all properties.
  2775. function apdbl_CreateFcn(hObject, ~, ~)
  2776. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2777. set(hObject,'BackgroundColor','white');
  2778. end
  2779. function taufinish_Callback(~, ~, ~)
  2780. % --- Executes during object creation, after setting all properties.
  2781. function taufinish_CreateFcn(hObject, ~, ~)
  2782. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2783. set(hObject,'BackgroundColor','white');
  2784. end
  2785. function peakhigh_Callback(~, ~, ~)
  2786. % --- Executes during object creation, after setting all properties.
  2787. function peakhigh_CreateFcn(hObject, ~, ~)
  2788. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2789. set(hObject,'BackgroundColor','white');
  2790. end
  2791. function scal_Callback(~, ~, ~)
  2792. % --- Executes during object creation, after setting all properties.
  2793. function scal_CreateFcn(hObject, ~, ~)
  2794. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2795. set(hObject,'BackgroundColor','white');
  2796. end
  2797. function wint_Callback(~, ~, ~)
  2798. % --- Executes during object creation, after setting all properties.
  2799. function wint_CreateFcn(hObject, ~, ~)
  2800. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2801. set(hObject,'BackgroundColor','white');
  2802. end
  2803. % --- Executes on button press in altanal.
  2804. function altanal_Callback(hObject, ~, ~)
  2805. alternangui
  2806. % --- Executes on button press in removef.
  2807. function removef_Callback(~, ~, ~)
  2808. % --- Executes on selection change in aptime1.
  2809. function aptime1_Callback(hObject, eventdata, handles)
  2810. t_Callback(hObject, eventdata, handles)
  2811. % --- Executes during object creation, after setting all properties.
  2812. function aptime1_CreateFcn(hObject, ~, ~)
  2813. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2814. set(hObject,'BackgroundColor','white');
  2815. end
  2816. % --- Executes on button press in configure.
  2817. function configure_Callback(~, ~, handles)
  2818. % Construct a questdlg
  2819. choice = questdlg('Would you like to load a configuration file or save current settings?', ...
  2820. 'Config File', ...
  2821. 'New File', 'Load Settings','Load Settings');
  2822. % Handle response
  2823. switch choice
  2824. case 'New File'
  2825. [fname,PathName] = uiputfile('*.txt')
  2826. filename=[PathName,fname];
  2827. % create file for writing too
  2828. fileID = fopen(filename,'w');
  2829. dt=datetime('now'); dt=datestr(dt);
  2830. fprintf(fileID,'Configuration File for use in ElectroMap\r\n');
  2831. fprintf(fileID,['Created: ',dt,'\r\n'])
  2832. fprintf(fileID,['Notes:\r\n\r\n\r\n'])
  2833. fprintf(fileID,['--- DO NOT EDIT VARIABLE NAMES OR REMOVE ! BELOW THIS POINT, {} = units, () = settings in ElectroMap or Notes ---\r\n\r\n'])
  2834. %cell arrays for popdown menu strings
  2835. threshopt_string=get(handles.threshopt,'String');
  2836. thershopt_string=threshopt_string{get(handles.threshopt,'Value')};
  2837. sfilt_string=get(handles.sfilt,'String');
  2838. sfilt_string=sfilt_string{get(handles.sfilt,'Value')};
  2839. segchoice_string=get(handles.segchoice,'String');
  2840. segchoice_string=segchoice_string{get(handles.segchoice,'Value')}
  2841. BLopt_string=get(handles.BLopt,'String');
  2842. BLopt_string=BLopt_string{get(handles.BLopt,'Value')}
  2843. tfilt_string=get(handles.tfilt,'String');
  2844. tfilt_string=tfilt_string{get(handles.tfilt,'Value')};
  2845. apdbl_string=get(handles.apdbl,'String');
  2846. apdbl_string=apdbl_string{get(handles.apdbl,'Value')};
  2847. aptime1_string=get(handles.aptime1,'String');
  2848. aptime1_string=aptime1_string{get(handles.aptime1,'Value')};
  2849. velalgo_string=get(handles.velalgo,'String');
  2850. velalgo_string=velalgo_string{get(handles.velalgo,'Value')};
  2851. actfittimes_string=get(handles.actfittimes,'String');
  2852. actfittimes_string=actfittimes_string{get(handles.actfittimes,'Value')};
  2853. velout_string=get(handles.velout,'String');
  2854. velout_string=velout_string{get(handles.velout,'Value')};
  2855. apdout_string=get(handles.apdout,'String');
  2856. apdout_string=apdout_string{get(handles.apdout,'Value')};
  2857. apdscale_string=get(handles.apdscale,'String');
  2858. apdscale_string=apdscale_string{get(handles.apdscale,'Value')};
  2859. % get settings and put into file
  2860. fprintf(fileID,['framerate=',get(handles.framerate,'String'),'! {kHz} !\r\n']);
  2861. fprintf(fileID,['pixelsize=',get(handles.pixelsize,'String'),'! {ms} !!\r\n']);
  2862. fprintf(fileID,['threshopt=',num2str(get(handles.threshopt,'Value')),'! (',thershopt_string,')',' !\r\n']);
  2863. fprintf(fileID,['manthresh=',get(handles.manthresh,'String'),'! {Percent} (Change from automatically generated threshold) !\r\n']);
  2864. fprintf(fileID,['sfilt=',num2str(get(handles.sfilt,'Value')),'! (',sfilt_string,') !\r\n']);
  2865. fprintf(fileID,['sfiltsize=',get(handles.sfiltsize,'String'),'! {Pixels} !\r\n']);
  2866. fprintf(fileID,['segchoice=',num2str(get(handles.segchoice,'Value')),'! (',segchoice_string,') !\r\n']);
  2867. fprintf(fileID,['segsize=',get(handles.segsize,'String'),'! !\r\n']);
  2868. fprintf(fileID,['invertopt=',num2str(get(handles.invertopt,'Value')),'! (1 means invert signal) !\r\n']);
  2869. fprintf(fileID,['BLopt=',num2str(get(handles.BLopt,'Value')),'! (',BLopt_string,') !\r\n']);
  2870. fprintf(fileID,['thlen=',get(handles.thlen,'String'),'! {ms}, (Length of top-hat filter) !\r\n']);
  2871. fprintf(fileID,['tfilt=',num2str(get(handles.tfilt,'Value')),'! (',tfilt_string,') !\r\n']);
  2872. fprintf(fileID,['minpeak=',get(handles.minpeak,'String'),'! {ms} !\r\n']);
  2873. fprintf(fileID,['peakhigh=',get(handles.peakhigh,'String'),'! !\r\n']);
  2874. fprintf(fileID,['minnum=',get(handles.minnum,'String'),'! !\r\n']);
  2875. fprintf(fileID,['minbound=',get(handles.minbound,'String'),'! {ms} !\r\n']);
  2876. fprintf(fileID,['beforeGUI=',get(handles.beforeGUI,'String'),'! {ms} !\r\n']);
  2877. fprintf(fileID,['afterGUI=',get(handles.afterGUI,'String'),'! {ms} !\r\n']);
  2878. fprintf(fileID,['apdbl=',num2str(get(handles.apdbl,'Value')),'! (',apdbl_string,') !\r\n']);
  2879. fprintf(fileID,['apdblnum=',get(handles.apdblnum,'String'),'! {ms} !\r\n']);
  2880. fprintf(fileID,['aptime1=',num2str(get(handles.aptime1,'Value')),'! (',aptime1_string,') !\r\n']);
  2881. fprintf(fileID,['taustart=',get(handles.taustart,'String'),'! {Percent} !\r\n']);
  2882. fprintf(fileID,['taufinish=',get(handles.taufinish,'String'),'! {Percent} !\r\n']);
  2883. fprintf(fileID,['r2cut=',get(handles.r2cut,'String'),'! !\r\n']);
  2884. fprintf(fileID,['velalgo=',num2str(get(handles.velalgo,'Value')),'! (',velalgo_string,') (Activation Measure) !\r\n']);
  2885. fprintf(fileID,['isoopt=',num2str(get(handles.isoopt,'Value')),'! !\r\n']);
  2886. fprintf(fileID,['isomin=',get(handles.isomin,'String'),'! {ms} !\r\n']);
  2887. fprintf(fileID,['isomax=',get(handles.isomax,'String'),'! {ms} !\r\n']);
  2888. fprintf(fileID,['actfittimes=',num2str(get(handles.actfittimes,'Value')),'! (',actfittimes_string,') !\r\n']);
  2889. fprintf(fileID,['MINt=',get(handles.MINt,'String'),'! {ms} (Minimum activation time for multi-vector fit) !\r\n']);
  2890. fprintf(fileID,['MAXt=',get(handles.MAXt,'String'),'! {ms} (Maximum activation time for multi-vector fit) !\r\n']);
  2891. fprintf(fileID,['velout=',num2str(get(handles.velout,'Value')),'! (',velout_string,') (Local Velocity outlier removal) !\r\n']);
  2892. fprintf(fileID,['minvel=',get(handles.minvel,'String'),'! {ms} (Minimum calcualted velocity that is not discarded) !\r\n']);
  2893. fprintf(fileID,['maxvel=',get(handles.maxvel,'String'),'! {ms} (Maximum calculated velocity that is not discarded) !\r\n']);
  2894. fprintf(fileID,['winsize=',get(handles.winsize,'String'),'!{Pixels} (Local window size) !\r\n']);
  2895. fprintf(fileID,['scal=',get(handles.scal,'String'),'! (Size of overlaid velocity vectors) !\r\n']);
  2896. fprintf(fileID,['wint=',get(handles.wint,'String'),'! (Maximum time diffrence allowed in local window fit) !\r\n']);
  2897. fprintf(fileID,['apdout=',num2str(get(handles.apdout,'Value')),'! (',apdout_string,') (APD/CaD outlier removal) !\r\n']);
  2898. fprintf(fileID,['apdscale=',num2str(get(handles.apdscale,'Value')),'! (',apdscale_string,') !\r\n']);
  2899. fprintf(fileID,['cmin=',get(handles.cmin,'String'),'! {ms} (manual colour map minimum)!\r\n']);
  2900. fprintf(fileID,['cmax=',get(handles.cmax,'String'),'! {ms} (manual colour map maximum)!\r\n']);
  2901. fprintf(fileID,['t=',get(handles.t,'String'),'! {Percent} (APD/CaD)!\r\n']);
  2902. fprintf(fileID,['checkbox8=',num2str(get(handles.checkbox8,'Value')),'! (1 means normalised to {ms/mm2}, 0 absoulte in {ms})!\r\n']);
  2903. fprintf(fileID,['actmin=',get(handles.actmin,'String'),'! {Percent}!\r\n']);
  2904. fprintf(fileID,['actmax=',get(handles.actmax,'String'),'! {Percent}!\r\n']);
  2905. fprintf(fileID,['binnumber=',get(handles.binnumber,'String'),'!!\r\n']);
  2906. % close file
  2907. fclose(fileID);
  2908. case 'Load Settings'
  2909. [fname,PathName] = uigetfile('*.txt');
  2910. filename=[PathName,fname];
  2911. %% open file for reading
  2912. fid=fopen(filename,'r','b')
  2913. fstr=fread(fid,'int8=>char')';
  2914. fclose(fid);
  2915. %% Update GUI
  2916. set(handles.framerate,'String',varEM(fstr,'framerate',0))
  2917. set(handles.pixelsize,'String',varEM(fstr,'pixelsize',0))
  2918. set(handles.threshopt,'Value',varEM(fstr,'threshopt',1))
  2919. set(handles.manthresh,'String',varEM(fstr,'manthresh',0))
  2920. set(handles.sfilt,'Value',varEM(fstr,'sfilt',1))
  2921. set(handles.sfiltsize,'String',varEM(fstr,'sfiltsize',0))
  2922. set(handles.segchoice,'Value',varEM(fstr,'segchoice',1))
  2923. set(handles.segsize,'String',varEM(fstr,'segsize',0))
  2924. set(handles.invertopt,'Value',varEM(fstr,'invertopt',1))
  2925. set(handles.BLopt,'Value',varEM(fstr,'BLopt',1))
  2926. set(handles.tfilt,'Value',varEM(fstr,'tfilt',1))
  2927. set(handles.minpeak,'String',varEM(fstr,'minpeak',0))
  2928. set(handles.peakhigh,'String',varEM(fstr,'peakhigh',0))
  2929. set(handles.minnum,'String',varEM(fstr,'minnum',0))
  2930. set(handles.minbound,'String',varEM(fstr,'minbound',0))
  2931. set(handles.beforeGUI,'String',varEM(fstr,'beforeGUI',0))
  2932. set(handles.afterGUI,'String',varEM(fstr,'afterGUI',0))
  2933. set(handles.apdbl,'Value',varEM(fstr,'apdbl',1))
  2934. set(handles.apdblnum,'String',varEM(fstr,'apdblnum',0))
  2935. set(handles.aptime1,'Value',varEM(fstr,'aptime1',1))
  2936. set(handles.taustart,'String',varEM(fstr,'taustart',0))
  2937. set(handles.taufinish,'String',varEM(fstr,'taufinish',0))
  2938. set(handles.r2cut,'String',varEM(fstr,'r2cut',0))
  2939. set(handles.velalgo,'Value',varEM(fstr,'velalgo',1))
  2940. set(handles.isoopt,'Value',varEM(fstr,'isoopt',1))
  2941. set(handles.isomin,'String',varEM(fstr,'isomin',0))
  2942. set(handles.isomax,'String',varEM(fstr,'isomax',0))
  2943. set(handles.actfittimes,'Value',varEM(fstr,'actfittimes',1))
  2944. set(handles.MINt,'String',varEM(fstr,'MINt',0))
  2945. set(handles.MAXt,'String',varEM(fstr,'MAXt',0))
  2946. set(handles.velout,'Value',varEM(fstr,'velout',1))
  2947. set(handles.minvel,'String',varEM(fstr,'minvel',0))
  2948. set(handles.maxvel,'String',varEM(fstr,'maxvel',0))
  2949. set(handles.winsize,'String',varEM(fstr,'winsize',0))
  2950. set(handles.scal,'String',varEM(fstr,'scal',0))
  2951. set(handles.wint,'String',varEM(fstr,'wint',0))
  2952. set(handles.apdout,'Value',varEM(fstr,'apdout',1))
  2953. set(handles.apdscale,'Value',varEM(fstr,'apdscale',1))
  2954. set(handles.cmin,'String',varEM(fstr,'cmin',0))
  2955. set(handles.cmax,'String',varEM(fstr,'cmax',0))
  2956. set(handles.t,'String',varEM(fstr,'t',0))
  2957. set(handles.checkbox8,'Value',varEM(fstr,'checkbox8',1))
  2958. set(handles.actmin,'String',varEM(fstr,'actmin',0))
  2959. set(handles.actmax,'String',varEM(fstr,'actmax',0))
  2960. set(handles.binnumber,'String',varEM(fstr,'binnumber',0))
  2961. set(handles.thlen,'String',varEM(fstr,'thlen',0))
  2962. end
  2963. function thlen_Callback(~, ~, ~)
  2964. % --- Executes during object creation, after setting all properties.
  2965. function thlen_CreateFcn(hObject, ~, ~)
  2966. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2967. set(hObject,'BackgroundColor','white');
  2968. end
  2969. % --- Executes on selection change in colmap.
  2970. function colmap_Callback(hObject, eventdata, handles)
  2971. handles = guidata(hObject);
  2972. Mapchoice_Callback(hObject, eventdata, handles)
  2973. % --- Executes during object creation, after setting all properties.
  2974. function colmap_CreateFcn(hObject, ~, ~)
  2975. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  2976. set(hObject,'BackgroundColor','white');
  2977. end
  2978. % --- Executes on button press in drawcon.
  2979. function drawcon_Callback(hObject, eventdata, ~)
  2980. handles = guidata(hObject);
  2981. Mapchoice_Callback(hObject, eventdata, handles)
  2982. % --- Executes on button press in roibutton.
  2983. function roibutton_Callback(hObject, eventdata, ~)
  2984. handles = guidata(hObject);
  2985. choice = questdlg('Save Current ROI or load previous?', ...
  2986. 'ROI', ...
  2987. 'Save ROI','Load ROI','Save ROI');
  2988. % Handle response
  2989. switch choice
  2990. case 'Save ROI'
  2991. [filename,pathname] = uiputfile({'*.txt'}, 'Save ROI in text file');
  2992. file=[pathname,filename];
  2993. savemask=handles.mask;
  2994. figure,
  2995. imshow(savemask,[])
  2996. dlmwrite(file,savemask);
  2997. lmask=maskload(file)
  2998. figure,
  2999. imshow(lmask,[])
  3000. size(savemask)
  3001. size(lmask)
  3002. case 'Load ROI'
  3003. [filename,pathname] = uigetfile('*.txt','Select the ROI File');
  3004. file=[pathname,filename];
  3005. handles.loadedmask=maskload(file)
  3006. handles.herefromroiload=1;
  3007. guidata(hObject, handles);
  3008. pushload_Callback(hObject, eventdata, handles)
  3009. handles = guidata(hObject); %%update handles after doing OMimload
  3010. handles.herefromroiload=0;
  3011. guidata(hObject, handles);
  3012. end
  3013. guidata(hObject, handles);
  3014. % --- Executes on button press in rawvid.
  3015. function rawvid_Callback(hObject, ~, ~)
  3016. handles = guidata(hObject);
  3017. axes(handles.imageaxes)
  3018. [rows, cols]=size(handles.im);
  3019. images=handles.images;
  3020. mask=handles.mask;
  3021. images=imcomplement(images);
  3022. im=handles.im;
  3023. im=double(im);
  3024. im=im-min(min(im));
  3025. im=im./max(max(im));
  3026. im=im*65535;
  3027. im=uint16(im);
  3028. savegif=1;
  3029. if savegif == 1
  3030. [a,b]=uiputfile('*.gif');
  3031. filename=[b,a];
  3032. end
  3033. prompt = {'Fluorescence threshold (0-1):','Video Start (s):','Video End (s)','Normalise? (0=no, 1=yes)'};
  3034. dlg_title = 'Raw Video Options';
  3035. num_lines = 1;
  3036. exposure=1/str2double(get(handles.framerate,'String'));
  3037. defaultans = {'0.2','0',num2str(size(images,3)/1000*exposure),'1'};
  3038. opts = inputdlg(prompt,dlg_title,num_lines,defaultans);
  3039. flthresh=str2double(opts{1});
  3040. istart=str2double(opts{2});
  3041. iend=str2double(opts{3});
  3042. normF=str2double(opts{4});
  3043. %change is to frame #
  3044. istart=round((istart/exposure)*1000);
  3045. iend=round((iend/exposure)*1000);
  3046. if istart == 0
  3047. istart = 1;
  3048. end
  3049. if iend > size(images,3)
  3050. iend = size(images,3);
  3051. end
  3052. for r=1:rows
  3053. for c=1:cols
  3054. sig=squeeze(images(r,c,:));
  3055. sig=sig-min(sig);
  3056. sig=double(sig);
  3057. if normF == 1
  3058. sig=(sig./max(sig))*65535;
  3059. end
  3060. sig=uint16(sig);
  3061. images(r,c,:)=sig;
  3062. end
  3063. end
  3064. wb=waitbar(0,'Saving Raw Video');
  3065. images=double(images);
  3066. mask=double(mask);
  3067. maxval=max(max(max(images)));
  3068. background = repmat(im, [1, 1, 3]);
  3069. for i =istart:iend
  3070. waitbar(i/(iend-istart),wb,'Saving Raw Video');
  3071. combinedImage = background;
  3072. foreground=images(:,:,i).*mask;
  3073. foreground=foreground./maxval;
  3074. foreground(foreground < flthresh) = 0;
  3075. foregroundColourised = colouriseData(foreground, 'j',flthresh,1);
  3076. c1 = combinedImage(:, :, 1);
  3077. c2 = combinedImage(:, :, 2);
  3078. c3 = combinedImage(:, :, 3);
  3079. f1 = foregroundColourised(:, :, 1);
  3080. f2 = foregroundColourised(:, :, 2);
  3081. f3 = foregroundColourised(:, :, 3);
  3082. c1(sum(foreground, 3) ~= 0) = f1(sum(foreground, 3) ~= 0);
  3083. c2(sum(foreground, 3) ~= 0) = f2(sum(foreground, 3) ~= 0);
  3084. c3(sum(foreground, 3) ~= 0) = f3(sum(foreground, 3) ~= 0);
  3085. combinedImage(:, :, 1) = c1;
  3086. combinedImage(:, :, 2) = c2;
  3087. combinedImage(:, :, 3) = c3;
  3088. hold on
  3089. axis image;
  3090. axis off;
  3091. if savegif == 1
  3092. delay=0.01;
  3093. [imind,cm] = rgb2ind(combinedImage,256);
  3094. % Write to the GIF File
  3095. if i == istart
  3096. imwrite(imind,cm,filename,'gif', 'Loopcount',inf,'DelayTime',delay);
  3097. else
  3098. imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',delay);
  3099. end
  3100. end
  3101. end
  3102. delete(wb)
  3103. % --- Executes on button press in resegment.
  3104. function resegment_Callback(hObject, eventdata, handles)
  3105. handles.herefromsegmentpush=1;
  3106. guidata(hObject, handles);
  3107. pushprocess_Callback(hObject, eventdata, handles)
  3108. handles = guidata(hObject);
  3109. handles.herefromsegmentpush = 0;
  3110. guidata(hObject, handles);
  3111. producemaps_Callback(hObject, eventdata, handles)
  3112. handles = guidata(hObject);
  3113. guidata(hObject, handles);
  3114. % --- Executes on button press in B2B.
  3115. function B2B_Callback(hObject, eventdata, handles)
  3116. handles.herefromsegmentpush=1;
  3117. set(handles.segsize,'String',1);
  3118. set(handles.segchoice,'Value',2);
  3119. guidata(hObject, handles);
  3120. pushprocess_Callback(hObject, eventdata, handles)
  3121. handles = guidata(hObject);
  3122. handles.herefromsegmentpush = 0;
  3123. guidata(hObject, handles);
  3124. producemaps_Callback(hObject, eventdata, handles)
  3125. handles = guidata(hObject);
  3126. guidata(hObject, handles);
  3127. % --- Executes on selection change in winopt.
  3128. function winopt_Callback(~, ~, ~)
  3129. % --- Executes during object creation, after setting all properties.
  3130. function winopt_CreateFcn(hObject, ~, ~)
  3131. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  3132. set(hObject,'BackgroundColor','white');
  3133. end
  3134. % --- Executes on selection change in segsignal.
  3135. function segsignal_Callback(hObject, eventdata, handles)
  3136. handles.herefromsegmentpush=1;
  3137. guidata(hObject, handles);
  3138. pushprocess_Callback(hObject, eventdata, handles)
  3139. handles = guidata(hObject);
  3140. % --- Executes during object creation, after setting all properties.
  3141. function segsignal_CreateFcn(hObject, ~, ~)
  3142. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  3143. set(hObject,'BackgroundColor','white');
  3144. end
  3145. function sfiltsigma_Callback(~, ~, ~)
  3146. % --- Executes during object creation, after setting all properties.
  3147. function sfiltsigma_CreateFcn(hObject, ~, ~)
  3148. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  3149. set(hObject,'BackgroundColor','white');
  3150. end
  3151. % --- Executes on selection change in usespline.
  3152. function usespline_Callback(~, ~, ~)
  3153. % --- Executes during object creation, after setting all properties.
  3154. function usespline_CreateFcn(hObject, ~, ~)
  3155. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  3156. set(hObject,'BackgroundColor','white');
  3157. end
  3158. function splineN_Callback(~, ~, ~)
  3159. % --- Executes during object creation, after setting all properties.
  3160. function splineN_CreateFcn(hObject, ~, ~)
  3161. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  3162. set(hObject,'BackgroundColor','white');
  3163. end
  3164. % --- Executes on button press in pushbutton35.
  3165. function pushbutton35_Callback(~, ~, ~)
  3166. % --------------------------------------------------------------------
  3167. function freqmapopt_Callback(hObject, eventdata, ~)
  3168. handles = guidata(hObject);
  3169. prompt = {'Minimum Frequency (Hz):','Maximum Frequency (Hz):','Frequency Bin Size (Hz)','Window? 0 = no, 1 = hann'};
  3170. dims = [1 35];
  3171. definput = {num2str(handles.fmin),num2str(handles.fmax),num2str(handles.fbin),num2str(handles.dfwin)};
  3172. answer = inputdlg(prompt,'Frequnecy Mapping Options',dims,definput)
  3173. handles.fmin=str2double(answer{1});
  3174. handles.fmax=str2double(answer{2});
  3175. handles.fbin=str2double(answer{3});
  3176. handles.dfwin=str2double(answer{4});
  3177. guidata(hObject, handles);
  3178. if get(handles.Mapchoice,'Value') == 5;
  3179. Mapchoice_Callback(hObject, eventdata, handles)
  3180. end
  3181. guidata(hObject, handles);
  3182. % --------------------------------------------------------------------
  3183. function ROInum_Callback(hObject, ~, ~)
  3184. handles = guidata(hObject);
  3185. prompt = {'Number of ROIs:','Remove overlapping pixels? (0=Yes) (1=No)'};
  3186. dims = [1 35];
  3187. definput = {num2str(handles.roinum),num2str(handles.roisum)};
  3188. answer = inputdlg(prompt,'ROI options',dims,definput)
  3189. handles.roinum=str2double(answer{1});
  3190. handles.roisum=str2double(answer{2});
  3191. guidata(hObject, handles);
  3192. % --------------------------------------------------------------------
  3193. function Untitled_1_Callback(~, ~, ~)
  3194. % --------------------------------------------------------------------
  3195. function Untitled_5_Callback(~, ~, ~)
  3196. %% ColourMaps
  3197. function coljet_Callback(hObject, eventdata, ~)
  3198. handles = guidata(hObject);
  3199. set(handles.colmap,'Value',1);
  3200. Mapchoice_Callback(hObject, eventdata, handles)
  3201. guidata(hObject, handles);
  3202. % --------------------------------------------------------------------
  3203. function colhsv_Callback(hObject, eventdata, ~)
  3204. handles = guidata(hObject);
  3205. set(handles.colmap,'Value',2);
  3206. Mapchoice_Callback(hObject, eventdata, handles)
  3207. guidata(hObject, handles);
  3208. % --------------------------------------------------------------------
  3209. function colhot_Callback(hObject, eventdata, ~)
  3210. handles = guidata(hObject);
  3211. set(handles.colmap,'Value',3);
  3212. Mapchoice_Callback(hObject, eventdata, handles)
  3213. guidata(hObject, handles);
  3214. % --------------------------------------------------------------------
  3215. function colcool_Callback(hObject, eventdata, ~)
  3216. handles = guidata(hObject);
  3217. set(handles.colmap,'Value',4);
  3218. Mapchoice_Callback(hObject, eventdata, handles)
  3219. guidata(hObject, handles);
  3220. % --------------------------------------------------------------------
  3221. function colparula_Callback(hObject, eventdata, ~)
  3222. handles = guidata(hObject);
  3223. set(handles.colmap,'Value',5);
  3224. Mapchoice_Callback(hObject, eventdata, handles)
  3225. guidata(hObject, handles);
  3226. % --------------------------------------------------------------------
  3227. function colspring_Callback(hObject, eventdata, ~)
  3228. handles = guidata(hObject);
  3229. set(handles.colmap,'Value',6);
  3230. Mapchoice_Callback(hObject, eventdata, handles)
  3231. guidata(hObject, handles);
  3232. % --------------------------------------------------------------------
  3233. function colsummer_Callback(hObject, eventdata, ~)
  3234. handles = guidata(hObject);
  3235. set(handles.colmap,'Value',7);
  3236. Mapchoice_Callback(hObject, eventdata, handles)
  3237. guidata(hObject, handles);
  3238. % --------------------------------------------------------------------
  3239. function colautumn_Callback(hObject, eventdata, ~)
  3240. handles = guidata(hObject);
  3241. set(handles.colmap,'Value',8);
  3242. Mapchoice_Callback(hObject, eventdata, handles)
  3243. guidata(hObject, handles);
  3244. % --------------------------------------------------------------------
  3245. function colwinter_Callback(hObject, eventdata, ~)
  3246. handles = guidata(hObject);
  3247. set(handles.colmap,'Value',9);
  3248. Mapchoice_Callback(hObject, eventdata, handles)
  3249. guidata(hObject, handles);
  3250. % --------------------------------------------------------------------
  3251. function Untitled_3_Callback(~, ~, ~)
  3252. % --------------------------------------------------------------------
  3253. function Untitled_4_Callback(~, ~, ~)
  3254. % --------------------------------------------------------------------
  3255. function Untitled_6_Callback(~, ~, ~)
  3256. % --------------------------------------------------------------------
  3257. function bgblack_Callback(hObject, eventdata, ~)
  3258. handles = guidata(hObject);
  3259. handles.bgcol='k';
  3260. handles.bgon=1;
  3261. guidata(hObject, handles);
  3262. Mapchoice_Callback(hObject, eventdata, handles)
  3263. guidata(hObject, handles);
  3264. % --------------------------------------------------------------------
  3265. function bgwhite_Callback(hObject, eventdata, ~)
  3266. handles = guidata(hObject);
  3267. handles.bgcol='w';
  3268. handles.bgon=1;
  3269. guidata(hObject, handles);
  3270. Mapchoice_Callback(hObject, eventdata, handles)
  3271. guidata(hObject, handles);
  3272. % --------------------------------------------------------------------
  3273. function bgtran_Callback(hObject, eventdata, ~)
  3274. handles = guidata(hObject);
  3275. handles.bgon=0;
  3276. guidata(hObject, handles);
  3277. Mapchoice_Callback(hObject, eventdata, handles)
  3278. guidata(hObject, handles);
  3279. % --------------------------------------------------------------------
  3280. function snrcalc_Callback(hObject, eventdata, ~)
  3281. handles = guidata(hObject);
  3282. prompt = {'Signal before time (from peak) (ms):','Signal after time (from peak) (ms):'};
  3283. dims = [1 35];
  3284. definput = {num2str(handles.snrt1),num2str(handles.snrt2)};
  3285. answer = inputdlg(prompt,'Frequnecy Mapping Options',dims,definput);
  3286. handles.snrt1=str2double(answer{1});
  3287. handles.snrt2=str2double(answer{2});
  3288. guidata(hObject, handles);
  3289. if get(handles.Mapchoice,'Value') == 10 || get(handles.Mapchoice,'Value') == 1
  3290. Mapchoice_Callback(hObject, eventdata, handles)
  3291. end
  3292. guidata(hObject, handles);
  3293. % --------------------------------------------------------------------
  3294. function ttpset_Callback(hObject, eventdata, ~)
  3295. handles = guidata(hObject);
  3296. prompt = {'Start Point (%):','End Point (%):'};
  3297. dims = [1 35];
  3298. definput = {num2str(handles.ttpstart),num2str(handles.ttpend)};
  3299. answer = inputdlg(prompt,'Frequnecy Mapping Options',dims,definput);
  3300. handles.ttpstart=str2double(answer{1});
  3301. handles.ttpend=str2double(answer{2});
  3302. guidata(hObject, handles);
  3303. if get(handles.Mapchoice,'Value') == 7
  3304. Mapchoice_Callback(hObject, eventdata, handles)
  3305. end
  3306. guidata(hObject, handles);
  3307. % --------------------------------------------------------------------
  3308. function Untitled_7_Callback(~, ~, ~)
  3309. % --------------------------------------------------------------------
  3310. function connnnnnnnnnn_Callback(~, ~, ~)
  3311. % --------------------------------------------------------------------
  3312. function conoff_Callback(hObject, eventdata, ~)
  3313. handles = guidata(hObject);
  3314. handles.drawcon=0;
  3315. guidata(hObject, handles);
  3316. Mapchoice_Callback(hObject, eventdata, handles)
  3317. % --------------------------------------------------------------------
  3318. function conon_Callback(hObject, eventdata, ~)
  3319. handles = guidata(hObject);
  3320. handles.drawcon=1;
  3321. prompt = {'Contour spacing (map units):'};
  3322. dims = [1 35];
  3323. if isempty(handles.conbon) == 1
  3324. handles.framerate
  3325. conbount=1/str2double(get(handles.framerate,'String'));
  3326. handles.conbon=num2str(conbount);
  3327. end
  3328. definput = {num2str(handles.conbon)};
  3329. answer = inputdlg(prompt,'Contour Setting',dims,definput);
  3330. handles.conbon=answer{1};
  3331. guidata(hObject, handles);
  3332. Mapchoice_Callback(hObject, eventdata, handles)
  3333. % --------------------------------------------------------------------
  3334. function nomedifilt_Callback(hObject, eventdata, ~)
  3335. handles = guidata(hObject);
  3336. handles.medifilt=0;
  3337. guidata(hObject, handles);
  3338. Mapchoice_Callback(hObject, eventdata, handles)
  3339. % --------------------------------------------------------------------
  3340. function yesmedifilt_Callback(hObject, eventdata, ~)
  3341. handles = guidata(hObject);
  3342. handles.medifilt=1;
  3343. guidata(hObject, handles);
  3344. Mapchoice_Callback(hObject, eventdata, handles)
  3345. function squareROI_Callback(~,~,~)
  3346. % --------------------------------------------------------------------
  3347. function frameremoval_Callback(hObject, eventdata, handles)
  3348. % hObject handle to frameremoval (see GCBO)
  3349. % eventdata reserved - to be defined in a future version of MATLAB
  3350. % handles structure with handles and user data (see GUIDATA)
  3351. handles = guidata(hObject);
  3352. handles.drawcon=1;
  3353. prompt = {'Frames before pulse to remove:','Frames after pulse to remove:'};
  3354. dims = [1 35];
  3355. definput = {num2str(handles.pbefore),num2str(handles.pafter)};
  3356. answer = inputdlg(prompt,'Contour Setting',dims,definput);
  3357. handles.pbefore=str2double(answer{1});
  3358. handles.pafter=str2double(answer{2});
  3359. guidata(hObject, handles);
  3360. % --------------------------------------------------------------------
  3361. function WS_mapping_Callback(hObject, eventdata, handles)
  3362. % hObject handle to WS_mapping (see GCBO)
  3363. % eventdata reserved - to be defined in a future version of MATLAB
  3364. % handles structure with handles and user data (see GUIDATA)
  3365. handles = guidata(hObject);
  3366. prompt = {'Set similarity thershold (radians)'};
  3367. dims = [1 35];
  3368. definput = {num2str(handles.ep)};
  3369. answer = inputdlg(prompt,'Frequnecy Mapping Options',dims,definput)
  3370. handles.ep=str2num(answer{1});
  3371. guidata(hObject, handles);
  3372. if get(handles.Mapchoice,'Value') == 11;
  3373. Mapchoice_Callback(hObject, eventdata, handles)
  3374. end
  3375. guidata(hObject, handles);
  3376. % --------------------------------------------------------------------
  3377. function dFdt_mapping_Callback(hObject, eventdata, handles)
  3378. % hObject handle to dFdt_mapping (see GCBO)
  3379. % eventdata reserved - to be defined in a future version of MATLAB
  3380. % handles structure with handles and user data (see GUIDATA)
  3381. handles = guidata(hObject);
  3382. prompt = {'dFdt level','Interpolation Framerate'};
  3383. dims = [1 35];
  3384. definput = {num2str(handles.dFlevel),num2str(handles.i_framerate)};
  3385. answer = inputdlg(prompt,'dFdt options',dims,definput)
  3386. handles.dFlevel=str2double(answer{1});
  3387. handles.i_framerate=str2double(answer{2});
  3388. guidata(hObject, handles);
  3389. if get(handles.Mapchoice,'Value') == 12;
  3390. Mapchoice_Callback(hObject, eventdata, handles)
  3391. end
  3392. guidata(hObject, handles);

ElectroMap.m at commit a1fc5f2, under BSD-3-Clause · at the source

Overview

Authors: Anqi Du1, Bo Li2, Guangqi Chen3, Na Wang2, Chuanyu Li1, Shaowen Tian1, Weichao Liu3, Junqing Sun1
ORCID iDs: Junqing Sun
  1. Guangxi Key Laboratory of Brain and Cognitive Neuroscience, School of Basic Medical Sciences, Guilin Medical University, Guilin, Guangxi 541199, China
  2. Guangxi Key Laboratory of Environmental Exposomics and Entire Lifecycle Health, School of Public Health, Guilin Medical University, Guilin, Guangxi 541199, China
  3. Key Laboratory of Medical Electrophysiology of Ministry of Education, Institute of Cardiovascular Research, Department of Cardiology of the Affiliated Hospital, Southwest Medical University, 1 Xianglin Rd, Luzhou, Sichuan Province 646000, China
Journal: iScience, volume 29, issue 8, article 117048
Dates: received 3 March 2026; accepted 17 July 2026; published online 3 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1016/j.isci.2026.117048 · PMID 42597762 · PMCID PMC13470416 · OpenAlex W7172320414
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: other (modality), epilepsy (population)
Methods: Statistics, Smoothing, state filtering, decompositions, Evoked potentials, Physiology & signal measures
Keywords: epilepsy, cardiac autonomic regulation, heart rate variability, generalized seizures
Topic: Heart Rate Variability and Autonomic Control (Cardiology and Cardiovascular Medicine, Medicine), according to OpenAlex
Funding: Sichuan Province Science and Technology Support Program (2024JDRC0034); National Natural Science Foundation of China (82160642, 32360220); Guangxi Science and Technology Plan Project (GK2025GXNSFAA069809)
Citations: not cited yet (Europe PMC); 26 references in the paper
Research resources: Mouse: C57BL/6J RRID:IMSR_JAX:000664

Abstract

Epileptic seizures are associated with cardiovascular disturbances, yet how cardiac autonomic regulation changes across repeated seizures remains unclear. Here, using a pentylenetetrazol-induced murine model, we combined ECG telemetry, heart rate variability (HRV) analysis, pharmacological intervention, optical mapping, and brainstem patch-clamp recordings to characterize seizure-associated autonomic responses. Acute seizures produced transient bradyarrhythmias and increased HRV indices that were attenuated by muscarinic blockade. In contrast, repeated seizures reduced HRV and decreased the excitability of cardiac vagal neurons in the nucleus ambiguus, whereas optical mapping detected no significant intrinsic myocardial electrophysiological abnormalities. Together, these findings identify dynamic, stage-dependent alterations in cardiac autonomic regulation during recurrent generalized seizures, with distinct autonomic changes observed following acute and repeated seizure exposure.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

CXO531/ElectroMap

License: BSD-3-Clause
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: a1fc5f2ded39ec84ad49e38853b852a6fe1cc805, 25 June 2020
Languages: MATLAB (75)
Size: 98 files, 75 scripts
Software Heritage: not archived
Found in: the resources table
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
77 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 75 scripts, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data and code availability

The data reported in this paper will be shared by the lead contact upon reasonable request.

This paper does not report original code.

Any additional information required to reanalyze the data reported in this paper is available from the lead contact upon reasonable request.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 3, 28 September 2026

  • Authors: added Junqing Sun (0009-0007-4884-0585); removed Junqing Sun

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 4 keywords, 3 funders, 26 references, 1 RRID.

Cite

This paper

Du, A., Li, B., Chen, G., Wang, N., Li, C., Tian, S., Liu, W., & Sun, J. (2026). Dynamic alterations in cardiac autonomic regulation during recurrent generalized seizures. iScience, 29(8), 117048. https://doi.org/10.1016/j.isci.2026.117048

BibTeX

@article{du2026dynamic,
author = {Du, Anqi and Li, Bo and Chen, Guangqi and Wang, Na and Li, Chuanyu and Tian, Shaowen and Liu, Weichao and Sun, Junqing},
title = {{Dynamic alterations in cardiac autonomic regulation during recurrent generalized seizures}},
journal = {iScience},
year = {2026},
month = aug,
volume = {29},
number = {8},
pages = {117048},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/j.isci.2026.117048},
url = {https://doi.org/10.1016/j.isci.2026.117048},
pmid = {42597762},
pmcid = {PMC13470416}
}

RIS

TY - JOUR
AU - Du, Anqi
AU - Li, Bo
AU - Chen, Guangqi
AU - Wang, Na
AU - Li, Chuanyu
AU - Tian, Shaowen
AU - Liu, Weichao
AU - Sun, Junqing
TI - Dynamic alterations in cardiac autonomic regulation during recurrent generalized seizures
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/08/03
VL - 29
IS - 8
SP - 117048
SN - 2589-0042
PB - Elsevier
DO - 10.1016/j.isci.2026.117048
UR - https://doi.org/10.1016/j.isci.2026.117048
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.isci.2026.117048",
"type": "article-journal",
"title": "Dynamic alterations in cardiac autonomic regulation during recurrent generalized seizures",
"container-title": "iScience",
"author": [
{
"family": "Du",
"given": "Anqi"
},
{
"family": "Li",
"given": "Bo"
},
{
"family": "Chen",
"given": "Guangqi"
},
{
"family": "Wang",
"given": "Na"
},
{
"family": "Li",
"given": "Chuanyu"
},
{
"family": "Tian",
"given": "Shaowen"
},
{
"family": "Liu",
"given": "Weichao"
},
{
"family": "Sun",
"given": "Junqing"
}
],
"container-title-short": "iScience",
"volume": "29",
"issue": "8",
"page": "117048",
"DOI": "10.1016/j.isci.2026.117048",
"PMID": "42597762",
"PMCID": "PMC13470416",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.isci.2026.117048",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
3
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1007/s10548-026-01247-x [code]
Salience Network Dynamics Across Spontaneous Attacks, Interictal Rest and Interictal Pain Imagery in Menstrually Related Migraine.
Journal: Brain topography
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, epilepsy
[2] doi:10.1038/s41467-026-75345-6 [code]
Hippocampal ripples initiate cortical dimensionality expansion for memory retrieval.
Journal: Nature communications
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, epilepsy
[3] doi:10.1038/s41593-026-02258-4 [code]
Laminar organization of cellular microcircuits modulating human interictal epileptiform discharges.
Journal: Nature neuroscience
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, epilepsy
[4] doi:10.1002/hbm.70602 [code]
Neuroimaging Correlates of Post-Stroke Pain After Ischemic Stroke: Secondary Analysis of the INSPiRE-TMS Trial.
Journal: Human brain mapping
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[5] doi:10.1038/s41467-026-73787-6 [code]
Skin-attached bioadhesive patch enabling ultrasound deep brain stimulation and real-time electrophysiological monitoring for REM sleep enhancement.
Journal: Nature communications
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[6] doi:10.1038/s41467-026-72917-4 [code]
OFC-induced network modularity improves positive symptoms and attentional alertness in schizophrenia: a combined rTMS-fMRI study.
Journal: Nature communications
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[7] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[8] doi:10.1038/s41598-026-52322-z [code]
A transparent wheel-based platform for locomotion-on-demand and multi-view body and facial kinematics in head-fixed mice.
Journal: Scientific reports
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[9] doi:10.1038/s41597-026-07215-1 [code]
The Brain, Body, and Behavior Dataset (BBBD): Multimodal Recordings during Educational Videos.
Journal: Scientific data
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other
[10] doi:10.1111/psyp.70271 [code]
Disentangling Respiratory Phase-Dependent and Phase-Independent Components of Anticipatory Cardiac Deceleration.
Journal: Psychophysiology
In common: Image Processing Toolbox, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, other

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.