EASY refactor: First attempt

This commit is contained in:
2024-07-27 02:58:49 -04:00
parent 5269962927
commit bce30095aa
11 changed files with 340 additions and 301 deletions

View File

@@ -357,10 +357,6 @@ init_project() {
ask "Initialize a project at $SCANS_DIR?" || return 1 ask "Initialize a project at $SCANS_DIR?" || return 1
[[ -d $SCANS_DIR/MasterPlateFiles ]] || mkdir -p "$SCANS_DIR/MasterPlateFiles"
DRUG_MEDIA_FILE="$SCANS_DIR/MasterPlateFiles/DrugMedia_$PROJECT.xls"
MASTER_PLATE_FILE="$SCANS_DIR/MasterPlateFiles/MasterPlate_$PROJECT.xls"
# Write skeleton files in csv # Write skeleton files in csv
# If we have to convert to xlsx later, so be it # If we have to convert to xlsx later, so be it
@@ -379,17 +375,7 @@ init_project() {
# TODO here we'll copy scan from robot but for now let's pause and wait for transfer # TODO here we'll copy scan from robot but for now let's pause and wait for transfer
read -r -p "Hit <Enter> to continue: " read -r -p "Hit <Enter> to continue: "
# Refactor some of the EASY fs code into here
# Make EASY directories
results_dir="Results$DATE-$PROJECT_SUFFIX"
mkdir "$results_dir"
dirs=('PrintResults' 'CFfigs' 'Fotos' 'Fotos/BkUp' 'matResults')
for d in "${dirs[@]}"; do
mkdir "$results_dir/$d"
done
# Copy templates
rsync -a "$EASY_TEMPLATE_DIR"/{figs,Ptmats} "$results_dir"
} }
@@ -533,19 +519,57 @@ easy() {
'NoGrowth_.txt', and 'GrowthOnly_.txt' files will be generated in the 'PrintResults' folder. 'NoGrowth_.txt', and 'GrowthOnly_.txt' files will be generated in the 'PrintResults' folder.
EOF EOF
script="$EASY_TEMPLATE_DIR/EASYConsole.m" script="$EASY_DIR/EASYConsole.m"
# Copy templates
# Add EASY directory to the Matlab path # Add EASY directory to the Matlab path
# If this does not work we can try changing the -sd argument and if that fails then pushing/popping # If this does not work we can try changing the -sd argument and if that fails then pushing/popping
debug "Adding EASY directory to the Matlab path" debug "Adding EASY directory to the Matlab path"
hash matlab &>/dev/null && hash matlab &>/dev/null &&
matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_TEMPLATE_DIR')" matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_DIR')"
# Ask the user to launch EASYconsole.m in MATLAB # Ask the user to launch EASYconsole.m in MATLAB
# MATLAB doesn't support passing args to scripts se we have to use ENV VARS instead # MATLAB doesn't support passing args to scripts se we have to use ENV VARS instead
# These are proably already set in our scope but be explicit just in case # These are proably already set in our scope but be explicit just in case so we don't have to export?
! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI." && # TODO will need to play with the -sd startup option to see what works (well)
SCANS_DIR="$SCANS_DIR" matlab -nosplash -sd "$SCANS_DIR" -r "run $script" # Skip this step altogether in auto mode since it requires graphical interaction
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
export SCANS_DIR PROJECT_DATE EASY_DIR PROJECT_USER PROJECT_PREFIX EASY_SUFFIX EASY_RESULTS_DIR MASTER_PLATE_FILE DRUG_MEDIA_FILE
echo "Hit enter to use the default EASY results directory $SCANS_DIR/Results_${PROJECT_PREFIX}_($PROJECT_SUFFIX)"
(( YES )) || read -r -p "Or enter a custom suffix: " suffix
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${Ssuffix:-$PROJECT_SUFFIX}"
while [[ -d $EASY_RESULTS_DIR ]]; do
count=1
if [[ $count -eq 1 ]] && ask "$EASY_RESULTS_DIR already exists, increment dir name (y) or overwrite (N)?"; then
EASY_SUFFIX="${Ssuffix:-$PROJECT_SUFFIX}.$((count++))"
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}"
else
EASY_SUFFIX=${suffix:-$PROJECT_SUFFIX}
fi
done
EASY_SUFFIX=${EASY_SUFFIX:-$suffix:-$PROJECT_SUFFIX}
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}"
[[ -d $SCANS_DIR/MasterPlateFiles ]] || mkdir -p "$SCANS_DIR/MasterPlateFiles"
DRUG_MEDIA_FILE="$SCANS_DIR/MasterPlateFiles/DrugMedia_$PROJECT.xls"
MASTER_PLATE_FILE="$SCANS_DIR/MasterPlateFiles/MasterPlate_$PROJECT.xls"
# Make EASY dirs
debug "mkdir -p $EASY_RESULTS_DIR"
mkdir -p "$EASY_RESULTS_DIR"
dirs=('PrintResults' 'CFfigs' 'Fotos' 'Fotos/BkUp' 'matResults')
for d in "${dirs[@]}"; do
mkdir "$EASY_RESULTS_DIR/$d"
done
# Copy templates
rsync -a "$EASY_DIR"/{figs,Ptmats} "$EASY_RESULTS_DIR"
# Launch matlab
matlab -nosplash -r "run $script"
# matlab -nosplash -sd "$SCANS_DIR" -r "run $script"
fi
# Use the function return code see if we succeeded # Use the function return code see if we succeeded
get_easy_results "$SCANS_DIR" || return 1 get_easy_results "$SCANS_DIR" || return 1
@@ -1379,14 +1403,15 @@ main() {
# Templates # Templates
QHTCP_TEMPLATE_DIR="$SCRIPT_DIR/templates/qhtcp" QHTCP_TEMPLATE_DIR="$SCRIPT_DIR/templates/qhtcp"
STUDY_TEMPLATE_DIR="$QHTCP_TEMPLATE_DIR/ExpTemplate" STUDY_TEMPLATE_DIR="$QHTCP_TEMPLATE_DIR/ExpTemplate"
EASY_TEMPLATE_DIR="$SCRIPT_DIR/templates/easy" EASY_DIR="$SCRIPT_DIR/templates/easy"
IMAGES="${IMAGES:-"/mnt/data/ExpJobs"}" IMAGES="${IMAGES:-"/mnt/data/ExpJobs"}"
DATE="$(date +%y_%m%d)" DATE="$(date +%Y%m%d)" # change general date format here
# Set the automatic project directory prefix # Set the automatic project directory prefix
PROJECT_PREFIX="${DATE}_$(whoami)_" # reversed these so easier to sort and parse date PROJECT_USER="$(whoami)"
san() { [[ $1 =~ [0-9][0-9]_[0-9][0-9]_[0-9][0-9]_.+_.+ ]]; } # sanitizer regex for prefix PROJECT_PREFIX="${DATE}_${PROJECT_USER}_" # reversed these so easier to sort and parse date
san() { [[ $1 =~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_.+_.+ ]]; } # sanitizer regex for prefix
declare -ag PROJECTS=() # this array will hold all of the projects for this run declare -ag PROJECTS=() # this array will hold all of the projects for this run
@@ -1441,9 +1466,9 @@ main() {
# Loop over projects # Loop over projects
for PROJECT in "${PROJECTS[@]}"; do for PROJECT in "${PROJECTS[@]}"; do
SCANS_DIR="$IMAGES/$PROJECT" SCANS_DIR="$IMAGES/$PROJECT"
PROJECT_DATE="${PROJECT%"${PROJECT#??_????}"}" # e.g. 24_0723 PROJECT_DATE="${PROJECT%"${PROJECT#????????}"}" # e.g. 20240723
PROJECT_SUFFIX="${PROJECT#??_????_*_}" PROJECT_SUFFIX="${PROJECT#????????_*_}"
PROJECT_USER="${PROJECT#??_????_}" PROJECT_USER="${PROJECT#????????_}"
PROJECT_USER="${PROJECT_USER%%_*}" PROJECT_USER="${PROJECT_USER%%_*}"
# Run selected modules # Run selected modules
for m in "${MODULES[@]}"; do for m in "${MODULES[@]}"; do

View File

@@ -26,7 +26,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
sortedFiles=mpFiles(sortedIndices); sortedFiles=mpFiles(sortedIndices);
masterPlateFile=sortedFiles{1}; masterPlateFile=sortedFiles{1};
disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection'); disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection');
catch Me catch ME
% This can be silent, not really an error % This can be silent, not really an error
end end
@@ -157,7 +157,7 @@ try
MP(numb).specifics= ' '; MP(numb).specifics= ' ';
end end
excLnNum=excLnNum+385; excLnNum=excLnNum+385;
msg=strcat('NumberOfMP = ',num2str(numb), 'lastLineNo. = ',num2str(excLnNum)) msg=strcat('NumberOfMP = ',num2str(numb), 'lastLineNo. = ',num2str(excLnNum));
end end
end end
catch ME catch ME
@@ -173,7 +173,7 @@ numOfMedias=0;
% Grabbing the bare filename from the MasterPlate file to see if we can automatically % Grabbing the bare filename from the MasterPlate file to see if we can automatically
% find a matching DrugMedia file % find a matching DrugMedia file
[mpFile, mpPath]=fullfile(masterPlateFile) [mpFile, mpPath]=fullfile(masterPlateFile);
mpFileParts=strsplit(mpFile, '_'); mpFileParts=strsplit(mpFile, '_');
mpBareFileName=strjoin(parts(2:end-1), '_'); mpBareFileName=strjoin(parts(2:end-1), '_');
@@ -261,7 +261,7 @@ if isequal(Linked,1) % Drugs and Media are linked 1 to 1; else they are combinat
DM.mod2(numb) = {raw(excLnNum,7)}; DM.mod2(numb) = {raw(excLnNum,7)};
DM.conc2(numb) = {raw(excLnNum,8)}; DM.conc2(numb) = {raw(excLnNum,8)};
excLnNum=excLnNum+1; excLnNum=excLnNum+1;
msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum)) msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum));
end end
else else
clear DM clear DM
@@ -283,7 +283,7 @@ if isequal(Linked,1) % Drugs and Media are linked 1 to 1; else they are combinat
DM.conc2(numb) = {DMtbl(excLnNum,8)}; DM.conc2(numb) = {DMtbl(excLnNum,8)};
DM.conc2(numb)= table2cell(DM.conc2{numb}); DM.conc2(numb)= table2cell(DM.conc2{numb});
excLnNum=excLnNum+1; excLnNum=excLnNum+1;
msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum)) msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum));
end end
end end
end end
@@ -321,7 +321,7 @@ if isequal(Linked,0) % 0 indicates Drugs and Media are combinatorial
excLnNum=excLnNum+1; excLnNum=excLnNum+1;
end end
end end
msg=strcat('NumberOfDrugs = ',num2str(drgCnt), ' NumberOfMedias = ',num2str(medCnt) ) msg=strcat('NumberOfDrugs = ',num2str(drgCnt), ' NumberOfMedias = ',num2str(medCnt) );
end end
save(mpdmFile, 'fields','MP','DM','Linked'); save(mpdmFile, 'fields','MP','DM','Linked');

View File

@@ -3,18 +3,25 @@
% Updated 240724 Bryan C Roessler to improve file operations and portability % Updated 240724 Bryan C Roessler to improve file operations and portability
% %
function varargout = EASYconsole(varargin) function varargout = EASYconsole(varargin)
global startDir
global easyDir global easyDir
global easySuffix global easySuffix
global scansDir global scansDir
global easyResultsDir global easyResultsDir
global easyResultsDirName global easyResultsDirName
global fotosResultsDir
global figsResultsDir
global pointMapsResultsDir
global pointMapsFile
global printResultsDir
global matDir global matDir
global matFile global matFile
global drugMediaFile
global masterPlateFile
global mpdmFile
global userName global userName
global srchRange
% Initialize some variables from matlab % Initialize some variables from matlab
startDir=pwd;
easyPath=which(mfilename); easyPath=which(mfilename);
[easyDir,easyFileName]=fileparts(easyPath); [easyDir,easyFileName]=fileparts(easyPath);
easyDir=fullfile(easyDir); easyDir=fullfile(easyDir);
@@ -27,22 +34,27 @@ function varargout = EASYconsole(varargin)
% Set scansDir intelligently (project scans directory) % Set scansDir intelligently (project scans directory)
% Allow users to specify a PROJECT=/mnt/data/ExpJobs/Job directory to analyze with EASY % Allow users to specify a PROJECT=/mnt/data/ExpJobs/Job directory to analyze with EASY
% This better enables running the new EASY in standalone mode % This better enables running the new EASY in standalone mode
if exist('PROJECT', 'env') if exist('PROJECT', 'env') && ~isempty(getenv('PROJECT'))
scansDir=get_env('PROJECT'); scansDir=get_env('PROJECT');
disp(strcat('Using project path: ', scansDir, ' from environment variable PROJECT')); disp(strcat('Using project path: ', scansDir, ' from environment variable PROJECT'));
disp('This usually indicates that we are in standalone mode'); disp('This usually indicates that we are in standalone mode');
elseif exist('SCANS_DIR', 'env') elseif exist('SCANS_DIR', 'env') && ~isempty(getenv('SCANS_DIR'))
scansDir=get_env('SCANS_DIR'); scansDir=get_env('SCANS_DIR');
disp(strcat('Using scans directory: ', scansDir, ' from environment variable SCANS_DIR')); disp(strcat('Using scans directory: ', scansDir, ' from environment variable SCANS_DIR'));
disp('This usually indicates that we are in module mode'); disp('This usually indicates that we are in module mode');
else else
scansDir=fullfile(parentDir,'ExpJobs'); % relative to easy script dir dirToScan=fullfile(parentDir,'ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change
dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only
[~, sortedIndices] = sort(datenum({dirs.date}), 'descend'); % sort by newest first
sortedDirs=dirs{sortedIndices};
scansDir=sortedDirs{1};
disp('Beginning in newest project scans directory');
disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default')); disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default'));
disp('This usually indicates that we are in standalone mode'); disp('This usually indicates that we are in stand-alone mode');
end end
% If we don't have the EASY_SUFFIX from the module, generate it from scanDir % If we don't have the EASY_SUFFIX from the module, generate it from scansDir
if exist('EASY_SUFFIX', 'env') if exist('EASY_SUFFIX', 'env') && ~isempty(getenv('EASY_SUFFIX'))
easySuffix=get_env('EASY_SUFFIX'); easySuffix=get_env('EASY_SUFFIX');
else else
[dirName, ~]=fileparts(scansDir); [dirName, ~]=fileparts(scansDir);
@@ -69,10 +81,11 @@ function varargout = EASYconsole(varargin)
end end
% Helpful variables for running in workflow mode that I'll probably have to reimplement in matlab anyways for standalone mode % Helpful variables for running in workflow mode that I'll probably have to reimplement in matlab anyways for standalone mode
if exist('EASY_DIR','env') if exist('EASY_DIR','env') && ~isempty(getenv('EASY_DIR'))
EASY_DIR=fullfile(get_env('EASY_DIR')); EASY_DIR=fullfile(get_env('EASY_DIR'));
if easyDir ~= EASY_DIR % sanity check if easyDir ~= EASY_DIR % sanity check
disp("WARNING: EASY_DIR does not match this script's default EASY location"); disp("WARNING: EASY_DIR does not match this script's hardcoded EASY location");
disp("This is probably OK but if strange beahvior arises, we'll need to fix it in code");
easyDir=EASY_DIR; easyDir=EASY_DIR;
end end
disp(strcat('Using EASY script directory: ', easyDir, ' from environment variable EASY_DIR')); disp(strcat('Using EASY script directory: ', easyDir, ' from environment variable EASY_DIR'));
@@ -80,12 +93,7 @@ function varargout = EASYconsole(varargin)
disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default')); disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default'));
end end
% Now that we have easyDir let's add it to the path just to be safe if exist('EASY_RESULTS_DIR', 'env') && ~isempty(getenv('EASY_RESULTS_DIR'))
% TODO I have no idea if this is necessary or effective but we'll see
% I could image it would reduce some weird matlab errors?
addpath(easyDir);
if exist('EASY_RESULTS_DIR', 'env')
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR')); easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR')) disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
else else
@@ -95,21 +103,73 @@ function varargout = EASYconsole(varargin)
disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX')) disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
end end
if exist('PROJECT_USER', 'env') if exist('PROJECT_USER', 'env') && ~isempty(getenv('PROJECT_USER'))
if get_env('PROJECT_USER') ~= userName % sanity check if get_env('PROJECT_USER') ~= userName % sanity check
disp("WARNING: PROJECT_USER does not match the current namespace"); disp("WARNING: PROJECT_USER does not match the current namespace");
end end
end end
matDir=fullfile(easyResultsDir,'matResults'); if exist('MASTER_PLATE_FILE', 'env') && ~isempty(getenv('MASTER_PLATE_FILE'))
matFile=fullfile(matDir,strcat(easyResultsDirName,'.mat')); masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE'));
disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE'))
else
% Try to find MasterPlate_ file on our own
mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx'));
if exist(mp, 'file'))
masterPlateFile=mp;
disp(strcat('Using drug media file: ', masterPlateFile, ' from internal logic'))
else
disp("WARNING: Have you created a MasterPlate_ file?")
end
end
% Play around with making some common variables from our input data if exist('DRUG_MEDIA_FILE', 'env') && ~isempty(getenv('DRUG_MEDIA_FILE'))
% resDirName=fullfile(SCANS_DIR,'Results',dateStr,'_', PROJECT_SUFFIX); drugMediaFile=fullfile(get_env('DRUG_MEDIA_FILE'));
% resDir=fullfile(SCANS_DIR,resDirName); disp(strcat('Using drug media file: ', drugMediaFile, ' from environment variable DRUG_MEDIA_FILE'))
% ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile)); else
% ExpPath=fullfile(newExppath); % Try to find MasterPlate_ file on our own
% ExpFile=fullfile(matDir,) dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx'));
if exist(mp, 'file'))
drugMediaFile=dm;
disp(strcat('Using drug media file: ', drugMediaFile, ' from internal logic'))
else
disp("WARNING: Have you created a DrugMedia_ file?")
end
end
matDir=fullfile(easyResultsDir,'matResults');
if ~exist(matDir, 'dir')
mkdir(matDir);
end
matFile=fullfile(matDir,strcat(easyResultsDirName,'.mat'));
% Pulled these out of par4GblFnc8c
printResultsDir=fullfile(easyResultsDir,'PrintResults');
fotosResultsDir=fullfile(easyResultsDir,'Fotos');
figsResultsDir=fullfile(easyResultsDir,'figs');
pointMapsResultsDir=fullfile(easyResultsDir,'PTmats');
pointMapsFile=fullfile(pointMapsResultsDir,'NImParameters.mat')
oldPointMapsFile=fullfile(pointMapsResultsDir,'ImParameters.mat')
CSearchRangeFile=fullfile(fotosResultsDir,'CSearchRange.mat');
mpdmFile=fullfile(matDir,'MPDM.mat');
% This can be removed, I think it should add the previous search range?
% Might be nice feature but can remove if it causes issues
% We are using searchRangeNum to hold old CSrchRange value(s)
if exist(CSearchRangeFile, 'file')
searchRangeNum=load(CSearchRangeFile);
end
% Add easyDir to the MATLAB path
% I have not idea if this is necessary or works but theoretically should
% reduce directory scoping issues when calling scripts w/o a path
addpath(easyDir);
% Pulled this out of the opening function
% Seems better to wait until we have our ars set
if exist('scansDir','var') && ~isempty(scansDir)
set(fhconsole,'Name',strcat('EASYconsole - ',char(scansDir)));
else
set(fhconsole,'Name','EASYconsole - No Active Experiment.')
end
% GUI interface design % GUI interface design
gui_Singleton=1; gui_Singleton=1;
@@ -164,15 +224,6 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
fhconsole=gcf; fhconsole=gcf;
set(fhconsole,'Toolbar','none'); set(fhconsole,'Toolbar','none');
fhconsole=gcf; fhconsole=gcf;
% BCR this is set in the global function so I think we're good here
% easyResultsDirName=strcat('Results',todayStr,newExpfilePref);
if exist('easyResultsDir','var') && ~isempty(easyResultsDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)));
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end end
@@ -200,7 +251,6 @@ end
% New Experiment Button Interface % New Experiment Button Interface
function NewExpDat_Callback(~, ~, ~) function NewExpDat_Callback(~, ~, ~)
global SWnewExp
global matDir global matDir
global matFile global matFile
global easyResultsDir global easyResultsDir
@@ -213,8 +263,6 @@ function NewExpDat_Callback(~, ~, ~)
try try
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex')); questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[inputFile,inputPath]=uiputfile('.mat'); [inputFile,inputPath]=uiputfile('.mat');
SWnewExp=1;
inputFileName=strrep(inputFile,'.mat',''); inputFileName=strrep(inputFile,'.mat','');
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName); easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
@@ -263,8 +311,7 @@ function NewExpDat_Callback(~, ~, ~)
sbdg= cell(1,scanMax); sbdg= cell(1,scanMax);
save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg'); save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg');
catch ME catch ME
% returnStartDir disp(strcat('ERROR: ', ME.message))
disp('Error Creating a New Experiment')
end end
% set the title for fhconsole depending on existence % set the title for fhconsole depending on existence
@@ -278,39 +325,50 @@ end
% Load a previous experiment % Load a previous experiment
function LoadDatFile_Callback(~, ~, ~) function LoadDatFile_Callback(~, ~, ~)
global SWnewExp
global matDir global matDir
global matFile global matFile
global easyResultsDir global easyResultsDir
global easyPath global easyPath
global fhconsole global fhconsole
%global ImParMat
try try
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex')); questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[inputFile,inputPath]=uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off'); [inputFile,inputPath]=uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
SWnewExp=0;
matDir=fullfile(inputPath); matDir=fullfile(inputPath);
matFile=fullfile(inputPath,inputFile); matFile=fullfile(inputPath,inputFile);
load(matFile); load(matFile);
easyResultsDir=fullfile(matDir,'..'); easyResultsDir=fullfile(matDir,'..');
scansDir=fullfile(matDir,'..', '..'); scansDir=fullfile(matDir,'..', '..');
point
% TODO this is pretty hacky and needs something more explicit
if isfolder(fullfile(matDir, '..','..','1')) % If Inovation Vrobot Then if isfolder(fullfile(matDir, '..','..','1')) % If Inovation Vrobot Then
if exist(fullfile(easyResultsDir,'PTmats','NImParameters.mat'), 'file') try
load(fullfile(easyResultsDir,'PTmats','NImParameters.mat')); exist(pointMapsFile, 'file')
else load(pointMapsFile);
load(fullfile(easyPath,'NImParameters.mat')); catch
try
load(fullfile(easyPath,'NImParameters.mat')); % hardcoded default
catch
disp("Could not load the NImParameters.mat file")
end
end end
else % If Epson 10Plate Scans Then> else % If Epson 10Plate Scans Then>
if exist(fullfile(easyResultsDir,'PTmats','ImParameters.mat'), 'file') if exist(fullfile(pointMapsResultsDir,'ImParameters.mat'), 'file')
load(fullfile(easyResultsDir,'PTmats','ImParameters.mat')); load(fullfile(pointMapsResultsDir,'ImParameters.mat'));
else else
try
load(fullfile(easyPath,'ImParameters.mat')); load(fullfile(easyPath,'ImParameters.mat'));
catch
disp("Could not load the ImParameters.mat file")
end
end end
end end
mkdir(fullfile(matDir,'BkUp')); bkupDir=fullfile(matDir,'BkUp');
if ~exist(bkupDir, 'dir')
mkkdir(bkupDir);
end
% Create supporting dirs % Create supporting dirs
dirs={'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'} dirs={'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'}
@@ -333,8 +391,8 @@ function LoadDatFile_Callback(~, ~, ~)
end end
end end
%% CALLBACKS %% % Callbacks
% callback for the 'Run' in the dropdown menu % 'Run' in the dropdown menu
function run_Callback(~, ~, ~) function run_Callback(~, ~, ~)
end end
@@ -378,8 +436,7 @@ end
function runDMPexcel_Callback(~, ~, ~) function runDMPexcel_Callback(~, ~, ~)
try try
% DMPexcel2mat_2024winLinix %DMPexcel2mat_2023winLinix DMPexcel2mat
DMPexcel2mat % TODO Can't find above so using what I have available
catch catch
EASYconsole EASYconsole
end end
@@ -387,7 +444,7 @@ end
function runResults_DBcombo_Callback(~, ~, ~) function runResults_DBcombo_Callback(~, ~, ~)
try try
DgenResults240430 %similar but semicolons removed to restore so cmdLine display info. DgenResults %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter %Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME catch ME
disp(strcat('Error in DgenResults240430: ', ME.message)) disp(strcat('Error in DgenResults240430: ', ME.message))

