Last active
June 16, 2017 10:39
-
-
Save lacan/2c4da2f07f888d07ea89 to your computer and use it in GitHub Desktop.
Matlab Batch Coloc For Many Channels #Matlab #EasyXT #Coloc #Imaris
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Get EasyXT at: | |
% https://github.com/lacan/EasyXT | |
% The very first time you run it, use | |
% X = EasyXT('setup') | |
% To tell the XTension where the Imaris Executable file is. | |
% Disclaimer | |
% This code is provided as-is and hopefully will be of some use to people | |
% Olivier BURRI, Romain GUIET @ BIOP (EPFL - BioImaging & Optics Platform), July 2015 | |
% Start EasyXT | |
X = EasyXT; | |
% Here we want to compare the first channel with a fixed threshold to a bunch of other channels | |
% Define the Channels | |
ch1 = 1; | |
ch2List = 2:10; | |
% Define the Thresholds | |
th1 = 50; | |
th2List = [10 12 31 45 23 54 12 11 12 44]; | |
% The results will be saved to a table (NEEDS Matlab 2015a) | |
mytable = []; | |
for i = 1:numel(ch2List) | |
colocResults = X.Coloc([ch1,ch2List(i)],[th1,th2List(i)]); | |
if isempty(mytable) | |
% if the table is empty, Make the first one | |
% convert from structure to table | |
mytable = struct2table(colocResults); | |
mytable.Ch1 = ch1; | |
mytable.Ch2 = ch2List(i); | |
mytable.Th1 = th1; | |
mytable.Th2 = th2List(i); | |
else | |
% write results in a temp structure | |
% convert from structure to table tempTable = struct2table(colocResults); | |
tempTable = struct2table(colocResults); | |
mytable.Ch1 = ch1; | |
mytable.Ch2 = ch2List(i); | |
mytable.Th1 = th1; | |
mytable.Th2 = th2List(i); | |
% and append | |
mytable = [mytable; tempTable]; | |
end | |
disp (sprintf('Coloc Channel %d(%d) vs. Channel %d(%d) DONE',ch1,th1, ch2List(i), th2List(i)) ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment