EASY refactor: First attempt
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
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,resDir,expDir,~, Tmpsbdg)
|
||||
numRows,numCols,scLst,easyResultsDir,scansDir,~, Tmpsbdg)
|
||||
|
||||
global printResultsDir
|
||||
|
||||
selScan=selScanNumLst(scCount);
|
||||
tptLength0=length(tifFileLstP4{scCount});
|
||||
%tptLength=numFiles;
|
||||
% tptLength=numFiles;
|
||||
tifFileLst={tifFileLstP4(scCount)};
|
||||
|
||||
% Extract the Imaging time stamps from selected tif files
|
||||
@@ -21,13 +23,13 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
scLst;
|
||||
scLst(scCount)
|
||||
char(scLst(scCount))
|
||||
char(fullfile(expDir,char(scLst(scCount))))
|
||||
expDir;
|
||||
char(fullfile(scansDir,char(scLst(scCount))))
|
||||
scansDir;
|
||||
swCatch=0;
|
||||
nndx=nndx+1;
|
||||
tifFile=char(fullfile(expDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt)));
|
||||
tifFile=char(fullfile(scansDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt)));
|
||||
try
|
||||
info=imfinfo(tifFile); %('D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif')
|
||||
info=imfinfo(tifFile); % D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif
|
||||
catch ME
|
||||
% Note: During parallel operation Matlab will not open file (fid)
|
||||
% etc. Therefore error message text will not be written.The only way
|
||||
@@ -35,30 +37,31 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
% the ..Main8c script outside the parfor loop and print to file from
|
||||
% there. Consequently for now it only prints error to file when one
|
||||
% 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
|
||||
%fprintf(fid,'%s \n',char(tifFile))
|
||||
% fprintf(fid,'%s \n',char(tifFile))
|
||||
fclose(fid)
|
||||
nndx=nndx-1;
|
||||
swCatch=1;
|
||||
rep=getReport(ME, 'basic');
|
||||
rep=strcat('Read info failure for-',tifFile,' -', rep);
|
||||
%fprintf(fid,'%s \n',rep) %See Note:
|
||||
% fprintf(fid,'%s \n',rep) %See Note:
|
||||
end
|
||||
tptLength=nndx;
|
||||
scTmNumeric=1; %initialize for parfor
|
||||
if swCatch==0
|
||||
scTmNumeric(nndx)=datenum(info.FileModDate);
|
||||
e(nndx,:)={tifFile, scTmNumeric(nndx)};
|
||||
%newtifFileLst(nndx)=tifFileLst(tPt);
|
||||
% newtifFileLst(nndx)=tifFileLst(tPt);
|
||||
end
|
||||
end
|
||||
|
||||
% clear tifFileLst;
|
||||
% Clear tifFileLst;
|
||||
tifFileLst=cell(nndx,1);
|
||||
f={sortrows(e,2)};
|
||||
tifFileLst=f{1,1}(:,1);
|
||||
areaOfIntensAboveBG=zeros(24,16,length(tifFileLst));
|
||||
|
||||
% Calculate Time series for each Plate of Selected Scan
|
||||
lastPlateOnScan=1; %Ncode
|
||||
tSeriesv=[]; t0Seriesv=[];
|
||||
@@ -69,7 +72,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
t0Seriesv=((scTmNumv-scTmNumv(1))*24);
|
||||
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
|
||||
% Create blank scan
|
||||
ImHeigth=2075;
|
||||
@@ -83,7 +86,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
% Execute Image conversion into Intensity Data
|
||||
[Tmpsbdg2, scanIntens, ~, ~, ~, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ...
|
||||
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;
|
||||
TmpFexpScanSpots3=TmpFexpScanSpots2;
|
||||
@@ -100,25 +103,23 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
% NIcheck: Check for bad scans at time points (swapped plates etc.)
|
||||
% Set up cell arrays for storing each plate in each Scan ..(scan,plate)
|
||||
SWprint=0;
|
||||
if SWprint==1
|
||||
wkDir=pwd;
|
||||
cd (fullfile(resDir,'PrintResults'));
|
||||
end
|
||||
|
||||
% Construct Legacy ...Intens.txt file
|
||||
if SWprint==1
|
||||
filename=(strcat('Plate',num2str(selScan),'_Intens.txt'));
|
||||
filename=fullfile(easyResultsDir,'PrintResults',(strcat('Plate',num2str(selScan),'_Intens.txt')));
|
||||
fid=fopen(filename,'w');
|
||||
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;
|
||||
else
|
||||
numOfImages=size(plate,3);
|
||||
end
|
||||
|
||||
CFscanIntens=zeros(384,numOfImages);
|
||||
locIndx=0; pl=1;
|
||||
for n=1:numCols %Ncode changed to 16 for Vert
|
||||
for m=1:numRows %Ncode change to 24 for Vert
|
||||
for n=1:numCols % Ncode changed to 16 for Vert
|
||||
for m=1:numRows % Ncode change to 24 for Vert
|
||||
locIndx=locIndx+1;
|
||||
for k=1:numOfImages
|
||||
if SWprint==1
|
||||
@@ -148,10 +149,10 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
% for p=1:lastPlateOnScan
|
||||
if SWprint==1
|
||||
if SWgrowthArea==1
|
||||
filename=(strcat('Plate',num2str(selScan),'_Areas.txt'));
|
||||
filename=fullfile(printResultsDir,(strcat('Plate',num2str(selScan),'_Areas.txt')));
|
||||
else
|
||||
filename=(strcat('ALTgrowthA_Scan',num2str(selScan),'_Plate',num2str(1),'_Areas.txt'));
|
||||
filename=(strcat('ALTgrowthA_Plate',num2str(selScan),'_Plate','_Areas.txt'));
|
||||
filename=fullfile(printResultsDir,(strcat('ALTgrowthA_Scan',num2str(selScan),'_Plate',num2str(1),'_Areas.txt')));
|
||||
filename=fullfile(printResultsDir,(strcat('ALTgrowthA_Plate',num2str(selScan),'_Plate','_Areas.txt')));
|
||||
end
|
||||
fid=fopen(filename,'w');
|
||||
end
|
||||
@@ -170,11 +171,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
|
||||
if SWprint==1
|
||||
fclose(fid);
|
||||
end
|
||||
|
||||
if SWprint==1
|
||||
cd(wkDir);
|
||||
fclose('all');
|
||||
% fclose('all'); % TODO do we need this?
|
||||
end
|
||||
|
||||
% 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));
|
||||
AUCfinalTime=96;
|
||||
arrayFormat=384;
|
||||
currDirResults=fullfile(resDir,'PrintResults');
|
||||
|
||||
% Version compatability fixes
|
||||
%{
|
||||
@@ -225,10 +221,10 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
|
||||
|
||||
% CFscanIntens
|
||||
% Call CurveFit routine
|
||||
% NCfitImCF(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan,sols) %,scan)%, scPltList) outputDirectory;
|
||||
% [scanTmp2]=NCfitImCFparforFailGbl(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan, sols, scanTmp); %,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, printResultsDir, autoImCFlag, selScan, sols, scanTmp); %,scan)%, scPltList) outputDirectory;
|
||||
[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
|
||||
CFscanIntens=zeros(16,24);
|
||||
Ag=zeros(1,384);
|
||||
|
||||
Reference in New Issue
Block a user