View File

@@ -1,5 +1,5 @@
%% CALLED WHEN ACCESSING 'CurveFit Display' %% %% CALLED WHEN ACCESSING 'CurveFit Display' %%
function [scLst, row, col] = NCdisplayGui(eDir) %(ExpPath) function [scLst, row, col] = NCdisplayGui(scansDir)
xPos=0.05; xPos=0.05;
btnWid=0.10; btnWid=0.10;
btnHt=0.05; btnHt=0.05;
@@ -49,7 +49,7 @@ function [scLst, row, col] = NCdisplayGui(eDir) %(ExpPath)
end end
% Read in numeric folder names % Read in numeric folder names
nlist=dir(fullfile(eDir,'*')); %(ExpPath,'*')); nlist=dir(fullfile(scansDir,'*'));
nnn=0; nnn=0;
for n=1:size(nlist,1) for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name))) if (~isempty(str2num(nlist(n).name)))
@@ -344,28 +344,28 @@ btnNumber=7;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
try try
CSrchRange=ImParMat(12); srchRange=ImParMat(12);
CSrchRng=ImParMat(12) searchRangeNum=ImParMat(12)
catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14. catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
CSrchRange=18; srchRange=18;
ImParMat(12)=18 ImParMat(12)=18
CSrchRng=ImParMat(12) searchRangeNum=ImParMat(12)
end end
%{ %{
if size(scLst)>1 if size(scLst)>1
CSrchRange=ImParMat(12); srchRange=ImParMat(12);
else else
try try
CSrchRange=CSearchRange(str2double(scLst)) srchRange=CSearchRange(str2double(scLst))
catch catch
CSrchRange=ImParMat(12); srchRange=ImParMat(12);
end end
end end
%} %}
hSearchRange = uicontrol(... hSearchRange = uicontrol(...
'Style', 'edit',... 'Style', 'edit',...
'String',CSrchRange,... 'String',srchRange,...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos,... 'Position', btnPos,...
'callback',{@CsearchRange}); 'callback',{@CsearchRange});
@@ -376,7 +376,7 @@ hSearchRange = uicontrol(...
errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal') errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
return return
end end
CSrchRng=user_entry searchRangeNum=user_entry
end end
@@ -455,18 +455,4 @@ hedit = uicontrol(...
end end
end end
%} %}
%global SWsingleSc
%global SWgrowthArea
%global selScan
%global scan
%global scLst
%global ImParMat
%global CSearchRange
%global CSrchRng
%global defImParMat
%global fhImRun
%global fhconsole
%global resDir
%global ExpOutmat
%global numRows;
%global numCols;

