1
function [FileNameBase,PathNameBase,filenamelist]=filelist_generator
3
% Code to construct a list of 9999 or less filenames
4
% Programmed by Rob, changed by Chris. Automatic filelist generation
5
% and image time aquisition added by Chris.
6
% Last revision: 12/25/06
8
filenamelistmode = menu(sprintf('How do you want to create the filenamelist?'),...
9
'Manually','Automatically','Cancel');
10
if filenamelistmode==3
13
if filenamelistmode==2
14
[FileNameBase,PathNameBase,filenamelist]=automatically;
16
if filenamelistmode==1
17
[FileNameBase,PathNameBase,filenamelist]=manually;
20
[FileNameBase,PathNameBase,filenamelist]=imagetime(FileNameBase,PathNameBase,filenamelist);
22
% -------------------------------------------------------
24
function [Firstimagename,ImageFolder,filenamelist]=automatically
26
[Firstimagename ImageFolder]=uigetfile('*.tif','Open First Image');
27
if Firstimagename~~[];
31
if Firstimagename~~[];
32
% Get the number of image name
33
letters=isletter(Firstimagename);
34
Pointposition=findstr(Firstimagename,'.');
35
Firstimagenamesize=size(Firstimagename);
36
counter=Pointposition-1;
40
letterstest=letters(counter);
44
Numberpos(counterpos)=counter;
46
counterpos=counterpos+1;
52
Filename_first = Firstimagename(1:min(Numberpos)-1);
53
Firstfilenumber=Firstimagename(min(Numberpos):max(Numberpos));
54
Lastname_first = Firstimagename(max(Numberpos)+1:Firstimagenamesize(1,2));
55
Firstfilenumbersize=size(Firstfilenumber);
56
onemore=10^(Firstfilenumbersize(1,2));
57
filenamelist(1,:)=Firstimagename;
59
Firstfilenumber=str2num(Firstfilenumber);
60
u=1+onemore+Firstfilenumber;
62
filenamelist(2,:)=[Filename_first ustr(2:Firstfilenumbersize(1,2)+1) Lastname_first];
67
while exist(filenamelist((counter+1),:),'file') ==2;
71
filenamelist(counter+1,:)=[Filename_first ustr(2:Firstfilenumbersize(1,2)+1) Lastname_first];
72
if exist(filenamelist((counter+1),:),'file') ==0;
73
warning('Last image detected')
74
filenamelist(counter+1,:)=[];
79
[FileNameBase,PathNameBase] = uiputfile('filenamelist.mat','Save as "filenamelist" in image directory (recommended)');
81
save(FileNameBase,'filenamelist');
83
% -------------------------------------------------------
84
function [FileNameBase,PathNameBase,filenamelist]=manually;
85
% Prompt user for images to be used for analysis
87
prompt = {'Enter number of first image (i.e. "3" for PIC00003):','Enter number of last image (i.e. "100" for PIC00100):'};
88
dlg_title = 'Input images to be used for the analysis';
91
answer = inputdlg(prompt,dlg_title,num_lines,def);
92
F2 = str2num(cell2mat(answer(1,1)));
93
F = str2num(cell2mat(answer(2,1)));
96
error0 = menu('!!! ERROR - Code will only work properly for 9999 or less picture files !!!','Restart');
100
% Choose first name of images
102
prompt = {'Enter Image Name (first 4 letters):'};
103
dlg_title = 'Input images to be used for the analysis';
106
answer = inputdlg(prompt,dlg_title,num_lines,def);
107
G = cell2mat(answer(1,1));
111
namelist(1:F-F2+1,1)=G(1,1);
112
namelist(1:F-F2+1,2)=G(1,2);
113
namelist(1:F-F2+1,3)=G(1,3);
114
namelist(1:F-F2+1,4)=G(1,4);
116
% create the numberlist
117
num=((10000+F2):(10000+F))';
119
% Creation of final results
120
filenamelist=namelist;
122
filenamelist(:,5:8)=str(:,2:5);
124
filenamelist(1:F-F2+1,9)=E(1,1);
125
filenamelist(1:F-F2+1,10)=E(1,2);
126
filenamelist(1:F-F2+1,11)=E(1,3);
127
filenamelist(1:F-F2+1,12)=E(1,4);
131
[FileNameBase,PathNameBase] = uiputfile('filenamelist.mat','Save as "filenamelist" in image directory (recommended)');
133
save(FileNameBase,'filenamelist');
136
% ----------------------------------------
137
% Extract the time from images?
139
function [FileNameBase,PathNameBase,filenamelist]=imagetime(FileNameBase,PathNameBase,filenamelist)
141
selection_time_image = menu(sprintf('Do you also want to extract the time from images to match stress and strain?'),'Yes','No');
143
if selection_time_image==1
145
% Loop through all images in imagetimelist to get all image capture times
147
[ri,ci]=size(filenamelist);
149
o=waitbar(0,'Extracting the image capture times...');
154
info=imfinfo(filenamelist(q,:));
155
time=datevec(info.FileModDate,13);
156
seconds(q)=time(1,4)*3600+time(1,5)*60+time(1,6);
162
% Configure and then save image number vs. image capture time text file
164
im_num_im_cap_time=[(1:ri)' seconds'];
165
save time_image.txt im_num_im_cap_time -ascii -tabs
b'\\ No newline at end of file'