Rename scansDir
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user