View File

@@ -1,6 +1,6 @@
%% CALLED BY par4GblFnc8c.m %% %% CALLED BY par4GblFnc8c.m %%
function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC,outCstd]= ... function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC,outCstd]= ...
NCfitImCFparforFailGbl2(parMat,times, values, timeOffsets, fileSuffix, AUCfinalTime, ~, spotAreas, outputDirectory, ~,~, sols, ~) %,scan) NCfitImCFparforFailGbl2(parMat,times, values, timeOffsets, fileSuffix, AUCfinalTime, ~, spotAreas, printResultsDir, ~,~, sols, ~) %,scan)
% Preallocation for parfor loop % Preallocation for parfor loop
st(1,1:size(times,2))=1111; st(1,1:size(times,2))=1111;
@@ -223,7 +223,7 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
fileExt='.txt'; fileExt='.txt';
filePrefix='FitResultsComplete_'; filePrefix='FitResultsComplete_';
fileNamePlate=[filePrefix fileSuffix fileExt]; fileNamePlate=[filePrefix fileSuffix fileExt];
fileName=fullfile(outputDirectory, fileNamePlate); %[outputDirectory fileNamePlate]; fileName=fullfile(printResultsDir, fileNamePlate); %[printResultsDir fileNamePlate];
fid=fopen(fileName,'w'); fid=fopen(fileName,'w');
fprintf(fid, 'Fit Results Complete\n'); fprintf(fid, 'Fit Results Complete\n');
%fprintf(fid, 'Num.\tAUC\tMSR\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-upper\tl-lower\tArea\tLastInten\tSpineMaxRateTimePt\tLastFitTimePt\n'); %fprintf(fid, 'Num.\tAUC\tMSR\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-upper\tl-lower\tArea\tLastInten\tSpineMaxRateTimePt\tLastFitTimePt\n');

View File

@@ -1,13 +1,10 @@
%% CALLED WHEN ACCESSING 'CurveFit Display' %% %% CALLED WHEN ACCESSING 'CurveFit Display' %%
global expDir
global scLst global scLst
global ExpPath
global scan global scan
eDir=ExpPath;
hf=figure; hf=figure;
% Parameter Entry % Parameter Entry
[scLst, row, col]=NCdisplayGui(eDir); %(ExpPath); %Ncode 122111replaced removed ,numOfPrtTimes) [scLst, row, col]=NCdisplayGui(scansDir);
close(hf) close(hf)
selSpot=(row-1)*24 + col; selSpot=(row-1)*24 + col;
for iPlate=1:length(scLst) for iPlate=1:length(scLst)

View File

