Add ezview
This commit is contained in:
240
workflow/apps/matlab/ezview/TempBU/QkVexps.m
Executable file
240
workflow/apps/matlab/ezview/TempBU/QkVexps.m
Executable file
@@ -0,0 +1,240 @@
|
||||
%Quickview of Exp Images one from each folder at selected timept
|
||||
function QkVexps %QkviewImages
|
||||
w=pwd;
|
||||
[Selfile, pathname]=uigetfile({'*.bmp';'*.tif';'*.*'},'Select timepoint file','MultiSelect','off');
|
||||
cd(pathname)
|
||||
flist=dir
|
||||
cd ..
|
||||
ExpFdr=pwd
|
||||
cd ..
|
||||
EstudyDir=pwd
|
||||
ExpList= dir;
|
||||
cd(w)
|
||||
day=[];
|
||||
Dpos=[];
|
||||
%Determine if Exps grouped into Day folders
|
||||
|
||||
studyNum=1;
|
||||
dayIndx=0;
|
||||
studyIndx=0;
|
||||
|
||||
for i=1:size(ExpList,1)
|
||||
if ~isequal(ExpList(i).name,'.DS_Store') %|| ~strfind(ExpList(i),'DS')
|
||||
Dpos=max(strfind(ExpList(i).name,'D'));
|
||||
|
||||
|
||||
if ~isempty(Dpos)
|
||||
tmpExpName=ExpList(i).name;
|
||||
if isempty(day)
|
||||
if isnumeric(str2double(tmpExpName((Dpos+1):end)))
|
||||
dayIndx=dayIndx+1;
|
||||
day(dayIndx)= str2double(tmpExpName((Dpos+1):end));
|
||||
daytx{dayIndx}= strcat('D',(tmpExpName((Dpos+1):end)));
|
||||
studyIndx=studyIndx+1;
|
||||
dayLst(dayIndx).study{studyIndx}= tmpExpName;
|
||||
end
|
||||
elseif sum(day==(str2double(tmpExpName((Dpos+1):end))))>0 %capture the experimentNames into studyLst sets
|
||||
studyIndx=studyIndx+1;
|
||||
dayLst(dayIndx).study{studyIndx}= tmpExpName;
|
||||
|
||||
elseif sum(day==(str2double(tmpExpName((Dpos+1):end))))==0 %capture the daynumber as a number
|
||||
dayIndx=dayIndx+1;
|
||||
day(dayIndx)= str2num(tmpExpName((Dpos+1):end)); %if the daynumber is unique store in day vector
|
||||
daytx{dayIndx}= strcat('D',(tmpExpName((Dpos+1):end)));
|
||||
studyIndx=1;
|
||||
dayLst(dayIndx).study{studyIndx}= tmpExpName;
|
||||
|
||||
|
||||
end %if isempty(day)
|
||||
end %if ~isempty(Dpos)
|
||||
end %if ~isequal(ExpList(i),'.DS_Store')
|
||||
end %for i=1:size(ExpList,1)
|
||||
nonstdDdirFlg=0
|
||||
if length(day)==1
|
||||
nonstdDirFlg=1;
|
||||
else
|
||||
nonstdDirFlg=0;
|
||||
end
|
||||
if nonstdDirFlg==0
|
||||
cd(EstudyDir)
|
||||
%for i=1:size(ExpList,1)
|
||||
for i=1:length(dayLst)
|
||||
for j=1:length(dayLst(i).study)
|
||||
curDay= daytx(i)
|
||||
curExp= char(dayLst(i).study(j))
|
||||
curExpNumName= strcat('StudyExp',num2str(j));
|
||||
cd (fullfile(EstudyDir,curExp))
|
||||
curExpDir=pwd;
|
||||
|
||||
plateDir=dir;
|
||||
for k=1:length(plateDir)
|
||||
if ~isequal(plateDir(k).name,'.DS_Store') %if .DS_Store Apple indiosyncratic fix
|
||||
if isnumeric(str2double(plateDir(k).name)) && ~isnan(str2double(plateDir(k).name)),
|
||||
curPlate= plateDir(k).name;
|
||||
|
||||
cd (fullfile(curExpDir,curPlate))
|
||||
curPlateDir=pwd;
|
||||
%end
|
||||
try
|
||||
dotPos= strfind(Selfile,'.')
|
||||
tptx= (Selfile(1:dotPos-1));
|
||||
dstFileName= char(strcat('T',tptx,curDay,'_',curExp,'P',curPlate,'_',Selfile))
|
||||
curPlateName=strcat('Plate',curPlate)
|
||||
mkdir(fullfile(EstudyDir,'QkVstudySets',curExpNumName,curPlateName))
|
||||
copyfile(fullfile(curPlateDir,Selfile),fullfile(EstudyDir,'QkVstudySets',curExpNumName,curPlateName,dstFileName))
|
||||
|
||||
catch
|
||||
end
|
||||
end %if isnumeric(str2double(plateDirNonstd(k).name)),
|
||||
|
||||
end %if .DS_Store Apple indiosyncratic fix
|
||||
end %for k=1:length(plateDir)
|
||||
end %j=1:length(dayLst(i).study) for i=1:length(dayDirLst)
|
||||
end %i=1:length(dayLst) for i=1:size(ExpList,1)
|
||||
|
||||
end %if nonstdDirFlg==0
|
||||
|
||||
%****************************************************************************
|
||||
% Begin nonstandard Directory structure code
|
||||
%****************************************************************************
|
||||
if nonstdDirFlg==1
|
||||
cd(EstudyDir)
|
||||
cd ..
|
||||
studyDirNonstd=pwd;
|
||||
%mkdir(fullfile(studyDirNonstd,'QuikView'))
|
||||
dayDirLst=dir;
|
||||
for i=1:length(dayDirLst)
|
||||
if ~isequal(dayDirLst(i).name,'.DS_Store') %if .DS_Store Apple indiosyncratic fix
|
||||
if (strfind(dayDirLst(i).name,'Day')),
|
||||
curDay= dayDirLst(i).name;
|
||||
cd (fullfile(studyDirNonstd,curDay))
|
||||
%curStudyDaynonStd=pwd
|
||||
expDirNonstd=dir
|
||||
expNum=0;
|
||||
for j=1:length(expDirNonstd)
|
||||
if ~isequal(expDirNonstd(j).name,'.DS_Store') %if .DS_Store Apple indiosyncratic fix
|
||||
if (strfind(expDirNonstd(j).name,'D')),
|
||||
curExp= expDirNonstd(j).name;
|
||||
expNum=expNum+1;
|
||||
curExpNumName= strcat('StudyExp',num2str(expNum));
|
||||
cd (fullfile(studyDirNonstd,curDay,curExp))
|
||||
curExpDir=pwd;
|
||||
%end
|
||||
plateDirNonstd=dir;
|
||||
for k=1:length(plateDirNonstd)
|
||||
if ~isequal(plateDirNonstd(k).name,'.DS_Store') %if .DS_Store Apple indiosyncratic fix
|
||||
if isnumeric(str2double(plateDirNonstd(k).name)) && ~isnan(str2double(plateDirNonstd(k).name)),
|
||||
curPlate= plateDirNonstd(k).name;
|
||||
|
||||
cd (fullfile(curExpDir,curPlate))
|
||||
curPlateDir=pwd;
|
||||
|
||||
try
|
||||
dotPos= strfind(Selfile,'.')
|
||||
tptx= (Selfile(1:dotPos-1));
|
||||
dstFileName= strcat('T',tptx,curDay,'_',curExp,'P',curPlate,'_',Selfile)
|
||||
curPlateName=strcat('Plate',curPlate)
|
||||
mkdir(fullfile(studyDirNonstd,'QkVstudySets',curExpNumName,curPlateName))
|
||||
copyfile(fullfile(curPlateDir,Selfile),fullfile(studyDirNonstd,'QkVstudySets',curExpNumName,curPlateName,dstFileName))
|
||||
|
||||
catch
|
||||
end
|
||||
|
||||
end %if isnumeric(str2double(plateDirNonstd(k).name)),
|
||||
end %if (k) .DS_Store Apple indiosyncratic fix
|
||||
end %for k=1:length(plateDirNonstd)
|
||||
end%if (strfind(expDirNonstd(j).name,'D'))
|
||||
end %if (j).DS_Store Apple indiosyncratic fix
|
||||
end %for j=1:length(expDirNonstd)
|
||||
end %if (strfind(dayDirLst(i).name,'Day')),
|
||||
end %if (i).DS_Store Apple indiosyncratic fix
|
||||
end %for i=1:length(dayDirLst)
|
||||
|
||||
end %if nonstdFlg
|
||||
|
||||
|
||||
|
||||
cd(w)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
%{
|
||||
nonstdDdirFlg=0
|
||||
if length(day)==1
|
||||
nonstdDirFlg=1;
|
||||
%mkdir(fullfile(ExpFdr,'QkVstudySets'))
|
||||
%Experiments are grouped together in subfolders by the day
|
||||
%What if experiment are run on approximately the same day
|
||||
%but differ by say a day or two???
|
||||
|
||||
else
|
||||
nonstdDirFlg=0;
|
||||
|
||||
%Experiments are all together in the standard way
|
||||
%What if experiment are run on approximately the same day
|
||||
%but differ by say a day or two???
|
||||
%The user will have to label experiments the same which are
|
||||
%to be grouped together even if not on the same day.
|
||||
|
||||
end
|
||||
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
cd(w)
|
||||
m=1;
|
||||
|
||||
for i=1:size(flist,1)
|
||||
if isequal(Selfile,flist(i).name)
|
||||
fnum=m
|
||||
break
|
||||
end
|
||||
m=m+1
|
||||
end
|
||||
|
||||
%Select Image folders ++++++++++++++++++++++++
|
||||
d = dir(ExpFdr);
|
||||
Scname={};
|
||||
n=1;
|
||||
for i=1:size(d,1)
|
||||
if ~isempty(str2num(d(i).name))...
|
||||
||~isempty(strfind(d(i).name,'Scan'))
|
||||
Scname{n}=d(i).name
|
||||
n=n+1
|
||||
end
|
||||
end
|
||||
Srtnum=sort(str2double(Scname))
|
||||
clear Srtname
|
||||
for i=1:length(Srtnum)
|
||||
Srtname{i}=num2str(Srtnum(i));
|
||||
end
|
||||
%str = {Scname};
|
||||
[s,v] = listdlg('PromptString','Select a file:',...
|
||||
'SelectionMode','multiple',...
|
||||
'ListString',Srtname)
|
||||
%*********************************************************************
|
||||
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
%++++++++++++++++++++++++++++++
|
||||
%Copy selected files to \QuikView Dir
|
||||
mkdir(fullfile(ExpFdr,'QuikView'))
|
||||
for j=1:size(s,2)
|
||||
srcDir= fullfile(ExpFdr,num2str(s(j)))
|
||||
%if Scan dir then must do something else to select '002' etc.
|
||||
try
|
||||
dstFileName= strcat(num2str(s(j)),'_',Selfile)
|
||||
copyfile(fullfile(srcDir,Selfile),fullfile(ExpFdr,'QuikView',dstFileName))
|
||||
|
||||
catch
|
||||
sFileLst= dir(srcDir)
|
||||
selNumFile=sFileLst(fnum).name
|
||||
dstFileName= strcat(num2str(s(j)),'_',selNumFile)
|
||||
copyfile(fullfile(srcDir,selNumFile),fullfile(ExpFdr,'QuikView',dstFileName))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
cd(w)
|
||||
|
||||
end
|
||||
%}
|
||||
Reference in New Issue
Block a user