%% CALLED BY EASYconsole.m %% %function NImStartupImCF02par4Gbl Fflg= 1; %0; fclose('all'); %close all open files clear ('plate2', 'scanIntens','Scanfiles','pathname','tifFileLstP4') %global SWsingleSc global SWgrowthArea global scLst global ImParMat %global CSearchRange %global CSrchRng global expDir global SWnewExp %Console globals******* global openExpfile global openExppath global newExpfile global newExppath global ExpOutmat global fhconsole global ExpPath global resDir global wCodeDir global matDir % global ImWidth global ImHeigth global numRows; global numCols; %global SWprintLeg global scan %global scanSize global scanMax global tptLength %global sols %global CFmeth numRows=24; %for Single Vertical numCols=16; %for Single Vertical %global scanPar4x %*************CIRCLE related************************* doCircle=1; %use Circle area analysis 14_0807 radius=14; ImParMat(10)=radius; ImParMat(11)=doCircle; try clf(fhconsole,'reset') catch ME end close %****************************************** EASYconsole %****************************************** try load(ExpOutmat) copyfile(ExpOutmat,(fullfile(matDir,'BkUp',strcat((num2str(datenum(now))),'.mat')))) catch end try load(fullfile(resDir,'Fotos','Nbdg')) %Modified to load from 'Fotos' 20_0819 catch %Reloacated from 'PTmats' to prevent potential overwrite when PTmats is %copied into new job when the PT template is about the same. We also %now have a default template if one is not made. i.e., when the images %from the new experiment are too sketchy to make a good pintool %template. By moving it to 'Fotos' we avoid possible issues due to %copying the Nbdg.mat file along with the default template '.mat' files. %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 %by EASY versions after 20_0819. load(fullfile(resDir,'PTmats','Nbdg')) %Left in to accomodate loads of work before 20_0819 end %++++++++++++++Load Fotos stored data++++++++++++++++++++ try load(fullfile(resDir,'Fotos','Coordinates')) catch end try load(fullfile(resDir,'Fotos','BGatTpts')) catch end try load(fullfile(resDir,'Fotos','anlZones')) catch end %******autoImCF******************* try load(fullfile(resDir,'PTmats','NCFparms')) catch ME load parameters end %******************************* %************Get Print Times******************************* PrintTimes=[]; w= cd; %Capture current dir in w if ispc %Linux accommodation expDir=fullfile(ExpPath,'\'); else if isunix, expDir= ExpPath;end if ismac , expDir=ExpPath;end end scLst={}; %**************Parameter Entry****************** NImParamRadiusGui(expDir) %Ncode 122111replaced removed ,numOfPrtTimes) %*********************************************** %width=ImParMat(5); width=24; widthEx=width-1; %width extention from reference point dither=ImParMat(6); radius=ImParMat(10); %>>>>>>>>>>>>>>>>>>>>>> NIcircle %<<<<<<<<<<<<<<<<<<<<<<< %***************** Load Stuff************************* lastPlateOnLastScan=1; %Ncode if size(scLst,1)==1,SWsingleSc=1;else SWsingleSc=0;end %**************************???????????????????????? dvec=datevec(datestr(floor(now))); %method to get current offset year '01-Jan-"currentyr"' dvec(2)=1; dvec(3)=1; %yrOffset=datenum('01-Jan-2012');%(dvec); %('01-Jan-2009'); %time num default is currentyear jan1 %******************+++++++++++++*****************+++++++++++++++*********** numScans=size(scLst,1); if(isequal(SWsingleSc,1)) selScan=str2double(char(scLst(1))); %numScans=selScan; %startScan=selScan; else %startScan=1; end SWgrowthArea= ImParMat(9); load(fullfile(resDir,'PTmats','NPTmapSearch')) PTmapPos= detPos; %************************************************************************** selScanNumLst= []; %++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %************************************************************************** %*********Preallocation for Scan Loop************************************************** Scanfiles=[]; pathname=[]; %++++++++++++++++++++++++++++++++ SETUP FOR GLOBAL PARFOR LOOP+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %if SWsingleSc == 1 %if single scan else do expMultiTseries to execute multiple scans %******Gui Select Scan -> *.tif files for Analysis***************** w= cd; %Capture current dir in w if ispc cd(char(strcat(expDir,scLst(1)))) end if isunix cd (fullfile(expDir,cell2mat(scLst(1)))); end Scanfiles=[]; pathname=[]; for ii= 1:length(scLst) if SWsingleSc == 1 [Scanfiles, pathname]=uigetfile('*.bmp', 'Select files','MultiSelect','on');% change '*hr*.bmp' 12/20/2011 if ischar(Scanfiles) scd= imread(char(Scanfiles)); tptLength=1; else scd= imread(char(Scanfiles(1,1))); tptLength= length(Scanfiles); end ImHeigth= size(scd,1); ImWidth= size(scd,2); sc=scd(1:ImHeigth,1:ImWidth); %?Not used RefOnly end cd (w); numFiles= size(Scanfiles,2); %tifFileLst= Scanfiles; %Initialize tifFilesLst for parfor loop if ispc %Linux and mac accomodation tifFileLst4MultiT = dir(fullfile(expDir, char(scLst(ii)), '\*.bmp')); end if isunix || ismac tifFileLst4MultiT = dir(fullfile(expDir, char(scLst(ii)), '*.bmp')); end numFiles=length(tifFileLst4MultiT); tptLength= numFiles; tifFileLstP4{ii}={tifFileLst4MultiT.name}; %{ dateTmStampP4{ii}= {tifFileLst4MultiT.date} dateTmNum{ii}= datenum(dateTmStampP4{1}); info{ii} = imfinfo(tifFileLstP4{ii}); scTmNumericP4(ii)=datenum(info{ii}.FileModDate); %} end %************************************************************************** %************************************************************************** for jj= 1:numScans %startScan:numScans selScan= str2double(char(scLst(jj))); selScanNumLst(jj)= selScan; end selScanNumLst2= selScanNumLst; %function passthrough, passback to par4gbl_Main 20_0205 %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %PREALLOCATION PREALLOCATION PREALLOCATION PREALLOCATION PREALLOCATION %****************************************************************************** scCount= []; TmpexpScanIntens00= cell(1); %cell(1,scanMax); TmpFexpScanSpots00= cell(1); %cell(1,scanMax); TmpFexpScanBMtp00= cell(1); %cell(1,scanMax); TmpanlZoneRefs00= cell(1); %cell(1,scanMax); Tmpsbdg00= cell(1); TmpexpScanIntens4= cell(1,numScans); TmpFexpScanSpots4= cell(1,numScans); TmpFexpScanBMtp4= cell(1,numScans); TmpanlZoneRefs4= cell(1,numScans); Tmpsbdg4= cell(1,numScans); TmpexpScanIntens5= cell(1,numScans); TmpFexpScanSpots5= cell(1,numScans); TmpFexpScanBMtp5= cell(1,numScans); TmpanlZoneRefs5= cell(1,numScans); Tmpsbdg5= cell(1,numScans); p4L00= cell(18,1); p4L0= p4L00; p4L4= cell(18,numScans); p4L5= p4L4; Ag= ones(384); 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,resDir,expDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ... Tmpsbdg00,Tmpsbdg4); for scanCnt= 1:numScans selScan= p4L4{16,scanCnt}; %determine the actual scan in the scanCnt parfor distributed "id" scan(selScan).plate(1).tSeries= cell2mat(p4L4(1,scanCnt)); scan(selScan).plate(1).t0Series= cell2mat(p4L4(2,scanCnt)); scan(selScan).plate(1).printTm= cell2mat(p4L4(3,scanCnt)); scan(selScan).plate(1).intens= cell2mat(p4L4(4,scanCnt)); scan(selScan).plate(1).rc= p4L4(5,scanCnt); scan(selScan).plate(1).pIndx= cell2mat(p4L4(6,scanCnt)); scan(selScan).plate(1).Ag= cell2mat(p4L4(7,scanCnt)); scan(selScan).plate(1).selIntens= p4L4(8,scanCnt); scan(selScan).plate(1).selTimes= p4L4(9,scanCnt); scan(selScan).plate(1).filterTimes= p4L4(10,scanCnt); scan(selScan).plate(1).normIntens= p4L4(11,scanCnt); %scan(selScan).plate(1).CFparameters= p4L4(12,scanCnt); %Need to convert to a matrix form like Old versions CFparm(1:384)=p4L4{12,scanCnt}(1:384); scan(selScan).plate(1).CFparameters= CFparm; scan(selScan).plate(1).CFdate= p4L4(13,scanCnt); scan(selScan).plate(1).CFout= cell2mat(p4L4(14,scanCnt)); scan(selScan).plate(1).CFoutStd= cell2mat(p4L4(15,scanCnt)); scan(selScan).Awindow= cell2mat(p4L4(17,scanCnt)); scan(selScan).Idate= cell2mat(p4L4(18,scanCnt)); expScanIntens(selScan)= TmpexpScanIntens5(scanCnt); FexpScanSpots(selScan)= TmpFexpScanSpots5(scanCnt); FexpScanBMtp(selScan)= TmpFexpScanBMtp5(scanCnt); anlZoneRefs(selScan)= TmpanlZoneRefs5(scanCnt); if ~isempty(Tmpsbdg5{scanCnt}) sbdg(selScan)= Tmpsbdg5(scanCnt); else sbdg{selScan}= uint8(zeros(24,16,4)); end end %SAVE DATA in .mat files save(ExpOutmat,'scan'); save((fullfile(resDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time save((fullfile(resDir,'Fotos','Nbdg')), 'sbdg'); save((fullfile(resDir,'Fotos','Coordinates')),'FexpScanSpots') %Saves frames at each tPt save((fullfile(resDir,'Fotos','BGatTpts')),'FexpScanBMtp') save((fullfile(resDir,'Fotos','anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt %Print FitResults ******************************************************* fileExt = '.txt'; filePrefix = 'FitResults_'; for scanCnt= 1:numScans selScan= p4L4{16,scanCnt}; %determine the actual scan in the scanCnt parfor distributed "id" fileSuffix= strcat('Scan', num2str(selScan),'_Plate', num2str(1)); fileNamePlate = [filePrefix fileSuffix fileExt]; fileName= fullfile(resDir,'PrintResults', fileNamePlate); %[outputDirectory fileNamePlate]; %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 %used as a diagnostic tool. outCprint= p4L4; fid = fopen(fileName,'w'); 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'); for n=1:384 %startCount:numCultures fprintf(fid,'%d\t',n); fprintf(fid, '%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\n',... outCprint{14,scanCnt}(n,1),outCprint{14,scanCnt}(n,2),outCprint{14,scanCnt}(n,3),outCprint{14,scanCnt}(n,4),... outCprint{14,scanCnt}(n,5),outCprint{14,scanCnt}(n,6),outCprint{14,scanCnt}(n,7),outCprint{14,scanCnt}(n,8),... outCprint{14,scanCnt}(n,9),outCprint{14,scanCnt}(n,10),outCprint{14,scanCnt}(n,11),outCprint{14,scanCnt}(n,12),... outCprint{14,scanCnt}(n,13),outCprint{14,scanCnt}(n,14),outCprint{14,scanCnt}(n,15),outCprint{14,scanCnt}(n,16)); end fclose(fid); end EASYconsole; %+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++