@@ -1,29 +1,35 @@
%% CALLED BY par4Gbl_Main8c.m %% %% CALLED BY par4Gbl_Main8c.m %%
function NImParamRadiusGui(expDir) % TODO Should some of these vars be pulled out higher so they are easier to change?
%
function NImParamRadiusGui(scansDir)
global SWsingleSc global SWsingleSc
global SWgrowthArea global SWgrowthArea
%global selScan
global scan global scan
global scLst global scLst
global ImParMat global ImParMat
%global CSearchRange global searchRangeNum
global CSrchRng
global defImParMat global defImParMat
global fhImRun global fhImRun
global fhconsole global fhconsole
global resDir global easyResultsDir
global ExpOutmat global fotosResultsDir
global numRows; global pointMapsResultsDir
global numCols; global pointMapsFile
global matFile
global numRows
global numCols
global scanSize global scanSize
global scanMax global scanMax
defImParMat=[1, 1, 15, 34, 24, 1,0,0,1,14,1,18]; %Ncode ImRobot adaptation % Ncode ImRobot adaptation
% TODO this code block and variables needs explanation
defImParMat=[1,1,15,34,24,1,0,0,1,14,1,18];
if ImParMat(3)==0 || ImParMat(4)==0 ||ImParMat(5)==0 || ImParMat(10)==0 ||ImParMat(11)==0 if ImParMat(3)==0 || ImParMat(4)==0 ||ImParMat(5)==0 || ImParMat(10)==0 ||ImParMat(11)==0
ImParMat=defImParMat; ImParMat=defImParMat;
end end
if size(ImParMat,2)<12 if size(ImParMat,2)<12
ImParMat(12)=18; %Default before user input CsearchRange value ImParMat(12)=18; % default before user input CsearchRange value
msg='Data made before SearchRange user entry added (ImParMat(12). 18 was the set value and the current default.)'; msg='Data made before SearchRange user entry added (ImParMat(12). 18 was the set value and the current default.)';
end end
% ImParMat=defImParMat; %Activate for INITIAL USE only % ImParMat=defImParMat; %Activate for INITIAL USE only
@@ -31,15 +37,17 @@ function NImParamRadiusGui(expDir)
destPerMP=1; destPerMP=1;
selScan=1; selScan=1;
SWgrowthArea=1; SWgrowthArea=1;
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters')); if exist(pointMapsFile)
load(pointMapsFile);
else else
load NImParameters load(fullfile(PTmats,'NImParameters')) % hardcoded default
disp('WARNING: Using hardcoded NImParameters.mat')
end end
ImParMat; ImParMat
%if ~exist('CSearchRange','var') || isempty(CSearchRange) % if ~exist('searchRangeNum','var') || isempty(searchRangeNum)
if ~isequal(exist(fullfile(resDir,'Fotos','CSearchRange.mat')),0) if exist(CSearchRangeFile), 'file')
load(fullfile(resDir,'Fotos','CSearchRange')) load(CSearchRangeFile);
CSearchRange; CSearchRange;
end end
@@ -54,9 +62,9 @@ function NImParamRadiusGui(expDir)
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
fhImParm=gcf; fhImParm=gcf;
if exist('resDir','var')&& ~isempty(resDir) if exist('easyResultsDir','var')&& ~isempty(easyResultsDir)
set(fhImParm,'NumberTitle','off') set(fhImParm,'NumberTitle','off')
set(fhImParm,'Name',strcat('ImageAnalysis- ',char(resDir))) set(fhImParm,'Name',strcat('ImageAnalysis- ',char(easyResultsDir)))
else else
set(fhImParm,'NumberTitle','off') set(fhImParm,'NumberTitle','off')
set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.') set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.')
@@ -110,32 +118,30 @@ function NImParamRadiusGui(expDir)
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
try try
CSrchRange=ImParMat(12); srchRange=ImParMat(12);
CSrchRng=ImParMat(12);
catch % Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14. catch % Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
CSrchRange=18; srchRange=18;
ImParMat(12)=18; ImParMat(12)=18;
CSrchRng=ImParMat(12);
end end
hSearchRange=uicontrol(... hSearchRange=uicontrol(...
'Style', 'edit',... 'Style', 'edit',...
'String',CSrchRange,... 'Value',searchRangeNum,...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos,... 'Position', btnPos,...
'callback',{@CsearchRange}); 'callback',{@searchRangeCallback});
function CsearchRange(source,~) function searchRangeCallback(source,~)
user_entry=str2double(get(source,'string')); user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased
errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal') errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
return return
end end
CSrchRng=user_entry; searchRangeNum=user_entry;
end end
% Ncode 12_0120 for reading in numeric folder names % Ncode 12_0120 for reading in numeric folder names
nlist=dir(fullfile(expDir,'*')); nlist=dir(fullfile(scansDir,'*'));
nnn=0; nnn=0;
for n=1:size(nlist,1) for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name))) if (~isempty(str2num(nlist(n).name)))
@@ -158,8 +164,7 @@ function NImParamRadiusGui(expDir)
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20]) 'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
function load_listbox(source,~) function load_listbox(source,~)
%global CSrchRng global
%global CSrearchRange
userIndx=(get(source,'value')); userIndx=(get(source,'value'));
userStr=(get(source,'string')); userStr=(get(source,'string'));
%scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', ''))) %scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', '')))
@@ -167,11 +172,11 @@ function NImParamRadiusGui(expDir)
user_entry=userStr(userIndx); user_entry=userStr(userIndx);
scLst=user_entry; scLst=user_entry;
if size(scLst,1)>1 if size(scLst,1)>1
%CSrchRng=num2str(ImParMat(12)) % searchRangeNum=num2str(ImParMat(12))
set(hSearchRange,'string',num2str(ImParMat(12))) set(hSearchRange,'string',num2str(ImParMat(12)))
else else
try try
CSrchRng=CSearchRange(str2double(scLst)); searchRangeNum=CSearchRange(str2double(scLst));
set(hSearchRange,'string',CSearchRange(str2double(scLst))) set(hSearchRange,'string',CSearchRange(str2double(scLst)))
catch catch
% CSrchRng=num2str(ImParMat(12)) % CSrchRng=num2str(ImParMat(12))
@@ -231,16 +236,10 @@ function NImParamRadiusGui(expDir)
end end
ImParMat; ImParMat;
CSearchRange; searchRangeNum;
try
save('NImParameters','ImParMat') save(pointMapsFile, 'ImParMat');
% save('CSearchRange','CSearchRange') save(CSearchRangeFile,'searchRangeNum');
catch
save(fullfile('\','NImParameters'),'ImParMat')
% save(fullfile('\','CSearchRange'),'CSearchRange')
end
save((fullfile(resDir,'PTmats','NImParameters')), 'ImParMat');
save((fullfile(resDir,'Fotos','CSearchRange')),'CSearchRange');
close close
return return

View File

@@ -1,10 +1,12 @@
%% CALLED BY par4GblFnc8c.m %% %% CALLED BY par4GblFnc8c.m %%
function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ... function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ...
NIscanIntensBGpar4GblFnc(Fflg, tifFileLst, ImParMat,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,numRows,numCols,ImHeigth,ImWidth,cirMask, ... NIscanIntensBGpar4GblFnc(Fflg, tifFileLst, ImParMat,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,numRows,numCols,ImHeigth,ImWidth,cirMask, ...
tptLength,selScan,Empsc,~, ~, ~, ~,resDir, Tmpsbdg1) tptLength,selScan,Empsc,~, ~, ~, ~,easyResultsDir, Tmpsbdg1)
global ExpOutmat global matFile
global CSrchRng global CSrchRng
global figsResultsDir
global fotosResultsDir
searchIntens=[]; intensMax=[]; detMaxPos=[]; scIntens=[]; areaOfIntensAboveBG=[]; BkgrdMat=[]; searchIntens=[]; intensMax=[]; detMaxPos=[]; scIntens=[]; areaOfIntensAboveBG=[]; BkgrdMat=[];
@@ -33,7 +35,8 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
PTmapOnesDbl(PTrefPtR:(PTrefPtR+(diaExt-1)),PTrefPtC:(PTrefPtC+(diaExt-1)))=optCirMask; PTmapOnesDbl(PTrefPtR:(PTrefPtR+(diaExt-1)),PTrefPtC:(PTrefPtC+(diaExt-1)))=optCirMask;
end end
end end
end %if Fflg==1 end
% Zeroth Initial Search Parameters % Zeroth Initial Search Parameters
rRangeUpper=-12; rRangeUpper=-12;
rRangeLower=12; rRangeLower=12;
@@ -73,9 +76,10 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
intensPrev=zeros(24,16); intensPrev=zeros(24,16);
cent=cell(24,16); cent=cell(24,16);
BGTav=zeros(numRows,numCols); BGTav=zeros(numRows,numCols);
BGthres(1:numRows,1:numCols)=95; %70;before incr.to95 to accommodate dark media %50forEpson;%Initialize for first tPt run *****************************************************<< % 7 0;before incr.to95 to accommodate dark media %50forEpson;%Initialize for first tPt run
BGthres(1:numRows,1:numCols)=95;
if length(tifFileLst)>2 if length(tifFileLst)>2
%******Determine a good Plate Image from all the timepoints to use for Registration % Determine a good Plate Image from all the timepoints to use for Registration
% Plate Intensity curve over time points % Plate Intensity curve over time points
% clear plateImage % clear plateImage
plateImage={}; plateImage={};
@@ -517,8 +521,8 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
% NIgenBkGrdDataPar4Fnc(ImParMat, tifFileLst, lastDetMaxPos, numRows, numCols, fullsc, tPt, BGthres, doCircle, cirPixA, diaExt, cirMask, BGTav) % NIgenBkGrdDataPar4Fnc(ImParMat, tifFileLst, lastDetMaxPos, numRows, numCols, fullsc, tPt, BGthres, doCircle, cirPixA, diaExt, cirMask, BGTav)
% Called by NIscanIntensBG.m % Called by NIscanIntensBG.m
% global resDir % global easyResultsDir
global ExpOutmat global matFile
% global pixsAboveBG % global pixsAboveBG
MPnum=ImParMat(1); MPnum=ImParMat(1);
destPerMP=ImParMat(2); destPerMP=ImParMat(2);
@@ -1146,13 +1150,12 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
title(strcat('Scan',num2str(selScan),'timePt-',num2str(tPt))); title(strcat('Scan',num2str(selScan),'timePt-',num2str(tPt)));
clf(hfscanIm,'reset'); clf(hfscanIm,'reset');
set(hfIm,'NumberTitle','off') set(hfIm,'NumberTitle','off')
set(hfIm,'Name', char(ExpOutmat)) % strcat('EASYconsole- ',char(resDir))) set(hfIm,'Name', char(matFile)) % strcat('EASYconsole- ',char(easyResultsDir)))
if Fflg==1 if Fflg==1
resDir; % for debugging fullfile(fotosResultsDir,strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt)))
fullfile(resDir,'Fotos',strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt))) hgsave(fullfile(fotosResultsDir,strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt)))); %F 14_0626
hgsave(fullfile(resDir,'Fotos',strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt)))); %F 14_0626
else else
hgsave(fullfile(resDir,'figs',strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt)))); hgsave(fullfile(figsResultsDir,strcat('Scan',num2str(selScan),'_timePt-',num2str(tPt))));
end end
else else
selScan; selScan;
@@ -1163,7 +1166,7 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
areaOfIntensAboveBG(:,:,tPt)=pixsAboveBG; % actual area of growth for each timepoint (used for printout of grArea ?not used in previous analysis) areaOfIntensAboveBG(:,:,tPt)=pixsAboveBG; % actual area of growth for each timepoint (used for printout of grArea ?not used in previous analysis)
scanIntens(:,:,tPt)=intens-BkgrdMat; scanIntens(:,:,tPt)=intens-BkgrdMat;
% capture first and last background values % Capture first and last background values
if tPt==1 if tPt==1
bdg(:,:,1)=bmm; bdg(:,:,1)=bmm;
bdg(:,:,3)=rwm; bdg(:,:,3)=rwm;

