Tag Archives: matlab
How do I submit my Kroger Feedback?
It’s my first visit at Kroger and I want to give my feedback to Kroger. I know little bit about Kroger feedback survey, but don’t have deep knowledge. Please guys if anyone know about this customer satisfaction Kroger customer satisfaction surveyIt’s my first visit at Kroger and I want to give my feedback to Kroger. I know little bit about Kroger feedback survey, but don’t have deep knowledge. Please guys if anyone know about this customer satisfaction Kroger customer satisfaction survey It’s my first visit at Kroger and I want to give my feedback to Kroger. I know little bit about Kroger feedback survey, but don’t have deep knowledge. Please guys if anyone know about this customer satisfaction Kroger customer satisfaction survey kroger feedback, feedback survey MATLAB Answers — New Questions
cell array to string array
fp31 =’#CC’ ‘#CB’ ‘#CN’ ‘#CO’ ‘#CP’ ‘#CF’ ‘#CS’ ‘#CI’ ‘#CQ’ ‘#CW’
i have a cell array like this ..
i want to convert every single cell of the array to string.
fp31(1)=’#CC’ should be string.fp31 =’#CC’ ‘#CB’ ‘#CN’ ‘#CO’ ‘#CP’ ‘#CF’ ‘#CS’ ‘#CI’ ‘#CQ’ ‘#CW’
i have a cell array like this ..
i want to convert every single cell of the array to string.
fp31(1)=’#CC’ should be string. fp31 =’#CC’ ‘#CB’ ‘#CN’ ‘#CO’ ‘#CP’ ‘#CF’ ‘#CS’ ‘#CI’ ‘#CQ’ ‘#CW’
i have a cell array like this ..
i want to convert every single cell of the array to string.
fp31(1)=’#CC’ should be string. strings, cell arrays MATLAB Answers — New Questions
Connecting to a parallel server over the Internet
Hi,
I have managed to setup a MATLAB Parallel Server toolbox on a workstation computer and mangaged to submit jobs from my laptop. But this can only be done when the two computers are connected to the same local network. Is there a way to do this over the Internet?
Thank you.Hi,
I have managed to setup a MATLAB Parallel Server toolbox on a workstation computer and mangaged to submit jobs from my laptop. But this can only be done when the two computers are connected to the same local network. Is there a way to do this over the Internet?
Thank you. Hi,
I have managed to setup a MATLAB Parallel Server toolbox on a workstation computer and mangaged to submit jobs from my laptop. But this can only be done when the two computers are connected to the same local network. Is there a way to do this over the Internet?
Thank you. parallel server MATLAB Answers — New Questions
Error: “Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’.” This error is shown during using a custom deep layer.
I have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advanceI have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advance I have created a custom deep learning layer for my network for image classification. While using that layer with cpu the network is properly working during the training process, but when I utilize the gpu available in the workstation it is showing this error:
"Incorrect type of ‘Z’ for ‘predict’ in Layer ‘samplelayer’. Expected ‘gpuArray’, but instead was ‘single’."
‘Z’ is the variable used in the predict function which represents the output of the layer. The portion of the code which has error is shown below:
PE_1={PE_even PE_odd};
Z=single(cat(2,PE_1{:}));
Z=dlarray(Z,"CB");
If I change ‘single’ with ‘gpuArray’ the same error will show in reverse way. Can anyone help me with this? I have started the class function like this: "classdef sinusoidalPositionEncoding < nnet.layer.Layer …
& nnet.layer.Formattable …
& nnet.layer.Acceleratable"
Thanks for the help in advance digital image processing, matrix, matrix array, matrix manipulation, deep learning, machine learning, neural network, image segmentation, deep convolutional neural networks, cnn, mathematics MATLAB Answers — New Questions
zcu102: split tasks between the 4 available CPUs
Hi,
I’m doing some testing on a ZCU102. I followed a few examples and I was able to run HDL to split some programming between FPGA and CPU and run my model on the target. Based on the examples I found, as far as I understand, basically everything that is not processed via HDL goes on the CPU. The ZCU102 as a quadcore. I would like to try to split some tasks between them. I found a few examples like but when I go into Allow tasks to execute concurrently on target and I click Configure Tasks I cannot find the ZCU102 in the possible target applications and if I select custom it just shows one CPU. Is there something I’m missing? Is there an example I can follow?
thanks
MicheleHi,
I’m doing some testing on a ZCU102. I followed a few examples and I was able to run HDL to split some programming between FPGA and CPU and run my model on the target. Based on the examples I found, as far as I understand, basically everything that is not processed via HDL goes on the CPU. The ZCU102 as a quadcore. I would like to try to split some tasks between them. I found a few examples like but when I go into Allow tasks to execute concurrently on target and I click Configure Tasks I cannot find the ZCU102 in the possible target applications and if I select custom it just shows one CPU. Is there something I’m missing? Is there an example I can follow?
thanks
Michele Hi,
I’m doing some testing on a ZCU102. I followed a few examples and I was able to run HDL to split some programming between FPGA and CPU and run my model on the target. Based on the examples I found, as far as I understand, basically everything that is not processed via HDL goes on the CPU. The ZCU102 as a quadcore. I would like to try to split some tasks between them. I found a few examples like but when I go into Allow tasks to execute concurrently on target and I click Configure Tasks I cannot find the ZCU102 in the possible target applications and if I select custom it just shows one CPU. Is there something I’m missing? Is there an example I can follow?
thanks
Michele zcu102, multicore MATLAB Answers — New Questions
Jacobians using Simscape (numerical or symbolic)
I’m working with a Simscape model and I’m trying to get a numerical or possibly analytical form Jacobian for my system (given specific frames).
Actually I’m using multibody, but problem could be of general interest. Better if using geometrical approach. I know that some toolbox already perform same operation and give it using geometrical approch.
I tought using a numerical differentiation would be an answer, but is by far too complex, heavy and clumsy to carrry out for my purpose, thus I was looking for an alternative method to be used in one single run.I’m working with a Simscape model and I’m trying to get a numerical or possibly analytical form Jacobian for my system (given specific frames).
Actually I’m using multibody, but problem could be of general interest. Better if using geometrical approach. I know that some toolbox already perform same operation and give it using geometrical approch.
I tought using a numerical differentiation would be an answer, but is by far too complex, heavy and clumsy to carrry out for my purpose, thus I was looking for an alternative method to be used in one single run. I’m working with a Simscape model and I’m trying to get a numerical or possibly analytical form Jacobian for my system (given specific frames).
Actually I’m using multibody, but problem could be of general interest. Better if using geometrical approach. I know that some toolbox already perform same operation and give it using geometrical approch.
I tought using a numerical differentiation would be an answer, but is by far too complex, heavy and clumsy to carrry out for my purpose, thus I was looking for an alternative method to be used in one single run. simscape, jacobian MATLAB Answers — New Questions
How to order a Shapes object with actxserver for Excel?
I am trying to send an image I input into an Excel file to the back of the Shapes object. I have tried two different methods.
Method 1: Selection and Send to Back
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
ShapeToBack = myshapes.Item(N);
ShapeToBack.SendToBack();
The problem is that the .SendToBack function is not recognized. I did test out the Send To Back option in Excel and this did reorder the image in the myshapes. I was hoping to do that programatically, but I can’t find a way to do it in MATLAB.
Method 2: Copy Delete and Paste
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
for j = 1:N-1
ShapeToCopy = myshapes.Item(j);
ShapeToCopy.Copy();
myshapes.Item(j).Delete
objExcel.ActiveSheet.Paste();
end
The problem here is that for some reason this doesn’t change the order. The shape object at the end of myshapes stays at the end.I am trying to send an image I input into an Excel file to the back of the Shapes object. I have tried two different methods.
Method 1: Selection and Send to Back
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
ShapeToBack = myshapes.Item(N);
ShapeToBack.SendToBack();
The problem is that the .SendToBack function is not recognized. I did test out the Send To Back option in Excel and this did reorder the image in the myshapes. I was hoping to do that programatically, but I can’t find a way to do it in MATLAB.
Method 2: Copy Delete and Paste
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
for j = 1:N-1
ShapeToCopy = myshapes.Item(j);
ShapeToCopy.Copy();
myshapes.Item(j).Delete
objExcel.ActiveSheet.Paste();
end
The problem here is that for some reason this doesn’t change the order. The shape object at the end of myshapes stays at the end. I am trying to send an image I input into an Excel file to the back of the Shapes object. I have tried two different methods.
Method 1: Selection and Send to Back
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
ShapeToBack = myshapes.Item(N);
ShapeToBack.SendToBack();
The problem is that the .SendToBack function is not recognized. I did test out the Send To Back option in Excel and this did reorder the image in the myshapes. I was hoping to do that programatically, but I can’t find a way to do it in MATLAB.
Method 2: Copy Delete and Paste
objExcel = actxserver(‘Excel.Application’);
objExcel.Workbooks.Open(excelFileName);
myshapes = objExcel.ActiveSheet.Shapes;
N = myshapes.Count;
for j = 1:N-1
ShapeToCopy = myshapes.Item(j);
ShapeToCopy.Copy();
myshapes.Item(j).Delete
objExcel.ActiveSheet.Paste();
end
The problem here is that for some reason this doesn’t change the order. The shape object at the end of myshapes stays at the end. actxserver, excel shapes, excel objects, excel MATLAB Answers — New Questions
Ramp a variable with 63 elements
I have a simulink variable that has 63 elements. I would like to ramp each element in the variable proportionally from 0 to the value of the variable.
For example
A = [22 17 39 …]
B = [0 0 0 …]
Sample time = Ts = 1e-6
B = Ramp A
Maybe I need a toolkit that has a premade ramp block that takes an input and sets upper and lower limits.
Thanks,
DavidI have a simulink variable that has 63 elements. I would like to ramp each element in the variable proportionally from 0 to the value of the variable.
For example
A = [22 17 39 …]
B = [0 0 0 …]
Sample time = Ts = 1e-6
B = Ramp A
Maybe I need a toolkit that has a premade ramp block that takes an input and sets upper and lower limits.
Thanks,
David I have a simulink variable that has 63 elements. I would like to ramp each element in the variable proportionally from 0 to the value of the variable.
For example
A = [22 17 39 …]
B = [0 0 0 …]
Sample time = Ts = 1e-6
B = Ramp A
Maybe I need a toolkit that has a premade ramp block that takes an input and sets upper and lower limits.
Thanks,
David constant ramp MATLAB Answers — New Questions
Issue with Exporting High-Resolution Mineral Images from CorelDRAW for MATLAB Processing
Image Preparation: I have outlined the minerals in CorelDRAW, and the quality looks excellent within the software.
Exporting Issue: When I export the image to PNG format, the resolution becomes pixelated, making it unsuitable for further processing in my MATLAB code.
Code Requirements: My MATLAB code accepts PNG, TIFF, JPEG, and BMP formats.
PNG Issue: The resolution is poor and pixelated.
Other Formats (TIFF, JPEG, BMP): The background of the image is selected, which is not desired.
Question:
What settings should I use in CorelDRAW to export a high-resolution image in PNG format without losing quality?
How can I ensure that the background is not selected when exporting to TIFF, JPEG, or BMP formats?
Any advice or tips would be greatly appreciated!
Thank you!Image Preparation: I have outlined the minerals in CorelDRAW, and the quality looks excellent within the software.
Exporting Issue: When I export the image to PNG format, the resolution becomes pixelated, making it unsuitable for further processing in my MATLAB code.
Code Requirements: My MATLAB code accepts PNG, TIFF, JPEG, and BMP formats.
PNG Issue: The resolution is poor and pixelated.
Other Formats (TIFF, JPEG, BMP): The background of the image is selected, which is not desired.
Question:
What settings should I use in CorelDRAW to export a high-resolution image in PNG format without losing quality?
How can I ensure that the background is not selected when exporting to TIFF, JPEG, or BMP formats?
Any advice or tips would be greatly appreciated!
Thank you! Image Preparation: I have outlined the minerals in CorelDRAW, and the quality looks excellent within the software.
Exporting Issue: When I export the image to PNG format, the resolution becomes pixelated, making it unsuitable for further processing in my MATLAB code.
Code Requirements: My MATLAB code accepts PNG, TIFF, JPEG, and BMP formats.
PNG Issue: The resolution is poor and pixelated.
Other Formats (TIFF, JPEG, BMP): The background of the image is selected, which is not desired.
Question:
What settings should I use in CorelDRAW to export a high-resolution image in PNG format without losing quality?
How can I ensure that the background is not selected when exporting to TIFF, JPEG, or BMP formats?
Any advice or tips would be greatly appreciated!
Thank you! #image exporting MATLAB Answers — New Questions
Network doesn’t work on test image
Hi all.
I’m trying to use and train a pretrained network (YOLO v2) on my own dataset (80 images).
I divided my set in training, validation and test, but network works correctly only on these images and not on other images that aren’t in these set.
What can I do? I have to test my network only on the images that I have labeled?
ThanksHi all.
I’m trying to use and train a pretrained network (YOLO v2) on my own dataset (80 images).
I divided my set in training, validation and test, but network works correctly only on these images and not on other images that aren’t in these set.
What can I do? I have to test my network only on the images that I have labeled?
Thanks Hi all.
I’m trying to use and train a pretrained network (YOLO v2) on my own dataset (80 images).
I divided my set in training, validation and test, but network works correctly only on these images and not on other images that aren’t in these set.
What can I do? I have to test my network only on the images that I have labeled?
Thanks deep learning, yolov2, matlab, neural networks MATLAB Answers — New Questions
Thermal Camera Image Analyzing
Hi,I have thermal images and I need to draw weight lines for specific points:areas in the image. How to do that?Hi,I have thermal images and I need to draw weight lines for specific points:areas in the image. How to do that? Hi,I have thermal images and I need to draw weight lines for specific points:areas in the image. How to do that? thermal, outlines, contours MATLAB Answers — New Questions
Live script fprintf temporarily not printing whole line
While doing a bunch of file IO in a Live Script, and printing with fprintf, sometimes the line does not complete printing. Temporarily, it looks like the image below until the next iteration begins.
I was able to sort of recreate the effect with the code below, but what can be only a flicker in the execution of this snippet is much more noticable on my other project.
for i= 1:10
fprintf("Hello %dn",i)
B= inv(rand(3000)+ 2*eye(3000));
end
Is this a bug or am I missing something?While doing a bunch of file IO in a Live Script, and printing with fprintf, sometimes the line does not complete printing. Temporarily, it looks like the image below until the next iteration begins.
I was able to sort of recreate the effect with the code below, but what can be only a flicker in the execution of this snippet is much more noticable on my other project.
for i= 1:10
fprintf("Hello %dn",i)
B= inv(rand(3000)+ 2*eye(3000));
end
Is this a bug or am I missing something? While doing a bunch of file IO in a Live Script, and printing with fprintf, sometimes the line does not complete printing. Temporarily, it looks like the image below until the next iteration begins.
I was able to sort of recreate the effect with the code below, but what can be only a flicker in the execution of this snippet is much more noticable on my other project.
for i= 1:10
fprintf("Hello %dn",i)
B= inv(rand(3000)+ 2*eye(3000));
end
Is this a bug or am I missing something? live, script, fprinf MATLAB Answers — New Questions
Matlab code for calculating characteristics equation
I have the code below to obtain the characteristic equation of a 6by6 matrix but it giving me an error of sym
% Define a symbolic 6×6 matrix with entries as a mixture of alphabet letters and zeros
syms a b c d e f g h i j k l m n p q r s t I v w x y z
A = [-a 0 b -c d e; f -g 0 0 h 0; 0 0 -i c 0 e; 0 0 j -k 0 0; 0 0 0 l -m 0; 0 0 0 n 0 -p];
% Calculate the characteristic polynomial of the matrix A
char_eqn = charpoly(A);
disp(‘The characteristic equation of the matrix A is:’)
disp(char_eqn)I have the code below to obtain the characteristic equation of a 6by6 matrix but it giving me an error of sym
% Define a symbolic 6×6 matrix with entries as a mixture of alphabet letters and zeros
syms a b c d e f g h i j k l m n p q r s t I v w x y z
A = [-a 0 b -c d e; f -g 0 0 h 0; 0 0 -i c 0 e; 0 0 j -k 0 0; 0 0 0 l -m 0; 0 0 0 n 0 -p];
% Calculate the characteristic polynomial of the matrix A
char_eqn = charpoly(A);
disp(‘The characteristic equation of the matrix A is:’)
disp(char_eqn) I have the code below to obtain the characteristic equation of a 6by6 matrix but it giving me an error of sym
% Define a symbolic 6×6 matrix with entries as a mixture of alphabet letters and zeros
syms a b c d e f g h i j k l m n p q r s t I v w x y z
A = [-a 0 b -c d e; f -g 0 0 h 0; 0 0 -i c 0 e; 0 0 j -k 0 0; 0 0 0 l -m 0; 0 0 0 n 0 -p];
% Calculate the characteristic polynomial of the matrix A
char_eqn = charpoly(A);
disp(‘The characteristic equation of the matrix A is:’)
disp(char_eqn) syms, symbolic MATLAB Answers — New Questions
Fastest Way of Opening and Reading .csv Files (Currently using xlsread)
I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts?I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts? I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts? excel, m, .mat, conversion, xlsread, csvread MATLAB Answers — New Questions
How can I create an impulse (delta) signal in Simulink?
How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not.How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not. How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not. #simulink MATLAB Answers — New Questions
How reduce data from 3917×2 to 1868×2 without change the entire of graph?
I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis)I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis) I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis) reduce, size MATLAB Answers — New Questions
I am using a GUI already made, it is giving error of input argument is unused. I cannot run this code due the multiple error message like this. error highlights these variable
function varargout = FLIM_processing(varargin)
% FLIM_PROCESSING MATLAB code for FLIM_processing.fig
% FLIM_PROCESSING, by itself, creates a new FLIM_PROCESSING or raises the existing
% singleton*.
%
% H = FLIM_PROCESSING returns the handle to a new FLIM_PROCESSING or the handle to
% the existing singleton*.
%
% FLIM_processing(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in FLIM_processing.M with the given input arguments.
%
% FLIM_processing(‘Property’,’Value’,…) creates a new FLIM_processing or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before FLIM_processing_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to FLIM_processing_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help FLIM_processing
% Last Modified by GUIDE v2.5 13-Apr-2021 19:57:16
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @FLIM_processing_OpeningFcn, …
‘gui_OutputFcn’, @FLIM_processing_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before FLIM_processing is made visible.
function FLIM_processing_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to FLIM_processing (see VARARGIN)
% Choose default command line output for FLIM_processing
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes FLIM_processing wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = FLIM_processing_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
%% Get the NADH Image Button
% — Executes on button press in pushbutton1.
function read_NADH_intensity_Callback(~, ~, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskShowImage;
global nadhImageName;
global nadhFileName;
global nadhPathName;
% Get the location of the image
[nadhFileName, nadhPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhTextImage = importdata(strcat(nadhPathName,nadhFileName));
nadhTextImage(nadhTextImage > 1000) = 0;
nadhTextImage(:,245:256)=0;
maskShowImage = nadhTextImage;
nadhImageName = {nadhFileName,’NADH’};
% display the NADH image in axes1
maxIntensityValue = max(nadhTextImage(:));
minIntensityValue = min(nadhTextImage(:));
set(handles.slider3,’Max’,maxIntensityValue);
set(handles.slider3,’Min’,minIntensityValue);
set(handles.text19,’String’,num2str(minIntensityValue));
set(handles.text20,’String’,num2str(maxIntensityValue));
set(handles.text23,’String’,nadhFileName);
axes(handles.axes1);
imagesc(nadhTextImage)
colormap(gray)
colorbar
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
%% Get the Mask Image Button
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskImage;
global nadhThreshold;
% get the image mask
maskImage = nadhTextImage;
nadhThreshold = get(handles.edit1,’String’);
nadhThreshold = str2double( nadhThreshold );
maskImage(maskImage < nadhThreshold) = 0;
maskImage(maskImage~=0) = 1;
% display the mask Image axes4
axes(handles.axes4);
imagesc(maskImage)
colormap(gray)
colorbar
%% read FAD intensity image
% — Executes on button press in readFADIntensity.
function read_FAD_intensity_Callback(hObject, eventdata, handles)
% hObject handle to readFADIntensity (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadTextImage
% Get the location of the image
global fadImageName;
global fadFileName;
global fadPathName;
[fadFileName, fadPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadImageName = {fadFileName,’FAD’};
fadTextImage = importdata(strcat(fadPathName,fadFileName));
fadTextImage(fadTextImage > 1000) = 0;
fadTextImage(:,245:256)=0;
% display the NADH image in axes1
set(handles.text24,’String’,fadFileName);
axes(handles.axes2);
imagesc(fadTextImage)
colormap(gray)
colorbar
%% Read NADH T1 Image
% — Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
% Get the location of the image
[nadhT1FileName, nadhT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes during object deletion, before destroying properties.
function edit1_DeleteFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Calculate Redox Ratio Button
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
redoxRatioImage = nadhTextImage./(nadhTextImage + fadTextImage);
axes(handles.axes6);
imagesc(redoxRatioImage)
colormap(gray)
colorbar
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton6.
function pushbutton6_Callback(~, ~, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
global maskImage;
global redoxRatio;
nadhIntensityImage = nadhTextImage.* maskImage;
fadIntensityImage = fadTextImage.* maskImage;
axes(handles.axes1);
imagesc(nadhIntensityImage)
colormap(gray)
colorbar
axes(handles.axes2);
imagesc(fadIntensityImage)
colormap(gray)
colorbar
redoxRatioIntensityImage = redoxRatioImage.* maskImage;
axes(handles.axes6);
imagesc(redoxRatioIntensityImage)
colormap(gray)
colorbar
redoxRatio = mean(redoxRatioIntensityImage(redoxRatioIntensityImage~=0),’omitnan’);
set(handles.edit2 , ‘String’, num2str(redoxRatio));
%% Read NADH T2 Image and display
% — Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT2Image;
% Get the location of the image
[nadhT2FileName, nadhT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
%% Read NADH alpha Image and display
% — Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhAlphaImage;
% Get the location of the image
[nadhAlphaFileName, nadhAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
%% Calculate NADH FLIM mean
% — Executes on button press in pushbutton9.
function pushbutton9_Callback(~, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
global nadhT2Image;
global nadhAlphaImage;
global maskImage;
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
nadhFLIMMImage = (nadhT1Image.* nadhAlphaImage + nadhT2Image.*(100 – nadhAlphaImage))/100;
nadhFLIMMImageM = nadhFLIMMImage .* maskImage;
nadhAlphaImageM = nadhAlphaImage.* maskImage;
nadhT2ImageM = nadhT2Image .* maskImage;
nadhT1ImageM = nadhT1Image .* maskImage;
nadhAlphaMean = mean(nadhAlphaImageM(nadhAlphaImageM~=0),’omitnan’);
nadhT2Mean = mean(nadhT2ImageM(nadhT2ImageM~=0),’omitnan’);
nadhT1Mean = mean(nadhT1ImageM(nadhT1ImageM~=0),’omitnan’);
nadhFLIMMMean = mean(nadhFLIMMImageM(nadhFLIMMImageM~=0),’omitnan’);
set(handles.edit3 , ‘String’, num2str(nadhT1Mean));
set(handles.edit4 , ‘String’, num2str(nadhT2Mean));
set(handles.edit5 , ‘String’, num2str(nadhAlphaMean));
set(handles.edit6 , ‘String’, num2str(nadhFLIMMMean));
axes(handles.axes7);
imagesc(nadhT1ImageM)
colormap(gray)
colorbar
axes(handles.axes8);
imagesc(nadhT2ImageM)
colormap(gray)
colorbar
axes(handles.axes9);
imagesc(nadhAlphaImageM)
colormap(gray)
colorbar
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, ~, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Read FAD T1 image and display
% — Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
% Get the location of the image
[fadT1FileName, fadT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
% — Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, ~, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT2Image;
% Get the location of the image
[fadT2FileName, fadT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName);
% — Executes on button press in pushbutton12.
function pushbutton12_Callback(~, ~, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadAlphaImage;
% Get the location of the image
[fadAplhaFileName, fadAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName);
% — Executes on button press in pushbutton13.
function pushbutton13_Callback(~, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
global fadT2Image;
global fadAlphaImage;
global maskImage
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
fadFLIMMImage = (fadT1Image.* fadAlphaImage + fadT2Image.*(100 – fadAlphaImage))/100;
fadFLIMMImageM = fadFLIMMImage .* maskImage;
fadAlphaImageM = fadAlphaImage.* maskImage;
fadT2ImageM = fadT2Image .* maskImage;
fadT1ImageM = fadT1Image .* maskImage;
fadAlphaMean = mean(fadAlphaImageM(fadAlphaImageM~=0),’omitnan’);
fadT2Mean = mean(fadT2ImageM(fadT2ImageM~=0),’omitnan’);
fadT1Mean = mean(fadT1ImageM(fadT1ImageM~=0),’omitnan’);
fadFLIMMMean = mean(fadFLIMMImageM(fadFLIMMImageM~=0),’omitnan’);
set(handles.edit7 , ‘String’, num2str(fadT1Mean));
set(handles.edit8 , ‘String’, num2str(fadT2Mean));
set(handles.edit9 , ‘String’, num2str(fadAlphaMean));
set(handles.edit10 , ‘String’, num2str(fadFLIMMMean));
axes(handles.axes10);
imagesc(fadT1ImageM)
colormap(gray)
colorbar
axes(handles.axes11);
imagesc(fadT2ImageM)
colormap(gray)
colorbar
axes(handles.axes12);
imagesc(fadAlphaImageM)
colormap(gray)
colorbar
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit8 as text
% str2double(get(hObject,’String’)) returns contents of edit8 as a double
% — Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit9 as text
% str2double(get(hObject,’String’)) returns contents of edit9 as a double
% — Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit10 as text
% str2double(get(hObject,’String’)) returns contents of edit10 as a double
% — Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit11_Callback(~, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit11 as text
% str2double(get(hObject,’String’)) returns contents of edit11 as a double
% — Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, ~, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Select the file to save
% — Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global saveExcelLocation;
[saveExcelName, saveExcelPath] = uigetfile(‘*.xlsx’,’Pick an excel file’);
saveExcelLocation = strcat(saveExcelPath,saveExcelName);
set(handles.edit14 , ‘String’, saveExcelLocation);
function edit14_Callback(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit14 as text
% str2double(get(hObject,’String’)) returns contents of edit14 as a double
% — Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Save the data to the excel file
% — Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
global redoxRatio;
global nadhThreshold;
global saveExcelLocation;
global nadhImageName ;
global fadImageName;
nadhFlimData = [nadhThreshold,redoxRatio,nadhT1Mean,nadhT2Mean,nadhAlphaMean,nadhFLIMMMean];
fadFlimData = [fadT1Mean,fadT2Mean,fadAlphaMean,fadFLIMMMean];
excelData = xlsread(saveExcelLocation,’Sheet1′,’E:E’); % read the column of interest
lastRowNumber = length(excelData)+ 2;
nadhWriteLoc = strcat(‘C’,num2str(lastRowNumber));
nadhNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
% save NADH data to the excel file
xlswrite(saveExcelLocation,nadhFlimData,’sheet1′,nadhWriteLoc);
xlswrite(saveExcelLocation,nadhImageName,’sheet1′,nadhNameWriteLoc);
% save FAD data to the excel file
lastRowNumber = lastRowNumber + 1;
fadWriteLoc = strcat(‘E’,num2str(lastRowNumber));
fadNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
xlswrite(saveExcelLocation,fadFlimData,’sheet1′,fadWriteLoc);
xlswrite(saveExcelLocation,fadImageName,’sheet1′,fadNameWriteLoc);
% — Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider
global nadhThreshold;
global maskShowImage;
global nadhTextImage
nadhThreshold = get(handles.slider3 ,’Value’);
% get the image mask
maskShowImage = nadhTextImage;
maskShowImage(maskShowImage < nadhThreshold) = 0;
set(handles.edit1 , ‘String’, num2str(nadhThreshold));
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
% — Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
% — Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton17 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhFileName;
global nadhPathName;
global nadhT1Image;
% Get the location of the image
nadhT1FileName = strrep(nadhFileName,’photons’,’t1′);
nadhT1PathName = nadhPathName;
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
global nadhT2Image;
% Get the location of the image
nadhT2FileName = strrep(nadhFileName,’photons’,’t2′);
nadhT2PathName = nadhPathName;
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
global nadhAlphaImage;
% Get the location of the image
nadhAlphaFileName = strrep(nadhFileName,’photons’,’a1[%]’);
nadhAlphaPathName = nadhPathName;
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
global fadFileName;
global fadPathName;
global fadT1Image;
% Get the location of the image
fadT1FileName = strrep(fadFileName,’photons’,’t1′);
fadT1PathName = fadPathName;
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
global fadT2Image;
% Get the location of the image
fadT2FileName = strrep(fadFileName,’photons’,’t2′);
fadT2PathName = fadPathName;
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName)
global fadAlphaImage;
% Get the location of the image
fadAplhaFileName = strrep(fadFileName,’photons’,’a1[%]’);
fadAlphaPathName = fadPathName;
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName);function varargout = FLIM_processing(varargin)
% FLIM_PROCESSING MATLAB code for FLIM_processing.fig
% FLIM_PROCESSING, by itself, creates a new FLIM_PROCESSING or raises the existing
% singleton*.
%
% H = FLIM_PROCESSING returns the handle to a new FLIM_PROCESSING or the handle to
% the existing singleton*.
%
% FLIM_processing(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in FLIM_processing.M with the given input arguments.
%
% FLIM_processing(‘Property’,’Value’,…) creates a new FLIM_processing or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before FLIM_processing_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to FLIM_processing_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help FLIM_processing
% Last Modified by GUIDE v2.5 13-Apr-2021 19:57:16
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @FLIM_processing_OpeningFcn, …
‘gui_OutputFcn’, @FLIM_processing_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before FLIM_processing is made visible.
function FLIM_processing_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to FLIM_processing (see VARARGIN)
% Choose default command line output for FLIM_processing
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes FLIM_processing wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = FLIM_processing_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
%% Get the NADH Image Button
% — Executes on button press in pushbutton1.
function read_NADH_intensity_Callback(~, ~, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskShowImage;
global nadhImageName;
global nadhFileName;
global nadhPathName;
% Get the location of the image
[nadhFileName, nadhPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhTextImage = importdata(strcat(nadhPathName,nadhFileName));
nadhTextImage(nadhTextImage > 1000) = 0;
nadhTextImage(:,245:256)=0;
maskShowImage = nadhTextImage;
nadhImageName = {nadhFileName,’NADH’};
% display the NADH image in axes1
maxIntensityValue = max(nadhTextImage(:));
minIntensityValue = min(nadhTextImage(:));
set(handles.slider3,’Max’,maxIntensityValue);
set(handles.slider3,’Min’,minIntensityValue);
set(handles.text19,’String’,num2str(minIntensityValue));
set(handles.text20,’String’,num2str(maxIntensityValue));
set(handles.text23,’String’,nadhFileName);
axes(handles.axes1);
imagesc(nadhTextImage)
colormap(gray)
colorbar
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
%% Get the Mask Image Button
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskImage;
global nadhThreshold;
% get the image mask
maskImage = nadhTextImage;
nadhThreshold = get(handles.edit1,’String’);
nadhThreshold = str2double( nadhThreshold );
maskImage(maskImage < nadhThreshold) = 0;
maskImage(maskImage~=0) = 1;
% display the mask Image axes4
axes(handles.axes4);
imagesc(maskImage)
colormap(gray)
colorbar
%% read FAD intensity image
% — Executes on button press in readFADIntensity.
function read_FAD_intensity_Callback(hObject, eventdata, handles)
% hObject handle to readFADIntensity (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadTextImage
% Get the location of the image
global fadImageName;
global fadFileName;
global fadPathName;
[fadFileName, fadPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadImageName = {fadFileName,’FAD’};
fadTextImage = importdata(strcat(fadPathName,fadFileName));
fadTextImage(fadTextImage > 1000) = 0;
fadTextImage(:,245:256)=0;
% display the NADH image in axes1
set(handles.text24,’String’,fadFileName);
axes(handles.axes2);
imagesc(fadTextImage)
colormap(gray)
colorbar
%% Read NADH T1 Image
% — Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
% Get the location of the image
[nadhT1FileName, nadhT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes during object deletion, before destroying properties.
function edit1_DeleteFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Calculate Redox Ratio Button
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
redoxRatioImage = nadhTextImage./(nadhTextImage + fadTextImage);
axes(handles.axes6);
imagesc(redoxRatioImage)
colormap(gray)
colorbar
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton6.
function pushbutton6_Callback(~, ~, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
global maskImage;
global redoxRatio;
nadhIntensityImage = nadhTextImage.* maskImage;
fadIntensityImage = fadTextImage.* maskImage;
axes(handles.axes1);
imagesc(nadhIntensityImage)
colormap(gray)
colorbar
axes(handles.axes2);
imagesc(fadIntensityImage)
colormap(gray)
colorbar
redoxRatioIntensityImage = redoxRatioImage.* maskImage;
axes(handles.axes6);
imagesc(redoxRatioIntensityImage)
colormap(gray)
colorbar
redoxRatio = mean(redoxRatioIntensityImage(redoxRatioIntensityImage~=0),’omitnan’);
set(handles.edit2 , ‘String’, num2str(redoxRatio));
%% Read NADH T2 Image and display
% — Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT2Image;
% Get the location of the image
[nadhT2FileName, nadhT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
%% Read NADH alpha Image and display
% — Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhAlphaImage;
% Get the location of the image
[nadhAlphaFileName, nadhAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
%% Calculate NADH FLIM mean
% — Executes on button press in pushbutton9.
function pushbutton9_Callback(~, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
global nadhT2Image;
global nadhAlphaImage;
global maskImage;
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
nadhFLIMMImage = (nadhT1Image.* nadhAlphaImage + nadhT2Image.*(100 – nadhAlphaImage))/100;
nadhFLIMMImageM = nadhFLIMMImage .* maskImage;
nadhAlphaImageM = nadhAlphaImage.* maskImage;
nadhT2ImageM = nadhT2Image .* maskImage;
nadhT1ImageM = nadhT1Image .* maskImage;
nadhAlphaMean = mean(nadhAlphaImageM(nadhAlphaImageM~=0),’omitnan’);
nadhT2Mean = mean(nadhT2ImageM(nadhT2ImageM~=0),’omitnan’);
nadhT1Mean = mean(nadhT1ImageM(nadhT1ImageM~=0),’omitnan’);
nadhFLIMMMean = mean(nadhFLIMMImageM(nadhFLIMMImageM~=0),’omitnan’);
set(handles.edit3 , ‘String’, num2str(nadhT1Mean));
set(handles.edit4 , ‘String’, num2str(nadhT2Mean));
set(handles.edit5 , ‘String’, num2str(nadhAlphaMean));
set(handles.edit6 , ‘String’, num2str(nadhFLIMMMean));
axes(handles.axes7);
imagesc(nadhT1ImageM)
colormap(gray)
colorbar
axes(handles.axes8);
imagesc(nadhT2ImageM)
colormap(gray)
colorbar
axes(handles.axes9);
imagesc(nadhAlphaImageM)
colormap(gray)
colorbar
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, ~, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Read FAD T1 image and display
% — Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
% Get the location of the image
[fadT1FileName, fadT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
% — Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, ~, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT2Image;
% Get the location of the image
[fadT2FileName, fadT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName);
% — Executes on button press in pushbutton12.
function pushbutton12_Callback(~, ~, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadAlphaImage;
% Get the location of the image
[fadAplhaFileName, fadAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName);
% — Executes on button press in pushbutton13.
function pushbutton13_Callback(~, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
global fadT2Image;
global fadAlphaImage;
global maskImage
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
fadFLIMMImage = (fadT1Image.* fadAlphaImage + fadT2Image.*(100 – fadAlphaImage))/100;
fadFLIMMImageM = fadFLIMMImage .* maskImage;
fadAlphaImageM = fadAlphaImage.* maskImage;
fadT2ImageM = fadT2Image .* maskImage;
fadT1ImageM = fadT1Image .* maskImage;
fadAlphaMean = mean(fadAlphaImageM(fadAlphaImageM~=0),’omitnan’);
fadT2Mean = mean(fadT2ImageM(fadT2ImageM~=0),’omitnan’);
fadT1Mean = mean(fadT1ImageM(fadT1ImageM~=0),’omitnan’);
fadFLIMMMean = mean(fadFLIMMImageM(fadFLIMMImageM~=0),’omitnan’);
set(handles.edit7 , ‘String’, num2str(fadT1Mean));
set(handles.edit8 , ‘String’, num2str(fadT2Mean));
set(handles.edit9 , ‘String’, num2str(fadAlphaMean));
set(handles.edit10 , ‘String’, num2str(fadFLIMMMean));
axes(handles.axes10);
imagesc(fadT1ImageM)
colormap(gray)
colorbar
axes(handles.axes11);
imagesc(fadT2ImageM)
colormap(gray)
colorbar
axes(handles.axes12);
imagesc(fadAlphaImageM)
colormap(gray)
colorbar
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit8 as text
% str2double(get(hObject,’String’)) returns contents of edit8 as a double
% — Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit9 as text
% str2double(get(hObject,’String’)) returns contents of edit9 as a double
% — Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit10 as text
% str2double(get(hObject,’String’)) returns contents of edit10 as a double
% — Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit11_Callback(~, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit11 as text
% str2double(get(hObject,’String’)) returns contents of edit11 as a double
% — Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, ~, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Select the file to save
% — Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global saveExcelLocation;
[saveExcelName, saveExcelPath] = uigetfile(‘*.xlsx’,’Pick an excel file’);
saveExcelLocation = strcat(saveExcelPath,saveExcelName);
set(handles.edit14 , ‘String’, saveExcelLocation);
function edit14_Callback(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit14 as text
% str2double(get(hObject,’String’)) returns contents of edit14 as a double
% — Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Save the data to the excel file
% — Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
global redoxRatio;
global nadhThreshold;
global saveExcelLocation;
global nadhImageName ;
global fadImageName;
nadhFlimData = [nadhThreshold,redoxRatio,nadhT1Mean,nadhT2Mean,nadhAlphaMean,nadhFLIMMMean];
fadFlimData = [fadT1Mean,fadT2Mean,fadAlphaMean,fadFLIMMMean];
excelData = xlsread(saveExcelLocation,’Sheet1′,’E:E’); % read the column of interest
lastRowNumber = length(excelData)+ 2;
nadhWriteLoc = strcat(‘C’,num2str(lastRowNumber));
nadhNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
% save NADH data to the excel file
xlswrite(saveExcelLocation,nadhFlimData,’sheet1′,nadhWriteLoc);
xlswrite(saveExcelLocation,nadhImageName,’sheet1′,nadhNameWriteLoc);
% save FAD data to the excel file
lastRowNumber = lastRowNumber + 1;
fadWriteLoc = strcat(‘E’,num2str(lastRowNumber));
fadNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
xlswrite(saveExcelLocation,fadFlimData,’sheet1′,fadWriteLoc);
xlswrite(saveExcelLocation,fadImageName,’sheet1′,fadNameWriteLoc);
% — Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider
global nadhThreshold;
global maskShowImage;
global nadhTextImage
nadhThreshold = get(handles.slider3 ,’Value’);
% get the image mask
maskShowImage = nadhTextImage;
maskShowImage(maskShowImage < nadhThreshold) = 0;
set(handles.edit1 , ‘String’, num2str(nadhThreshold));
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
% — Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
% — Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton17 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhFileName;
global nadhPathName;
global nadhT1Image;
% Get the location of the image
nadhT1FileName = strrep(nadhFileName,’photons’,’t1′);
nadhT1PathName = nadhPathName;
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
global nadhT2Image;
% Get the location of the image
nadhT2FileName = strrep(nadhFileName,’photons’,’t2′);
nadhT2PathName = nadhPathName;
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
global nadhAlphaImage;
% Get the location of the image
nadhAlphaFileName = strrep(nadhFileName,’photons’,’a1[%]’);
nadhAlphaPathName = nadhPathName;
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
global fadFileName;
global fadPathName;
global fadT1Image;
% Get the location of the image
fadT1FileName = strrep(fadFileName,’photons’,’t1′);
fadT1PathName = fadPathName;
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
global fadT2Image;
% Get the location of the image
fadT2FileName = strrep(fadFileName,’photons’,’t2′);
fadT2PathName = fadPathName;
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName)
global fadAlphaImage;
% Get the location of the image
fadAplhaFileName = strrep(fadFileName,’photons’,’a1[%]’);
fadAlphaPathName = fadPathName;
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName); function varargout = FLIM_processing(varargin)
% FLIM_PROCESSING MATLAB code for FLIM_processing.fig
% FLIM_PROCESSING, by itself, creates a new FLIM_PROCESSING or raises the existing
% singleton*.
%
% H = FLIM_PROCESSING returns the handle to a new FLIM_PROCESSING or the handle to
% the existing singleton*.
%
% FLIM_processing(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in FLIM_processing.M with the given input arguments.
%
% FLIM_processing(‘Property’,’Value’,…) creates a new FLIM_processing or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before FLIM_processing_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to FLIM_processing_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help FLIM_processing
% Last Modified by GUIDE v2.5 13-Apr-2021 19:57:16
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @FLIM_processing_OpeningFcn, …
‘gui_OutputFcn’, @FLIM_processing_OutputFcn, …
‘gui_LayoutFcn’, [] , …
‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT
% — Executes just before FLIM_processing is made visible.
function FLIM_processing_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to FLIM_processing (see VARARGIN)
% Choose default command line output for FLIM_processing
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes FLIM_processing wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = FLIM_processing_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
%% Get the NADH Image Button
% — Executes on button press in pushbutton1.
function read_NADH_intensity_Callback(~, ~, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskShowImage;
global nadhImageName;
global nadhFileName;
global nadhPathName;
% Get the location of the image
[nadhFileName, nadhPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhTextImage = importdata(strcat(nadhPathName,nadhFileName));
nadhTextImage(nadhTextImage > 1000) = 0;
nadhTextImage(:,245:256)=0;
maskShowImage = nadhTextImage;
nadhImageName = {nadhFileName,’NADH’};
% display the NADH image in axes1
maxIntensityValue = max(nadhTextImage(:));
minIntensityValue = min(nadhTextImage(:));
set(handles.slider3,’Max’,maxIntensityValue);
set(handles.slider3,’Min’,minIntensityValue);
set(handles.text19,’String’,num2str(minIntensityValue));
set(handles.text20,’String’,num2str(maxIntensityValue));
set(handles.text23,’String’,nadhFileName);
axes(handles.axes1);
imagesc(nadhTextImage)
colormap(gray)
colorbar
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
%% Get the Mask Image Button
% — Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskImage;
global nadhThreshold;
% get the image mask
maskImage = nadhTextImage;
nadhThreshold = get(handles.edit1,’String’);
nadhThreshold = str2double( nadhThreshold );
maskImage(maskImage < nadhThreshold) = 0;
maskImage(maskImage~=0) = 1;
% display the mask Image axes4
axes(handles.axes4);
imagesc(maskImage)
colormap(gray)
colorbar
%% read FAD intensity image
% — Executes on button press in readFADIntensity.
function read_FAD_intensity_Callback(hObject, eventdata, handles)
% hObject handle to readFADIntensity (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadTextImage
% Get the location of the image
global fadImageName;
global fadFileName;
global fadPathName;
[fadFileName, fadPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadImageName = {fadFileName,’FAD’};
fadTextImage = importdata(strcat(fadPathName,fadFileName));
fadTextImage(fadTextImage > 1000) = 0;
fadTextImage(:,245:256)=0;
% display the NADH image in axes1
set(handles.text24,’String’,fadFileName);
axes(handles.axes2);
imagesc(fadTextImage)
colormap(gray)
colorbar
%% Read NADH T1 Image
% — Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
% Get the location of the image
[nadhT1FileName, nadhT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit1 as text
% str2double(get(hObject,’String’)) returns contents of edit1 as a double
% — Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes during object deletion, before destroying properties.
function edit1_DeleteFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Calculate Redox Ratio Button
% — Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
redoxRatioImage = nadhTextImage./(nadhTextImage + fadTextImage);
axes(handles.axes6);
imagesc(redoxRatioImage)
colormap(gray)
colorbar
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit2 as text
% str2double(get(hObject,’String’)) returns contents of edit2 as a double
% — Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton6.
function pushbutton6_Callback(~, ~, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
global maskImage;
global redoxRatio;
nadhIntensityImage = nadhTextImage.* maskImage;
fadIntensityImage = fadTextImage.* maskImage;
axes(handles.axes1);
imagesc(nadhIntensityImage)
colormap(gray)
colorbar
axes(handles.axes2);
imagesc(fadIntensityImage)
colormap(gray)
colorbar
redoxRatioIntensityImage = redoxRatioImage.* maskImage;
axes(handles.axes6);
imagesc(redoxRatioIntensityImage)
colormap(gray)
colorbar
redoxRatio = mean(redoxRatioIntensityImage(redoxRatioIntensityImage~=0),’omitnan’);
set(handles.edit2 , ‘String’, num2str(redoxRatio));
%% Read NADH T2 Image and display
% — Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT2Image;
% Get the location of the image
[nadhT2FileName, nadhT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
%% Read NADH alpha Image and display
% — Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhAlphaImage;
% Get the location of the image
[nadhAlphaFileName, nadhAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
%% Calculate NADH FLIM mean
% — Executes on button press in pushbutton9.
function pushbutton9_Callback(~, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
global nadhT2Image;
global nadhAlphaImage;
global maskImage;
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
nadhFLIMMImage = (nadhT1Image.* nadhAlphaImage + nadhT2Image.*(100 – nadhAlphaImage))/100;
nadhFLIMMImageM = nadhFLIMMImage .* maskImage;
nadhAlphaImageM = nadhAlphaImage.* maskImage;
nadhT2ImageM = nadhT2Image .* maskImage;
nadhT1ImageM = nadhT1Image .* maskImage;
nadhAlphaMean = mean(nadhAlphaImageM(nadhAlphaImageM~=0),’omitnan’);
nadhT2Mean = mean(nadhT2ImageM(nadhT2ImageM~=0),’omitnan’);
nadhT1Mean = mean(nadhT1ImageM(nadhT1ImageM~=0),’omitnan’);
nadhFLIMMMean = mean(nadhFLIMMImageM(nadhFLIMMImageM~=0),’omitnan’);
set(handles.edit3 , ‘String’, num2str(nadhT1Mean));
set(handles.edit4 , ‘String’, num2str(nadhT2Mean));
set(handles.edit5 , ‘String’, num2str(nadhAlphaMean));
set(handles.edit6 , ‘String’, num2str(nadhFLIMMMean));
axes(handles.axes7);
imagesc(nadhT1ImageM)
colormap(gray)
colorbar
axes(handles.axes8);
imagesc(nadhT2ImageM)
colormap(gray)
colorbar
axes(handles.axes9);
imagesc(nadhAlphaImageM)
colormap(gray)
colorbar
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit3 as text
% str2double(get(hObject,’String’)) returns contents of edit3 as a double
% — Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit4_Callback(hObject, ~, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit4 as text
% str2double(get(hObject,’String’)) returns contents of edit4 as a double
% — Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit5 as text
% str2double(get(hObject,’String’)) returns contents of edit5 as a double
% — Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit6 as text
% str2double(get(hObject,’String’)) returns contents of edit6 as a double
% — Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Read FAD T1 image and display
% — Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
% Get the location of the image
[fadT1FileName, fadT1PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
% — Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, ~, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT2Image;
% Get the location of the image
[fadT2FileName, fadT2PathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName);
% — Executes on button press in pushbutton12.
function pushbutton12_Callback(~, ~, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadAlphaImage;
% Get the location of the image
[fadAplhaFileName, fadAlphaPathName] = uigetfile(‘*.asc’,’Pick an Image’);
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName);
% — Executes on button press in pushbutton13.
function pushbutton13_Callback(~, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
global fadT2Image;
global fadAlphaImage;
global maskImage
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
fadFLIMMImage = (fadT1Image.* fadAlphaImage + fadT2Image.*(100 – fadAlphaImage))/100;
fadFLIMMImageM = fadFLIMMImage .* maskImage;
fadAlphaImageM = fadAlphaImage.* maskImage;
fadT2ImageM = fadT2Image .* maskImage;
fadT1ImageM = fadT1Image .* maskImage;
fadAlphaMean = mean(fadAlphaImageM(fadAlphaImageM~=0),’omitnan’);
fadT2Mean = mean(fadT2ImageM(fadT2ImageM~=0),’omitnan’);
fadT1Mean = mean(fadT1ImageM(fadT1ImageM~=0),’omitnan’);
fadFLIMMMean = mean(fadFLIMMImageM(fadFLIMMImageM~=0),’omitnan’);
set(handles.edit7 , ‘String’, num2str(fadT1Mean));
set(handles.edit8 , ‘String’, num2str(fadT2Mean));
set(handles.edit9 , ‘String’, num2str(fadAlphaMean));
set(handles.edit10 , ‘String’, num2str(fadFLIMMMean));
axes(handles.axes10);
imagesc(fadT1ImageM)
colormap(gray)
colorbar
axes(handles.axes11);
imagesc(fadT2ImageM)
colormap(gray)
colorbar
axes(handles.axes12);
imagesc(fadAlphaImageM)
colormap(gray)
colorbar
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit7 as text
% str2double(get(hObject,’String’)) returns contents of edit7 as a double
% — Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit8 as text
% str2double(get(hObject,’String’)) returns contents of edit8 as a double
% — Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit9 as text
% str2double(get(hObject,’String’)) returns contents of edit9 as a double
% — Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit10 as text
% str2double(get(hObject,’String’)) returns contents of edit10 as a double
% — Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit11_Callback(~, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit11 as text
% str2double(get(hObject,’String’)) returns contents of edit11 as a double
% — Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit12 as text
% str2double(get(hObject,’String’)) returns contents of edit12 as a double
% — Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit13 as text
% str2double(get(hObject,’String’)) returns contents of edit13 as a double
% — Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, ~, handles)
% hObject handle to edit13 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Select the file to save
% — Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global saveExcelLocation;
[saveExcelName, saveExcelPath] = uigetfile(‘*.xlsx’,’Pick an excel file’);
saveExcelLocation = strcat(saveExcelPath,saveExcelName);
set(handles.edit14 , ‘String’, saveExcelLocation);
function edit14_Callback(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’String’) returns contents of edit14 as text
% str2double(get(hObject,’String’)) returns contents of edit14 as a double
% — Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
%% Save the data to the excel file
% — Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
global redoxRatio;
global nadhThreshold;
global saveExcelLocation;
global nadhImageName ;
global fadImageName;
nadhFlimData = [nadhThreshold,redoxRatio,nadhT1Mean,nadhT2Mean,nadhAlphaMean,nadhFLIMMMean];
fadFlimData = [fadT1Mean,fadT2Mean,fadAlphaMean,fadFLIMMMean];
excelData = xlsread(saveExcelLocation,’Sheet1′,’E:E’); % read the column of interest
lastRowNumber = length(excelData)+ 2;
nadhWriteLoc = strcat(‘C’,num2str(lastRowNumber));
nadhNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
% save NADH data to the excel file
xlswrite(saveExcelLocation,nadhFlimData,’sheet1′,nadhWriteLoc);
xlswrite(saveExcelLocation,nadhImageName,’sheet1′,nadhNameWriteLoc);
% save FAD data to the excel file
lastRowNumber = lastRowNumber + 1;
fadWriteLoc = strcat(‘E’,num2str(lastRowNumber));
fadNameWriteLoc = strcat(‘A’,num2str(lastRowNumber));
xlswrite(saveExcelLocation,fadFlimData,’sheet1′,fadWriteLoc);
xlswrite(saveExcelLocation,fadImageName,’sheet1′,fadNameWriteLoc);
% — Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,’Value’) returns position of slider
% get(hObject,’Min’) and get(hObject,’Max’) to determine range of slider
global nadhThreshold;
global maskShowImage;
global nadhTextImage
nadhThreshold = get(handles.slider3 ,’Value’);
% get the image mask
maskShowImage = nadhTextImage;
maskShowImage(maskShowImage < nadhThreshold) = 0;
set(handles.edit1 , ‘String’, num2str(nadhThreshold));
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
% — Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,[.9 .9 .9]);
end
% — Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton17 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhFileName;
global nadhPathName;
global nadhT1Image;
% Get the location of the image
nadhT1FileName = strrep(nadhFileName,’photons’,’t1′);
nadhT1PathName = nadhPathName;
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , ‘String’, nadhT1FileName);
global nadhT2Image;
% Get the location of the image
nadhT2FileName = strrep(nadhFileName,’photons’,’t2′);
nadhT2PathName = nadhPathName;
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , ‘String’, nadhT2FileName);
global nadhAlphaImage;
% Get the location of the image
nadhAlphaFileName = strrep(nadhFileName,’photons’,’a1[%]’);
nadhAlphaPathName = nadhPathName;
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , ‘String’, nadhAlphaFileName);
global fadFileName;
global fadPathName;
global fadT1Image;
% Get the location of the image
fadT1FileName = strrep(fadFileName,’photons’,’t1′);
fadT1PathName = fadPathName;
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , ‘String’, fadT1FileName);
global fadT2Image;
% Get the location of the image
fadT2FileName = strrep(fadFileName,’photons’,’t2′);
fadT2PathName = fadPathName;
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , ‘String’, fadT2FileName)
global fadAlphaImage;
% Get the location of the image
fadAplhaFileName = strrep(fadFileName,’photons’,’a1[%]’);
fadAlphaPathName = fadPathName;
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , ‘String’, fadAplhaFileName); hobject, eventdata, handles MATLAB Answers — New Questions
Why am I getting different outputs between Matlab & SPSS?
I am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advanceI am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advance I am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advance statistics, software differences MATLAB Answers — New Questions
Undocked Editor, ctrl+shift+0 doesn’t bring editor to front as active window
Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently)Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently) Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently) editor, x11, ctrl+shift+0, keybind, window management MATLAB Answers — New Questions
Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer?
Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer?Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer? Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer? MATLAB Answers — New Questions