416 lines
11 KiB
Matlab
416 lines
11 KiB
Matlab
% Launch the MATLAB EASY console
|
|
function varargout = EASYconsole(varargin)
|
|
% initialize global variables for function EASYconsole
|
|
%global ExpOutmat
|
|
%global ExpPath
|
|
%global fhconsole
|
|
%global resDir
|
|
global wCodeDir
|
|
%global ImParMat
|
|
|
|
wCodeDir=pwd
|
|
|
|
% changing directory to wCodeDir
|
|
returnStartDir
|
|
|
|
%% GUI INTERFACE DESIGN %%
|
|
% beginning of GUI formation & design, see help GUI or help GUIDE in
|
|
% command window for more information
|
|
gui_Singleton = 1;
|
|
gui_State = struct('gui_Name', mfilename, ...
|
|
'gui_Singleton', gui_Singleton, ...
|
|
'gui_OpeningFcn', @EASYconsole_OpeningFcn, ...
|
|
'gui_OutputFcn', @EASYconsole_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
|
|
|
|
|
|
% Try to enter WCodeDir
|
|
function returnStartDir
|
|
global wCodeDir
|
|
try
|
|
cd(wCodeDir)
|
|
catch
|
|
msgbox('Failed to enter selected default directory so starting search at root.');
|
|
if ispc
|
|
cd('C:\');
|
|
elseif (isunix || ismac)
|
|
cd('/mnt/data');
|
|
else
|
|
msgbox('Unknown platform')
|
|
end
|
|
end
|
|
end
|
|
|
|
% GUI
|
|
% Easyconcole_OpeningFcn executes just before the EASYconsole GUI is made visible.
|
|
% 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--input arguments to EASYconsole (see VARARGIN)
|
|
function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
|
|
%global ExpOutmat
|
|
%global ExpPath
|
|
global fhconsole
|
|
global resDir
|
|
%global ImParMat
|
|
|
|
% Choose default command line output for EASYconsole
|
|
handles.output = hObject;
|
|
|
|
% Update handles structure
|
|
guidata(hObject, handles);
|
|
|
|
%Figure header, Toolbar, etc. Setup
|
|
fhconsole=gcf;
|
|
set(fhconsole,'Toolbar','none');
|
|
fhconsole=gcf;
|
|
|
|
if exist('resDir','var')&&~isempty(resDir)
|
|
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)));
|
|
else
|
|
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
|
end
|
|
end
|
|
|
|
|
|
%% EASYconsole OUTPUT FUNCTION %%
|
|
% Outputs from this function are returned to the command line.
|
|
% 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)
|
|
function varargout = EASYconsole_OutputFcn(~, ~, handles)
|
|
% Get default command line output from handles structure
|
|
varargout{1} = handles.output;
|
|
end
|
|
|
|
%% CONSOLE BUTTON INTERFACES %%
|
|
% File Button Interface
|
|
function FileMenu_Callback(~, ~, ~)
|
|
returnStartDir
|
|
end
|
|
|
|
% Load Experiment Button Interface
|
|
function LoadExp_Callback(~, ~, ~)
|
|
returnStartDir
|
|
end
|
|
|
|
% New Experiment Button Interface
|
|
function NewExpDat_Callback(~, ~, ~)
|
|
global newExpfile
|
|
global newExppath
|
|
global SWnewExp
|
|
global ExpOutmat
|
|
global ExpPath
|
|
global matDir
|
|
global resDir
|
|
global fhconsole
|
|
global scan
|
|
|
|
% put all users on same working directory
|
|
returnStartDir
|
|
|
|
% Create a new experiment
|
|
try
|
|
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
|
[newExpfile,newExppath] = uiputfile(' .mat');
|
|
SWnewExp=1;
|
|
|
|
% Set paths
|
|
newExpfilePref= strrep(newExpfile,'.mat','');
|
|
resDirName=strcat('Results',datestr(now,29),newExpfilePref);
|
|
resDir=fullfile(newExppath,resDirName);
|
|
matDir=fullfile(newExppath,resDirName,'matResults');
|
|
ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile));
|
|
ExpPath=fullfile(newExppath);
|
|
|
|
% create the the matResults dir
|
|
if ~exist(matDir)
|
|
mkdir (matDir);
|
|
end
|
|
|
|
%***Added for 'parfor global' to preallocate 'scan' structure 20-0123*****
|
|
nlist=dir(fullfile(ExpPath,'*'));
|
|
nnn=0;
|
|
for n=1:size(nlist,1)
|
|
if (~isempty(str2num(nlist(n).name)))
|
|
nnn=nnn+1;
|
|
PnumLst(nnn)= (str2num(nlist(n).name));
|
|
sl(nnn,1)={(nlist(n).name)};
|
|
end
|
|
end
|
|
scanSize= size(sl,1);
|
|
scanMax= max(str2double(sl));
|
|
clear scan;
|
|
scan(scanMax)= struct(); %changed for parfor global 20_0118
|
|
save(ExpOutmat,'scan')
|
|
|
|
% create supporting dirs
|
|
dirs = {'PrintResults', 'CFfigs', 'Fotos', 'Fotos/BkUp'};
|
|
for i = 1:length(dirs)
|
|
d = dirs{i};
|
|
if ~exist(fullfile(ExpPath, resDirName, d), 'dir')
|
|
mkdir(fullfile(ExpPath, resDirName, d));
|
|
end
|
|
end
|
|
|
|
% templateDirs are stored in the easy template directory
|
|
templates = {'figs', 'PTmats'}
|
|
for i = 1:length(templates)
|
|
d = dirs{i};
|
|
if ~exist(fullfile(ExpPath, resDirName, d), 'dir')
|
|
copyfile((fullfile(wCodeDir,d)), (fullfile(ExpPath,resDirName,d)));
|
|
end
|
|
end
|
|
|
|
clear sbdg % reduce possible retention of a previous job sdbg
|
|
sbdg= cell(1,scanMax);
|
|
save((fullfile(resDir,'Fotos','Nbdg')),'sbdg');
|
|
catch ME
|
|
returnStartDir
|
|
disp('Error Creating a New Experiment')
|
|
end
|
|
|
|
% set the title for fhconsole depending on existence
|
|
if exist('resDir','var')&&~isempty(resDir)
|
|
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
|
|
else
|
|
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
|
end
|
|
end
|
|
|
|
|
|
% Load a previous experiment
|
|
function LoadDatFile_Callback(~, ~, ~)
|
|
global openExpfile
|
|
global openExppath
|
|
global SWnewExp
|
|
global ExpOutmat
|
|
global ExpPath
|
|
global matDir
|
|
global resDir
|
|
global fhconsole
|
|
%global ImParMat
|
|
|
|
returnStartDir
|
|
|
|
% TODO this entire try block needs work
|
|
try
|
|
% TODO this section is highly questionable
|
|
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
|
[openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
|
|
SWnewExp=0;
|
|
ExpOutmat= fullfile(openExppath,openExpfile);
|
|
load(ExpOutmat);
|
|
resdir=fullfile('../',openExppath)
|
|
ExpPath=fullfile('../../',openExppath)
|
|
|
|
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
|
|
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
|
|
load(fullfile(resDir,'PTmats','NImParameters.mat'));
|
|
else
|
|
curDir=pwd;
|
|
returnStartDir
|
|
load NImParameters.mat
|
|
cd(curDir)
|
|
end
|
|
else %If Epson 10Plate Scans Then>
|
|
if exist(fullfile(resDir,'PTmats','ImParameters.mat'))
|
|
load(fullfile(resDir,'PTmats','ImParameters.mat'));
|
|
else
|
|
curDir=pwd;
|
|
returnStartDir
|
|
load ImParameters.mat
|
|
cd(curDir)
|
|
end
|
|
end
|
|
|
|
mkdir(fullfile(openExppath,'\BkUp'));
|
|
|
|
% create supporting dirs
|
|
dirs = {'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'}
|
|
for i = 1:length(dirs)
|
|
d = dirs{i}
|
|
if ~exist(fullfile(resDir, d), 'dir')
|
|
mkdir(fullfile(resDir, d));
|
|
end
|
|
end
|
|
|
|
catch
|
|
returnStartDir
|
|
end
|
|
|
|
clear scan
|
|
|
|
if exist('resDir','var')&&~isempty(resDir)
|
|
fhconsole= gcf;
|
|
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
|
|
else
|
|
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
|
end
|
|
end
|
|
|
|
|
|
%% CALLBACKS %%
|
|
|
|
% callback for the 'Run' in the dropdown menu
|
|
function run_Callback(~, ~, ~)
|
|
returnStartDir
|
|
end
|
|
|
|
function runPlateMapPintool_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
NImapPT
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function NImCFcombo_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
par4Gbl_Main8c
|
|
catch
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function runPlateImAnal_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
NImStartupOnly
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function PlateCFit_Callback(~, ~, ~)
|
|
%global ExpOutmat
|
|
returnStartDir
|
|
try
|
|
NCstart
|
|
catch ME
|
|
returnStartDir
|
|
end
|
|
end
|
|
|
|
function GenPrintouts_Callback(~, ~, ~)
|
|
end
|
|
|
|
function uploadExcelMP2DB_Callback(~, ~, ~)
|
|
end
|
|
|
|
function runDMPexcel_Callback(~, ~, ~)
|
|
global ExpPath
|
|
try
|
|
DMPexcel2mat_2024winLinix %DMPexcel2mat_2023winLinix
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function runResults_DBcombo_Callback(~, ~, ~)
|
|
|
|
try
|
|
DgenResults240430 %similar but semicolons removed to restore so cmdLine display info.
|
|
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
|
|
catch ME
|
|
disp('Error in DgenResults240430')
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function Tools_Callback(~, ~, ~)
|
|
end
|
|
|
|
function runOverlayPlots_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
DoverlayPlots2
|
|
returnStartDir
|
|
EASYconsole
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function runFotoStrip_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
F_NImStartup_CentCir
|
|
returnStartDir
|
|
EASYconsole
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function runDisplayFig_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
UfigDisplay
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function runViewParameters_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function QkviewN_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
try
|
|
cd(fullfile(ExpPath))
|
|
catch
|
|
if ispc
|
|
cd('C:\')
|
|
else
|
|
cd(fullfile('~'));
|
|
end
|
|
end
|
|
QkviewImages
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end
|
|
|
|
function CFdisplay_Callback(~, ~, ~)
|
|
returnStartDir
|
|
try
|
|
NCsingleDisplay
|
|
returnStartDir
|
|
EASYconsole
|
|
catch ME
|
|
returnStartDir
|
|
EASYconsole
|
|
end
|
|
end |