View File

@@ -3,7 +3,7 @@ function[p4L4,...
TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4,Tmpsbdg4]= ... TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4,Tmpsbdg4]= ...
p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,~,tifFileLstP4,pathname,ImParMat, ... TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,~,tifFileLstP4,pathname,ImParMat, ...
numRows,numCols,scLst,resDir,expDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, Tmpsbdg00, Tmpsbdg4) numRows,numCols,scLst,easyResultsDir,scansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, Tmpsbdg00, Tmpsbdg4)
p4L0=p4L00; p4L0=p4L00;
TmpexpScanIntens0=TmpexpScanIntens00; TmpexpScanIntens0=TmpexpScanIntens00;
TmpFexpScanSpots0=TmpFexpScanSpots00; TmpFexpScanSpots0=TmpFexpScanSpots00;
@@ -25,7 +25,7 @@ parfor (scCount=1:numScans,parforArg)
[p4L3,TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ... [p4L3,TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ...
par4GblFnc8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... par4GblFnc8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
TmpexpScanIntens0,TmpFexpScanSpots0,TmpFexpScanBMtp0,TmpanlZoneRefs0,scCount,tifFileLstP4,pathname,ImParMat, ... TmpexpScanIntens0,TmpFexpScanSpots0,TmpFexpScanBMtp0,TmpanlZoneRefs0,scCount,tifFileLstP4,pathname,ImParMat, ...
numRows,numCols, scLst,resDir,expDir, p4L0,Tmpsbdg0); numRows,numCols, scLst,easyResultsDir,scansDir, p4L0,Tmpsbdg0);
p4L4(:,scCount)=p4L3; % (:,scCount); p4L4(:,scCount)=p4L3; % (:,scCount);
TmpexpScanIntens4(scCount)=TmpexpScanIntens3; TmpexpScanIntens4(scCount)=TmpexpScanIntens3;

View File

