diff --git a/workflow/apps/matlab/easy/DgenResults.m b/workflow/apps/matlab/easy/DgenResults.m index bee0ac5c..df8940f9 100755 --- a/workflow/apps/matlab/easy/DgenResults.m +++ b/workflow/apps/matlab/easy/DgenResults.m @@ -1,7 +1,7 @@ %% CALLED BY EASYconsole.m %% % Updated 240724 Bryan C Roessler to improve file operations and portability % -global scansDir +global projectScansDir global matFile global defImParMat global printResultsDir @@ -46,16 +46,16 @@ for n=1:size(scan,2) end end -% if length(scansDir) == max(strfind(scansDir,'\')) -% localscansDir=scansDir(1:end-1); +% if length(projectScansDir) == max(strfind(projectScansDir,'\')) +% localprojectScansDir=projectScansDir(1:end-1); % else -% localscansDir=scansDir; +% localprojectScansDir=projectScansDir; % end % TODO this seems weird -expNm=scansDir(max(strfind(scansDir,'/'))+1:end); -drivePos=min(strfind(scansDir,'/')); -drive=scansDir(1:(drivePos-1)); +expNm=projectScansDir(max(strfind(projectScansDir,'/'))+1:end); +drivePos=min(strfind(projectScansDir,'/')); +drive=projectScansDir(1:(drivePos-1)); DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles'); % Added to allow backward compatability @@ -75,7 +75,7 @@ if isequal(opt,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end if isequal(opt,'Res')||isequal(opt,'Both') fprintf(fid,'%d\t',ln); % Results header - fprintf(fid,'%s\t\n',scansDir); + fprintf(fid,'%s\t\n',projectScansDir); ln=ln+1; fprintf(fid,'%d\t',ln); end @@ -383,7 +383,7 @@ try if isequal(opt,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end %121012 Combo if isequal(opt,'Res')||isequal(opt,'Both') %print Results fprintf(fid,'%d\t',ln); %Results header - fprintf(fid,'%s\t\n',scansDir); + fprintf(fid,'%s\t\n',projectScansDir); ln=ln+1; fprintf(fid,'%d\t',ln); end diff --git a/workflow/apps/matlab/easy/EASYconsole.m b/workflow/apps/matlab/easy/EASYconsole.m index 7cade239..cf96ff6e 100644 --- a/workflow/apps/matlab/easy/EASYconsole.m +++ b/workflow/apps/matlab/easy/EASYconsole.m @@ -3,9 +3,9 @@ function varargout = EASYconsole(varargin) global easyDir - global scansDir + global projectScansDir global easyResultsDir - global easyProject + global easyProjectName global fotosResultsDir global figsResultsDir global pointMapsResultsDir @@ -28,7 +28,8 @@ function varargout = EASYconsole(varargin) parentDir=fullfile(parentDir); % ../easy/apps userName=getenv('USER'); dt=datetime; - todayStr=char(dt, 'yyyyMMdd'); % This should match the parent workflow script + todayStr=char(dt, 'yyyyMMdd'); % This should match the parent workflow script 'hardcode' + outDir=fullfile(parentDir, '..','..', 'out'); % This should match the parent workflow script 'hardcode' debug=1; if debug @@ -39,27 +40,27 @@ function varargout = EASYconsole(varargin) fprintf('This script name: %s\n', easyFileName); - % Set scansDir (project scans directory) intelligently + % Set projectScansDir (project scans directory) intelligently if ~isempty(getenv('PROJECT_SCANS_DIR')) - scansDir=fullfile(getenv('PROJECT_SCANS_DIR')); - if exist(scansDir, 'dir') - fprintf('Using scans directory: %s from environment variable PROJECT_SCANS_DIR\n', scansDir); + projectScansDir=fullfile(getenv('PROJECT_SCANS_DIR')); + if exist(projectScansDir, 'dir') + fprintf('Using scans directory: %s from environment variable PROJECT_SCANS_DIR\n', projectScansDir); disp('This usually indicates that we are in module mode'); if isempty(getenv('PROJECT')) - dirInfo=fileparts(scansDir); + dirInfo=fileparts(projectScansDir); project=dirInfo.name; end else disp('WARNING: PROJECT_SCANS_DIR does not exist'); end elseif ~isempty(getenv('PROJECT')) % for standalone mode - % scansDir=fullfile(parentDir, '..', '..', 'scans', getenv('PROJECT') 'out', 'easy', getenv('PROJECT')); - scansDir=fullfile(parentDir, '..', '..', 'scans', getenv('PROJECT')); + % projectScansDir=fullfile(parentDir, '..', '..', 'scans', getenv('PROJECT') 'out', 'easy', getenv('PROJECT')); project=getenv('PROJECT'); - fprintf('Using project path: %s from environment variable PROJECT\n', scansDir); + projectScansDir=fullfile(parentDir, '..', '..', 'scans', project); + fprintf('Using project path: %s from environment variable PROJECT\n', projectScansDir); disp('This usually indicates that we are in standalone mode'); else - % TODO Lots of this is hardcoded logic, this TODO is just a reminder to change this block + % TODO Lots of hardcoded logic, this TODO is just a reminder to change this block % when changing EASY and other variables in the parent script fprintf('WARNING: Running in standalone mode without PROJECT or PROJECT_SCANS_DIR environment variables (not recommended)\n'); fprintf('Beginning parent scans directory search\n'); @@ -85,8 +86,8 @@ function varargout = EASYconsole(varargin) whos if ~isempty(matchedDirs) fprintf('Found a non-empty scans directory in our list: %s\n', d); - fprintf('Setting scansDir to %s\n', char(d)); - scansDir=fullfile(d); + fprintf('Setting projectScansDir to %s\n', char(d)); + projectScansDir=fullfile(d); end fprintf('Scanning inside %s for a project directory\n', d); sortedMatchedDirs=sortrows(matchedDirs); @@ -120,26 +121,27 @@ function varargout = EASYconsole(varargin) easyResultsDir=fullfile(getenv('EASY_RESULTS_DIR')); fprintf('Using output directory: %s from environment variable EASY_RESULTS_DIR\n', easyResultsDir); else - easyProject=strcat(todayStr,'_',userName,'_', project); - easyResultsDir=fullfile(parentDir, '..', '..', 'out', project, 'easy', easyProject); + easyProjectName=strcat(todayStr,'_',userName,'_', project); + easyResultsDir=fullfile(parentDir, '..', '..', 'out', project, 'easy', easyProjectName); if exist(easyResultsDir, 'dir') fprintf('WARNING: EASY results dir %s already exists\n', easyResultsDir); disp('Files in this directory may be overwritten') fprintf('Using output directory: %s\n', easyResultsDir); end end + if ~isempty(getenv('MASTER_PLATE_FILE')) masterPlateFile=fullfile(getenv('MASTER_PLATE_FILE')); fprintf('Using drug media file: %s from environment variable MASTER_PLATE_FILE\n', masterPlateFile); else % Try to find MasterPlate_ file on our own - mp=fullfile(scansDir, strcat('MasterPlate_', project,'.xlsx')); + mp=fullfile(projectScansDir, strcat('MasterPlate_', project,'.xlsx')); if exist(mp, 'file') masterPlateFile=mp; fprintf('Using drug media file: %s from internal logic\n', masterPlateFile); else - fprintf('WARNING: Have you created a MasterPlate_ file in %s/easy_in/?\n', scansDir); + fprintf('WARNING: Have you created a MasterPlate_ file in %s/easy_in/?\n', projectScansDir); end end @@ -147,12 +149,12 @@ function varargout = EASYconsole(varargin) drugMediaFile=fullfile(getenv('DRUG_MEDIA_FILE')); fprintf('Using drug media file: %s from environment variable DRUG_MEDIA_FILE\n', drugMediaFile); else - dm=fullfile(scansDir,'easy_in',strcat('DrugMedia_', project,'.xlsx')); + dm=fullfile(projectScansDir,'easy_in',strcat('DrugMedia_', project,'.xlsx')); if exist(mp, 'file') drugMediaFile=dm; fprintf('Using drug media file: %s from internal logic\n', drugMediaFile); else - fprintf('WARNING: Have you created a DrugMedia_ file in %s/MasterPlateFiles/?\n', scansDir); + fprintf('WARNING: Have you created a DrugMedia_ file in %s/MasterPlateFiles/?\n', projectScansDir); end end @@ -214,7 +216,7 @@ end % varargin--input arguments to EASYconsole (see VARARGIN) function EASYconsole_OpeningFcn(hObject, ~, handles, varargin) global fhconsole - global scansDir + global projectScansDir % Choose default command line output for EASYconsole handles.output=hObject; @@ -229,8 +231,8 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin) % Pulled this out of the opening function % Seems better to wait until we have our vars set though? - if exist('scansDir','var') && ~isempty(scansDir) - set(fhconsole,'Name', sprintf('EASYconsole - %s', scansDir)); + if exist('projectScansDir','var') && ~isempty(projectScansDir) + set(fhconsole,'Name', sprintf('EASYconsole - %s', projectScansDir)); else set(fhconsole,'Name','EASYconsole - No Active Experiment.') end @@ -267,22 +269,22 @@ function NewExpDat_Callback(~, ~, ~) global fhconsole global scan global userName + global todayStr % 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')); - [inputFile,inputPath]=uiputfile('.mat'); + [matfile,easyResultsDir]=uiputfile('.mat'); inputFileName=strrep(inputFile,'.mat',''); % easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName); - + project=basename(easyResultsDir); % Set paths - scansDir=fullfile(inputPath); - easyResultsDir=fullfile(scansDir,easyResultsDirName); matDir=fullfile(easyResultsDir,'matResults'); + easyProjectName=strcat(todayStr,'_',userName,'_', project); matFile=fullfile(matDir,strcat(todayStr,'_',userName,'_',inputFile)); - %***Added for 'parfor global' to preallocate 'scan' structure 20-0123***** - nlist=dir(fullfile(scansDir,'*')); + % Added for 'parfor global' to preallocate 'scan' structure + nlist=dir(fullfile(projectScansDir,'*')); nnn=0; for n=1:size(nlist,1) if (~isempty(str2num(nlist(n).name))) @@ -347,8 +349,8 @@ function LoadDatFile_Callback(~, ~, ~) matFile=fullfile(inputPath,inputFile); load(matFile); easyResultsDir=fullfile(matDir,'..'); - scansDir=fullfile(matDir,'..', '..'); - point + project=basename(easyResultsDir); + projectScansDir=fullfile(easyResultsDir, '..', '..', 'scans', project); % TODO this is pretty hacky and needs something more explicit if isfolder(fullfile(matDir, '..','..','1')) % If Inovation Vrobot Then diff --git a/workflow/apps/matlab/easy/NCdisplayGui.m b/workflow/apps/matlab/easy/NCdisplayGui.m index 2f445654..b20efb60 100755 --- a/workflow/apps/matlab/easy/NCdisplayGui.m +++ b/workflow/apps/matlab/easy/NCdisplayGui.m @@ -1,5 +1,5 @@ %% CALLED WHEN ACCESSING 'CurveFit Display' %% -function [scLst, row, col] = NCdisplayGui(scansDir) +function [scLst, row, col] = NCdisplayGui(projectScansDir) xPos=0.05; btnWid=0.10; btnHt=0.05; @@ -49,7 +49,7 @@ function [scLst, row, col] = NCdisplayGui(scansDir) end % Read in numeric folder names - nlist=dir(fullfile(scansDir,'*')); + nlist=dir(fullfile(projectScansDir,'*')); nnn=0; for n=1:size(nlist,1) if (~isempty(str2num(nlist(n).name))) diff --git a/workflow/apps/matlab/easy/NCsingleDisplay.m b/workflow/apps/matlab/easy/NCsingleDisplay.m index e0e71aff..a042018b 100755 --- a/workflow/apps/matlab/easy/NCsingleDisplay.m +++ b/workflow/apps/matlab/easy/NCsingleDisplay.m @@ -4,7 +4,7 @@ global scan hf=figure; % Parameter Entry -[scLst, row, col]=NCdisplayGui(scansDir); +[scLst, row, col]=NCdisplayGui(projectScansDir); close(hf) selSpot=(row-1)*24 + col; for iPlate=1:length(scLst) diff --git a/workflow/apps/matlab/easy/NImParamRadiusGui.m b/workflow/apps/matlab/easy/NImParamRadiusGui.m index 37b4958a..8a9fd25a 100755 --- a/workflow/apps/matlab/easy/NImParamRadiusGui.m +++ b/workflow/apps/matlab/easy/NImParamRadiusGui.m @@ -1,7 +1,7 @@ %% CALLED BY par4Gbl_Main8c.m %% % TODO Should some of these vars be pulled out higher so they are easier to change? % -function NImParamRadiusGui(scansDir) +function NImParamRadiusGui(projectScansDir) global SWsingleSc global SWgrowthArea global scan @@ -143,7 +143,7 @@ function NImParamRadiusGui(scansDir) end % Ncode 12_0120 for reading in numeric folder names - nlist=dir(fullfile(scansDir,'*')); + nlist=dir(fullfile(projectScansDir,'*')); nnn=0; for n=1:size(nlist,1) if (~isempty(str2num(nlist(n).name))) diff --git a/workflow/apps/matlab/easy/p4loop8c.m b/workflow/apps/matlab/easy/p4loop8c.m index 7436f4a3..1ee18350 100755 --- a/workflow/apps/matlab/easy/p4loop8c.m +++ b/workflow/apps/matlab/easy/p4loop8c.m @@ -3,7 +3,7 @@ function[p4L4,... TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4,Tmpsbdg4]= ... p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,~,tifFileLstP4,pathname,ImParMat, ... - numRows,numCols,scLst,easyResultsDir,scansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, Tmpsbdg00, Tmpsbdg4) + numRows,numCols,scLst,easyResultsDir,projectScansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, Tmpsbdg00, Tmpsbdg4) p4L0=p4L00; TmpexpScanIntens0=TmpexpScanIntens00; TmpFexpScanSpots0=TmpFexpScanSpots00; @@ -25,7 +25,7 @@ parfor (scCount=1:numScans,parforArg) [p4L3,TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ... par4GblFnc8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... TmpexpScanIntens0,TmpFexpScanSpots0,TmpFexpScanBMtp0,TmpanlZoneRefs0,scCount,tifFileLstP4,pathname,ImParMat, ... - numRows,numCols, scLst,easyResultsDir,scansDir, p4L0,Tmpsbdg0); + numRows,numCols, scLst,easyResultsDir,projectScansDir, p4L0,Tmpsbdg0); p4L4(:,scCount)=p4L3; % (:,scCount); TmpexpScanIntens4(scCount)=TmpexpScanIntens3; diff --git a/workflow/apps/matlab/easy/par4GblFnc8c.m b/workflow/apps/matlab/easy/par4GblFnc8c.m index 7df84c91..f5048f01 100755 --- a/workflow/apps/matlab/easy/par4GblFnc8c.m +++ b/workflow/apps/matlab/easy/par4GblFnc8c.m @@ -2,7 +2,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ... par4GblFnc8c(parMat,tptLength,~,selScanNumLst,~,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,~,... TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,scCount,tifFileLstP4,~,ImParMat, ... - numRows,numCols,scLst,easyResultsDir,scansDir,~, Tmpsbdg) + numRows,numCols,scLst,easyResultsDir,projectScansDir,~, Tmpsbdg) global printResultsDir @@ -23,11 +23,11 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR scLst; scLst(scCount) char(scLst(scCount)) - char(fullfile(scansDir,char(scLst(scCount)))) - scansDir; + char(fullfile(projectScansDir,char(scLst(scCount)))) + projectScansDir; swCatch=0; nndx=nndx+1; - tifFile=char(fullfile(scansDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt))); + tifFile=char(fullfile(projectScansDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt))); try info=imfinfo(tifFile); % D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif catch ME diff --git a/workflow/apps/matlab/easy/par4Gbl_Main8c.m b/workflow/apps/matlab/easy/par4Gbl_Main8c.m index ca84f61f..72be05a8 100755 --- a/workflow/apps/matlab/easy/par4Gbl_Main8c.m +++ b/workflow/apps/matlab/easy/par4Gbl_Main8c.m @@ -3,7 +3,7 @@ global SWgrowthArea global scLst global ImParMat -global scansDir +global projectScansDir global matFile global fhconsole global easyResultsDir @@ -81,7 +81,7 @@ PrintTimes=[]; scLst={}; % Parameter Entry -NImParamRadiusGui(scansDir); % Ncode 122111replaced removed ,numOfPrtTimes) +NImParamRadiusGui(projectScansDir); % Ncode 122111replaced removed ,numOfPrtTimes) width=24; widthEx=width-1; % width extention from reference point dither=ImParMat(6); @@ -135,7 +135,7 @@ for ii=1:length(scLst) numFiles=size(Scanfiles,2); % Initialize tifFilesLst for parfor loop - dir(fullfile(scansDir, char(scLst(ii)), '*.bmp')); + dir(fullfile(projectScansDir, char(scLst(ii)), '*.bmp')); numFiles=length(tifFileLst4MultiT); tptLength=numFiles; tifFileLstP4{ii}={tifFileLst4MultiT.name}; @@ -174,7 +174,7 @@ CFscanIntens=zeros(16,24); [p4L4,TmpexpScanIntens5,TmpFexpScanSpots5,TmpFexpScanBMtp5,TmpanlZoneRefs5,Tmpsbdg5]= ... p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ... TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,scCount,tifFileLstP4,pathname,ImParMat, ... - numRows,numCols,scLst,easyResultsDir,scansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ... + numRows,numCols,scLst,easyResultsDir,projectScansDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ... Tmpsbdg00,Tmpsbdg4); for scanCnt=1:numScans diff --git a/workflow/qhtcp-workflow b/workflow/qhtcp-workflow index 2d2d802d..dd835b3f 100755 --- a/workflow/qhtcp-workflow +++ b/workflow/qhtcp-workflow @@ -593,7 +593,7 @@ easy() { # Prompt user for suffix echo "Default EASY results directory: $EASY_RESULTS_DIR" - read -r -p "Enter a custom suffix and/or hit enter to use the default (no suffix): " EASY_SUFFIX + ((YES)) || read -r -p "Enter a custom suffix and/or hit enter to use the default (no suffix): " EASY_SUFFIX [[ -n $EASY_SUFFIX ]] && EASY_RESULTS_DIR+="_$EASY_SUFFIX" # Backup and create EASY results dirs