@@ -2,7 +2,9 @@
function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ... function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ...
par4GblFnc8c(parMat,tptLength,~,selScanNumLst,~,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,~,... par4GblFnc8c(parMat,tptLength,~,selScanNumLst,~,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,~,...
TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,scCount,tifFileLstP4,~,ImParMat, ... TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,scCount,tifFileLstP4,~,ImParMat, ...
numRows,numCols,scLst,resDir,expDir,~, Tmpsbdg) numRows,numCols,scLst,easyResultsDir,scansDir,~, Tmpsbdg)
global printResultsDir
selScan=selScanNumLst(scCount); selScan=selScanNumLst(scCount);
tptLength0=length(tifFileLstP4{scCount}); tptLength0=length(tifFileLstP4{scCount});
@@ -21,13 +23,13 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
scLst; scLst;
scLst(scCount) scLst(scCount)
char(scLst(scCount)) char(scLst(scCount))
char(fullfile(expDir,char(scLst(scCount)))) char(fullfile(scansDir,char(scLst(scCount))))
expDir; scansDir;
swCatch=0; swCatch=0;
nndx=nndx+1; nndx=nndx+1;
tifFile=char(fullfile(expDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt))); tifFile=char(fullfile(scansDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt)));
try try
info=imfinfo(tifFile); %('D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif') info=imfinfo(tifFile); % D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif
catch ME catch ME
% Note: During parallel operation Matlab will not open file (fid) % Note: During parallel operation Matlab will not open file (fid)
% etc. Therefore error message text will not be written.The only way % etc. Therefore error message text will not be written.The only way
@@ -35,7 +37,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
% the ..Main8c script outside the parfor loop and print to file from % the ..Main8c script outside the parfor loop and print to file from
% there. Consequently for now it only prints error to file when one % there. Consequently for now it only prints error to file when one
% edits p4loop8c.m from 'parfor' to ordinary 'for' loop % edits p4loop8c.m from 'parfor' to ordinary 'for' loop
fFail=((fullfile(resDir,'PrintResults','ImageFileReadFailure.txt'))); fFail=((fullfile(printResultsDir,'ImageFileReadFailure.txt')));
fid=fopen(fFail,'a'); %create,open and append fid=fopen(fFail,'a'); %create,open and append
% fprintf(fid,'%s \n',char(tifFile)) % fprintf(fid,'%s \n',char(tifFile))
fclose(fid) fclose(fid)
@@ -54,11 +56,12 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
end end
end end
% clear tifFileLst; % Clear tifFileLst;
tifFileLst=cell(nndx,1); tifFileLst=cell(nndx,1);
f={sortrows(e,2)}; f={sortrows(e,2)};
tifFileLst=f{1,1}(:,1); tifFileLst=f{1,1}(:,1);
areaOfIntensAboveBG=zeros(24,16,length(tifFileLst)); areaOfIntensAboveBG=zeros(24,16,length(tifFileLst));
% Calculate Time series for each Plate of Selected Scan % Calculate Time series for each Plate of Selected Scan
lastPlateOnScan=1; %Ncode lastPlateOnScan=1; %Ncode
tSeriesv=[]; t0Seriesv=[]; tSeriesv=[]; t0Seriesv=[];
@@ -69,7 +72,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
t0Seriesv=((scTmNumv-scTmNumv(1))*24); t0Seriesv=((scTmNumv-scTmNumv(1))*24);
end end
% added to jump over and fill data for invalid Sscan(plate runs % Added to jump over and fill data for invalid Sscan(plate runs
if tptLength>=3 if tptLength>=3
% Create blank scan % Create blank scan
ImHeigth=2075; ImHeigth=2075;
@@ -83,7 +86,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
% Execute Image conversion into Intensity Data % Execute Image conversion into Intensity Data
[Tmpsbdg2, scanIntens, ~, ~, ~, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ... [Tmpsbdg2, scanIntens, ~, ~, ~, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ...
NIscanIntensBGpar4GblFnc(Fflg,tifFileLst, ImParMat, PTmapPos,optCirMask,diaExt,doCircle,cirPixA,numRows,numCols,ImHeigth,ImWidth,cirMask, ... NIscanIntensBGpar4GblFnc(Fflg,tifFileLst, ImParMat, PTmapPos,optCirMask,diaExt,doCircle,cirPixA,numRows,numCols,ImHeigth,ImWidth,cirMask, ...
tptLength,selScan,Empsc,TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,resDir, Tmpsbdg); tptLength,selScan,Empsc,TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,easyResultsDir, Tmpsbdg);
TmpexpScanIntens3=TmpexpScanIntens2; TmpexpScanIntens3=TmpexpScanIntens2;
TmpFexpScanSpots3=TmpFexpScanSpots2; TmpFexpScanSpots3=TmpFexpScanSpots2;
@@ -100,21 +103,19 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
% NIcheck: Check for bad scans at time points (swapped plates etc.) % NIcheck: Check for bad scans at time points (swapped plates etc.)
% Set up cell arrays for storing each plate in each Scan ..(scan,plate) % Set up cell arrays for storing each plate in each Scan ..(scan,plate)
SWprint=0; SWprint=0;
if SWprint==1
wkDir=pwd;
cd (fullfile(resDir,'PrintResults'));
end
% Construct Legacy ...Intens.txt file % Construct Legacy ...Intens.txt file
if SWprint==1 if SWprint==1
filename=(strcat('Plate',num2str(selScan),'_Intens.txt')); filename=fullfile(easyResultsDir,'PrintResults',(strcat('Plate',num2str(selScan),'_Intens.txt')));
fid=fopen(filename,'w'); fid=fopen(filename,'w');
end end
if length(size(plate))==2 %Only two dims if only one image
if length(size(plate))==2 % only two dims if only one image
numOfImages=1; numOfImages=1;
else else
numOfImages=size(plate,3); numOfImages=size(plate,3);
end end
CFscanIntens=zeros(384,numOfImages); CFscanIntens=zeros(384,numOfImages);
locIndx=0; pl=1; locIndx=0; pl=1;
for n=1:numCols % Ncode changed to 16 for Vert for n=1:numCols % Ncode changed to 16 for Vert
@@ -148,10 +149,10 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
% for p=1:lastPlateOnScan % for p=1:lastPlateOnScan
if SWprint==1 if SWprint==1
if SWgrowthArea==1 if SWgrowthArea==1
filename=(strcat('Plate',num2str(selScan),'_Areas.txt')); filename=fullfile(printResultsDir,(strcat('Plate',num2str(selScan),'_Areas.txt')));
else else
filename=(strcat('ALTgrowthA_Scan',num2str(selScan),'_Plate',num2str(1),'_Areas.txt')); filename=fullfile(printResultsDir,(strcat('ALTgrowthA_Scan',num2str(selScan),'_Plate',num2str(1),'_Areas.txt')));
filename=(strcat('ALTgrowthA_Plate',num2str(selScan),'_Plate','_Areas.txt')); filename=fullfile(printResultsDir,(strcat('ALTgrowthA_Plate',num2str(selScan),'_Plate','_Areas.txt')));
end end
fid=fopen(filename,'w'); fid=fopen(filename,'w');
end end
@@ -170,11 +171,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
if SWprint==1 if SWprint==1
fclose(fid); fclose(fid);
end % fclose('all'); % TODO do we need this?
if SWprint==1
cd(wkDir);
fclose('all');
end end
% AutoImCF curveFit kickoff setup % AutoImCF curveFit kickoff setup
@@ -186,7 +183,6 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
suffix=strcat('Scan', num2str(selScan),'_Plate', num2str(1)); % char(QspLst(n)); suffix=strcat('Scan', num2str(selScan),'_Plate', num2str(1)); % char(QspLst(n));
AUCfinalTime=96; AUCfinalTime=96;
arrayFormat=384; arrayFormat=384;
currDirResults=fullfile(resDir,'PrintResults');
% Version compatability fixes % Version compatability fixes
%{ %{
@@ -225,10 +221,10 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
% CFscanIntens % CFscanIntens
% Call CurveFit routine % Call CurveFit routine
% NCfitImCF(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan,sols) %,scan)%, scPltList) outputDirectory; % NCfitImCF(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, printResultsDir, autoImCFlag, selScan,sols) %,scan)%, scPltList) outputDirectory;
% [scanTmp2]=NCfitImCFparforFailGbl(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan, sols, scanTmp); %,scan)%, scPltList) outputDirectory; % [scanTmp2]=NCfitImCFparforFailGbl(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, printResultsDir, autoImCFlag, selScan, sols, scanTmp); %,scan)%, scPltList) outputDirectory;
[par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC2,outCstd2]= ... [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC2,outCstd2]= ...
NCfitImCFparforFailGbl2(parMat,times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan, sols); %,scan)%, scPltList) outputDirectory; NCfitImCFparforFailGbl2(parMat,times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, printResultsDir, autoImCFlag, selScan, sols); %,scan)%, scPltList) outputDirectory;
else %fill with default values when an invalid plate scan occurs else %fill with default values when an invalid plate scan occurs
CFscanIntens=zeros(16,24); CFscanIntens=zeros(16,24);
Ag=zeros(1,384); Ag=zeros(1,384);

View File

@@ -1,43 +1,22 @@
%% CALLED BY EASYconsole.m %% %% CALLED BY EASYconsole.m %%
w=pwd;
%function NImStartupImCF02par4Gbl
Fflg=1; %0;
fclose('all'); %close all open files
clear('plate2', 'scanIntens','Scanfiles','pathname','tifFileLstP4')
%global SWsingleSc
global SWgrowthArea global SWgrowthArea
global scLst global scLst
global ImParMat global ImParMat
%global CSearchRange global scansDir
%global CSrchRng global matFile
global expDir
global SWnewExp
global openExpfile
global openExppath
global newExpfile
global newExppath
global ExpOutmat
global fhconsole global fhconsole
global ExpPath global easyResultsDir
global resDir global pointMapsResultsDir
global wCodeDir global fotosResultsDir
global matDir global matDir
global ImWidth global ImWidth
global ImHeigth global ImHeigth
global numRows; global numRows
global numCols; global numCols
%global SWprintLeg
global scan global scan
%global scanSize
global scanMax global scanMax
global tptLength global tptLength
%global scanPar4x
%global sols
%global CFmeth
numRows=24; % for Single Vertical numRows=24; % for Single Vertical
numCols=16; % for Single Vertical numCols=16; % for Single Vertical
@@ -48,22 +27,31 @@ radius=14;
ImParMat(10)=radius; ImParMat(10)=radius;
ImParMat(11)=doCircle; ImParMat(11)=doCircle;
% TODO what is this for?
Fflg=1;
% Don't think we need this
% fclose('all'); % close all open files
% Unset some vars just in case they are already set
clear('scanIntens','Scanfiles','pathname','tifFileLstP4')
try try
clf(fhconsole,'reset') clf(fhconsole,'reset')
catch ME
end
close
EASYconsole
try
load(ExpOutmat)
copyfile(ExpOutmat,(fullfile(matDir,'BkUp',strcat((num2str(datenum(now))),'.mat'))))
catch catch
end end
% No idea why we're doing this so commenting out
% close
% EASYconsole
if exist(matFile, 'file')
bkUpMatFile=fullfile(matDir,'BkUp',matFile)
copyfile(matFile,(fullfile(matDir,'BkUp',matFile)))
end
try try
load(fullfile(resDir,'Fotos','Nbdg')) %Modified to load from 'Fotos' 20_0819 load(fullfile(easyResultsDir,'Fotos','Nbdg')) %Modified to load from 'Fotos' 20_0819
catch catch
% Reloacated from 'PTmats' to prevent potential overwrite when PTmats is % Reloacated from 'PTmats' to prevent potential overwrite when PTmats is
% copied into new job when the PT template is about the same. We also % copied into new job when the PT template is about the same. We also
@@ -74,35 +62,34 @@ catch
% A copy of Ndbg.mat is placed also saved to the 'PTmats' directory % A copy of Ndbg.mat is placed also saved to the 'PTmats' directory
% after each run to allow previous version of EASY to access data made % after each run to allow previous version of EASY to access data made
% by EASY versions after 20_0819. % by EASY versions after 20_0819.
load(fullfile(resDir,'PTmats','Nbdg')) %Left in to accomodate loads of work before 20_0819 load(fullfile(easyResultsDir,'PTmats','Nbdg')) %Left in to accomodate loads of work before 20_0819
end end
% Load Fotos stored data % Load Fotos stored data
try try
load(fullfile(resDir,'Fotos','Coordinates')) load(fullfile(easyResultsDir,'Fotos','Coordinates'))
catch catch
end end
try try
load(fullfile(resDir,'Fotos','BGatTpts')) load(fullfile(easyResultsDir,'Fotos','BGatTpts'))
catch catch
end end
try try
load(fullfile(resDir,'Fotos','anlZones')) load(fullfile(easyResultsDir,'Fotos','anlZones'))
catch catch
end end
% autoImCF % autoImCF
try try
load(fullfile(resDir,'PTmats','NCFparms')) load(fullfile(easyResultsDir,'PTmats','NCFparms'))
catch ME catch ME
load parameters load parameters
end end
% Get Print Times % Get Print Times
PrintTimes=[]; PrintTimes=[];
expDir=fullfile(ExpPath);
scLst={}; scLst={};
% Parameter Entry % Parameter Entry
NImParamRadiusGui(expDir) % Ncode 122111replaced removed ,numOfPrtTimes) NImParamRadiusGui(scansDir) % Ncode 122111replaced removed ,numOfPrtTimes)
width=24; width=24;
widthEx=width-1; % width extention from reference point widthEx=width-1; % width extention from reference point
dither=ImParMat(6); dither=ImParMat(6);
@@ -131,24 +118,15 @@ else
end end
SWgrowthArea=ImParMat(9); SWgrowthArea=ImParMat(9);
load(fullfile(resDir,'PTmats','NPTmapSearch')) load(fullfile(pointMapsResultsDir,'NPTmapSearch'))
PTmapPos=detPos; PTmapPos=detPos;
selScanNumLst=[]; selScanNumLst=[];
Scanfiles=[]; Scanfiles=[];
pathname=[]; pathname=[];
% TODO BCR this probably doesn't need to be here but I'm leaving it for now
if ispc
cd(char(strcat(expDir,scLst(1))))
elseif (isunix || ismac)
cd(fullfile(expDir,cell2mat(scLst(1))));
end
Scanfiles=[];
pathname=[];
for ii=1:length(scLst) for ii=1:length(scLst)
if (SWsingleSc == 1) if (SWsingleSc == 1)
% TODO proably need to make this more explicit with paths
[Scanfiles, pathname]=uigetfile('*.bmp', 'Select files','MultiSelect','on'); % change '*hr*.bmp' 12/20/2011 [Scanfiles, pathname]=uigetfile('*.bmp', 'Select files','MultiSelect','on'); % change '*hr*.bmp' 12/20/2011
if ischar(Scanfiles) if ischar(Scanfiles)
scd=imread(char(Scanfiles)); scd=imread(char(Scanfiles));
@@ -159,15 +137,13 @@ for ii=1:length(scLst)
end end
ImHeigth=size(scd,1); ImHeigth=size(scd,1);
ImWidth=size(scd,2); ImWidth=size(scd,2);
sc=scd(1:ImHeigth,1:ImWidth); %?Not used RefOnly sc=scd(1:ImHeigth,1:ImWidth);
end end
cd(w);
numFiles=size(Scanfiles,2); numFiles=size(Scanfiles,2);
% Initialize tifFilesLst for parfor loop % Initialize tifFilesLst for parfor loop
dir(fullfile(expDir, char(scLst(ii)), '*.bmp')); dir(fullfile(scansDir, char(scLst(ii)), '*.bmp'));
numFiles=length(tifFileLst4MultiT); numFiles=length(tifFileLst4MultiT);
tptLength=numFiles; tptLength=numFiles;
tifFileLstP4{ii}={tifFileLst4MultiT.name}; tifFileLstP4{ii}={tifFileLst4MultiT.name};
@@ -179,7 +155,7 @@ for jj=1:numScans %startScan:numScans
end end
selScanNumLst2=selScanNumLst; % function passthrough, passback to par4gbl_Main 20_0205 selScanNumLst2=selScanNumLst; % function passthrough, passback to par4gbl_Main 20_0205
% PREALLOCATION % Preallocation
scCount=[]; scCount=[];
TmpexpScanIntens00=cell(1); % cell(1,scanMax); TmpexpScanIntens00=cell(1); % cell(1,scanMax);
TmpFexpScanSpots00=cell(1); % cell(1,scanMax); TmpFexpScanSpots00=cell(1); % cell(1,scanMax);
@@ -206,7 +182,7 @@ CFscanIntens=zeros(16,24);
[p4L4,TmpexpScanIntens5,TmpFexpScanSpots5,TmpFexpScanBMtp5,TmpanlZoneRefs5,Tmpsbdg5]= ... [p4L4,TmpexpScanIntens5,TmpFexpScanSpots5,TmpFexpScanBMtp5,TmpanlZoneRefs5,Tmpsbdg5]= ...
p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,scCount,tifFileLstP4,pathname,ImParMat, ... TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,scCount,tifFileLstP4,pathname,ImParMat, ...
numRows,numCols,scLst,resDir,expDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ... numRows,numCols,scLst,easyResultsDir,scansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ...
Tmpsbdg00,Tmpsbdg4); Tmpsbdg00,Tmpsbdg4);
for scanCnt=1:numScans for scanCnt=1:numScans
@@ -241,22 +217,22 @@ for scanCnt=1:numScans
end end
end end
%SAVE DATA in .mat files % Save data in .mat files
save(ExpOutmat,'scan'); save(matFile,'scan');
% save((fullfile(resDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time % save((fullfile(easyResultsDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time
save((fullfile(resDir,'Fotos','Nbdg')), 'sbdg'); save((fullfile(easyResultsDir,'Fotos','Nbdg')), 'sbdg');
save((fullfile(resDir,'Fotos','Coordinates')),'FexpScanSpots') %Saves frames at each tPt save((fullfile(easyResultsDir,'Fotos','Coordinates')),'FexpScanSpots') %Saves frames at each tPt
save((fullfile(resDir,'Fotos','BGatTpts')),'FexpScanBMtp') save((fullfile(easyResultsDir,'Fotos','BGatTpts')),'FexpScanBMtp')
save((fullfile(resDir,'Fotos','anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt save((fullfile(easyResultsDir,'Fotos','anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt
%Print FitResults ******************************************************* % Print FitResults
fileExt='.txt'; fileExt='.txt';
filePrefix='FitResults_'; filePrefix='FitResults_';
for scanCnt=1:numScans for scanCnt=1:numScans
selScan=p4L4{16,scanCnt}; % determine the actual scan in the scanCnt parfor distributed "id" selScan=p4L4{16,scanCnt}; % determine the actual scan in the scanCnt parfor distributed "id"
fileSuffix=strcat('Scan', num2str(selScan),'_Plate', num2str(1)); fileSuffix=strcat('Scan', num2str(selScan),'_Plate', num2str(1));
fileNamePlate=[filePrefix fileSuffix fileExt]; fileNamePlate=[filePrefix fileSuffix fileExt];
fileName=fullfile(resDir,'PrintResults', fileNamePlate); %[outputDirectory fileNamePlate]; fileName=fullfile(easyResultsDir,'PrintResults', fileNamePlate); % [outputDirectory fileNamePlate];
% This,fprint for loop,is an very old legacy feature which slows processing. Could be % This,fprint for loop,is an very old legacy feature which slows processing. Could be
% removed but allows easy observation of how a run is progressing and can be % removed but allows easy observation of how a run is progressing and can be