[503] | 1 | %'datatree_browser': function for scanning directories in a campaign |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function varargout = series(varargin) |
---|
| 4 | % associated with the GUI datatree_browser.fig |
---|
| 5 | |
---|
| 6 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 7 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 8 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 9 | % This file is part of the toolbox UVMAT. |
---|
| 10 | % |
---|
| 11 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 12 | % it under the terms of the GNU General Public License as published by |
---|
| 13 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 14 | % (at your option) any later version. |
---|
| 15 | % |
---|
| 16 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 20 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 21 | |
---|
| 22 | function varargout = datatree_browser(varargin) |
---|
| 23 | |
---|
| 24 | % Last Modified by GUIDE v2.5 26-Jul-2012 08:24:26 |
---|
| 25 | |
---|
| 26 | % Begin initialization code - DO NOT EDIT |
---|
| 27 | gui_Singleton = 1; |
---|
| 28 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 29 | 'gui_Singleton', gui_Singleton, ... |
---|
| 30 | 'gui_OpeningFcn', @datatree_browser_OpeningFcn, ... |
---|
| 31 | 'gui_OutputFcn', @datatree_browser_OutputFcn, ... |
---|
| 32 | 'gui_LayoutFcn', [] , ... |
---|
| 33 | 'gui_Callback', []); |
---|
| 34 | if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback','once')) |
---|
| 35 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | if nargout |
---|
| 39 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 40 | else |
---|
| 41 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 42 | end |
---|
| 43 | % End initialization code - DO NOT EDIT |
---|
| 44 | |
---|
| 45 | %------------------------------------------------------------------------ |
---|
| 46 | % --- Executes just before datatree_browser is made visible. |
---|
| 47 | function datatree_browser_OpeningFcn(hObject, eventdata, handles, projectxml) |
---|
| 48 | %------------------------------------------------------------------------ |
---|
| 49 | % Choose default command line output for datatree_browser |
---|
| 50 | handles.output = 'Cancel'; |
---|
| 51 | |
---|
| 52 | % Update handles structure |
---|
| 53 | guidata(hObject, handles); |
---|
| 54 | testCancel=1; |
---|
| 55 | testinputstring=0; |
---|
| 56 | icontype='quest';%default question icon (text input asked) |
---|
| 57 | |
---|
| 58 | % Determine the position of the dialog - centered on the screen |
---|
| 59 | FigPos=get(0,'DefaultFigurePosition'); |
---|
| 60 | OldUnits = get(hObject, 'Units'); |
---|
| 61 | set(hObject, 'Units', 'pixels'); |
---|
| 62 | OldPos = get(hObject,'Position'); |
---|
| 63 | FigWidth = OldPos(3); |
---|
| 64 | FigHeight = OldPos(4); |
---|
| 65 | ScreenUnits=get(0,'Units'); |
---|
| 66 | set(0,'Units','pixels'); |
---|
| 67 | ScreenSize=get(0,'ScreenSize'); |
---|
| 68 | set(0,'Units',ScreenUnits); |
---|
| 69 | |
---|
| 70 | FigPos(1)=1/2*(ScreenSize(3)-FigWidth); |
---|
| 71 | FigPos(2)=2/3*(ScreenSize(4)-FigHeight); |
---|
| 72 | FigPos(3:4)=[FigWidth FigHeight]; |
---|
| 73 | set(hObject, 'Position', FigPos); |
---|
| 74 | set(hObject, 'Units', OldUnits); |
---|
| 75 | |
---|
| 76 | % % Show a question icon from dialogicons.mat - variables questIconData and questIconMap |
---|
| 77 | % load dialogicons.mat |
---|
| 78 | % eval(['IconData=' icontype 'IconData;']) |
---|
| 79 | % eval(['IconCMap=' icontype 'IconMap;']) |
---|
| 80 | % questIconMap(256,:) = get(handles.figure1, 'Color'); |
---|
| 81 | % Img=image(IconData, 'Parent', handles.axes1); |
---|
| 82 | % set(handles.figure1, 'Colormap', IconCMap); |
---|
| 83 | % set(handles.axes1, ... |
---|
| 84 | % 'Visible', 'off', ... |
---|
| 85 | % 'YDir' , 'reverse' , ... |
---|
| 86 | % 'XLim' , get(Img,'XData'), ... |
---|
| 87 | % 'YLim' , get(Img,'YData') ... |
---|
| 88 | % ); |
---|
| 89 | % if exist('GeometryCalib','var') |
---|
| 90 | % DataviewData.GeometryCalib=GeometryCalib; |
---|
| 91 | % set(hObject,'UserData',DataviewData) |
---|
| 92 | % end |
---|
| 93 | % if exist('SubCampaignTst','var') && isequal(SubCampaignTst,'y') |
---|
| 94 | % set(handles.SubCampaignTest,'Value',1); |
---|
| 95 | % end |
---|
| 96 | if ~isempty(regexp(projectxml,'.project.xml$')) |
---|
| 97 | if exist(regexprep(projectxml,'.project.xml$','.link'),'dir') |
---|
| 98 | |
---|
| 99 | set(handles.LinkDir,'String',regexprep(projectxml,'.project.xml$','.link')) |
---|
| 100 | XmlContent=xml2struct(projectxml); |
---|
| 101 | set(handles.SourceDir,'String',XmlContent.SourceDir) |
---|
| 102 | set(handles.UpdateLink,'String','UpdateLink') |
---|
| 103 | % datatree_browser(regexprep(fileinput,'.project.xml$','.link')) |
---|
| 104 | |
---|
| 105 | elseif exist(regexprep(projectxml,'.project.xml$',''),'dir') |
---|
| 106 | set(handles.SourceDir,'String',regexprep(projectxml,'.project.xml$','')) |
---|
| 107 | set(handles.LinkDir,'Visible','off') |
---|
| 108 | set(handles.UpdateLink,'String','CreateLink') |
---|
| 109 | end |
---|
| 110 | set(handles.OK,'Visible','on') |
---|
| 111 | set(handles.Cancel,'Visible','on') |
---|
| 112 | set(handles.figure,'WindowStyle','modal')% Make% Make the GUI modal |
---|
| 113 | drawnow |
---|
| 114 | uiwait(handles.figure); |
---|
| 115 | end |
---|
| 116 | % if exist('RootDir','var') |
---|
| 117 | % set(handles.SourceDir,'String',RootDir); |
---|
| 118 | % % set(handles.clean_civ_cmx,'Visible','off') |
---|
| 119 | % set(handles.edit_xml,'Visible','off') |
---|
| 120 | % set(handles.HELP,'Visible','off') |
---|
| 121 | % set(handles.OK,'Visible','on') |
---|
| 122 | % set(handles.Cancel,'Visible','on') |
---|
| 123 | % set(handles.figure,'WindowStyle','modal')% Make% Make the GUI modal |
---|
| 124 | % set(hObject,'Visible','on') |
---|
| 125 | % drawnow |
---|
| 126 | % %RootDirectory_Callback(hObject, eventdata, handles) |
---|
| 127 | % % UIWAIT makes translate_points wait for user response (see UIRESUME) |
---|
| 128 | % uiwait(handles.figure); |
---|
| 129 | % end |
---|
| 130 | |
---|
| 131 | %------------------------------------------------------------------------ |
---|
| 132 | % --- Outputs from this function are returned to the command line. |
---|
| 133 | function varargout = datatree_browser_OutputFcn(hObject, eventdata, handles) |
---|
| 134 | %------------------------------------------------------------------------ |
---|
| 135 | % Get default command line output from handles structure |
---|
| 136 | varargout{1} = handles.output; |
---|
| 137 | %delete(handles.figure) |
---|
| 138 | |
---|
| 139 | %------------------------------------------------------------------------ |
---|
| 140 | % --- Executes on button press in UpdateLink. |
---|
| 141 | function UpdateLink_Callback(hObject, eventdata, handles) |
---|
| 142 | %------------------------------------------------------------------------ |
---|
| 143 | InputString=get(handles.UpdateLink,'String') |
---|
| 144 | switch InputString |
---|
| 145 | case 'CreateLink' |
---|
| 146 | CurrentDir=fileparts(get(handles.SourceDir,'String')); |
---|
| 147 | if ~exist(CurrentDir,'dir') |
---|
| 148 | CurrentDir=''; |
---|
| 149 | end |
---|
| 150 | SourceDir=uigetdir(CurrentDir,'pick up the source project directory'); %file browser |
---|
| 151 | if isequal(SourceDir,0) |
---|
| 152 | return |
---|
| 153 | else |
---|
| 154 | set(handles.SourceDir,'String',SourceDir) |
---|
| 155 | end |
---|
| 156 | drawnow |
---|
| 157 | [SourcePath,ProjectName]=fileparts(SourceDir); |
---|
| 158 | MirrorRoot=uigetdir(CurrentDir,'path to the link directory'); %file browser |
---|
| 159 | if isempty(MirrorRoot) |
---|
| 160 | return |
---|
| 161 | else |
---|
| 162 | MirrorDir=fullfile(MirrorRoot,[ProjectName '.link']); |
---|
| 163 | end |
---|
| 164 | if ~exist(MirrorDir,'dir') |
---|
| 165 | mkdir(MirrorDir) |
---|
| 166 | end |
---|
| 167 | MirrorDoc.SourceDir=SourceDir; |
---|
| 168 | t=struct2xml(MirrorDoc); |
---|
| 169 | set(t,1,'name','DataTree'); |
---|
| 170 | save(t,fullfile(MirrorDir,[ProjectName '.xml'])) |
---|
| 171 | set(handles.LinkDir,'String',MirrorDir) |
---|
| 172 | |
---|
| 173 | %update_link(SourceDir,LinkDir) |
---|
| 174 | SourceDir_Callback([],[], handles) |
---|
| 175 | case 'UpDateLink' |
---|
| 176 | % MirrorDir=get(handles.LinkDir,'String'); |
---|
| 177 | % menu={'*.xml', ' (*.xml)'; |
---|
| 178 | % '*.xml', '.xml files '; ... |
---|
| 179 | % '*.*', 'All Files (*.*)'}; |
---|
| 180 | % [MirrorXml, PathName] = uigetfile( menu, 'Pick the head xml file in the link directory',MirrorDir); |
---|
| 181 | [MirrorXml, PathName]=fileparts(get(handles.LinkDir,'String')); |
---|
| 182 | %set(handles.LinkDir,'String',fullfile(PathName,regexprep(MirrorXml,'.xml$','.link'))) |
---|
| 183 | LinkDir_Callback(hObject, eventdata, handles) |
---|
| 184 | end |
---|
| 185 | |
---|
| 186 | % RootDirectory_Callback(hObject, eventdata, handles) |
---|
| 187 | %------------------------------------------------------------------------ |
---|
| 188 | % --- Executes on button press in open_SubCampaign. |
---|
| 189 | function UpdateMirror_Callback(hObject, eventdata, handles) |
---|
| 190 | %------------------------------------------------------------------------ |
---|
| 191 | % MirrorDir=get(handles.LinkDir,'String'); |
---|
| 192 | % menu={'*.xml', ' (*.xml)'; |
---|
| 193 | % '*.xml', '.xml files '; ... |
---|
| 194 | % '*.*', 'All Files (*.*)'}; |
---|
| 195 | % [MirrorXml, PathName] = uigetfile( menu, 'Pick the head xml file in the link directory',MirrorDir); |
---|
| 196 | % set(handles.LinkDir,'String',fullfile(PathName,regexprep(MirrorXml,'.xml$','.link'))) |
---|
| 197 | % MirrorDir_Callback(hObject, eventdata, handles) |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | %------------------------------------------------------------------------ |
---|
| 201 | function LinkDir_Callback(hObject, eventdata, handles) |
---|
| 202 | %------------------------------------------------------------------------ |
---|
| 203 | MirrorDir=get(handles.LinkDir,'String'); |
---|
| 204 | [tild,MirrorName]=fileparts(MirrorDir); |
---|
| 205 | s=xml2struct(fullfile(MirrorDir,[MirrorName '.xml'])); |
---|
| 206 | set(handles.SourceDir,'String',s.SourceDir) |
---|
| 207 | SourceDir_Callback([],[], handles) |
---|
| 208 | %update_link(s.SourceDir, LinkDir) |
---|
| 209 | |
---|
| 210 | |
---|
| 211 | % %------------------------------------------------------------------------ |
---|
| 212 | % function update_link(SourceDir,LinkDir,handles) |
---|
| 213 | % %------------------------------------------------------------------------ |
---|
| 214 | % SourceDir_Callback([],[], handles) |
---|
| 215 | |
---|
| 216 | %------------------------------------------------------------------------ |
---|
| 217 | function SourceDir_Callback(hObject, eventdata, handles) |
---|
| 218 | %------------------------------------------------------------------------ |
---|
| 219 | set(handles.SourceDir,'BackgroundColor',[1 1 0]) |
---|
| 220 | drawnow |
---|
| 221 | SourceDir=get(handles.SourceDir,'String'); |
---|
| 222 | MirrorDir=get(handles.LinkDir,'String'); |
---|
| 223 | ExpName={''}; |
---|
| 224 | if exist(SourceDir,'dir') |
---|
| 225 | hdir=dir(SourceDir); %list files and dirs |
---|
| 226 | idir=0; |
---|
| 227 | for ilist=1:length(hdir) |
---|
| 228 | if hdir(ilist).isdir |
---|
| 229 | dirname=hdir(ilist).name; |
---|
| 230 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 231 | idir=idir+1; |
---|
| 232 | ExpName{idir}=hdir(ilist).name; |
---|
| 233 | link=fullfile(MirrorDir,ExpName{idir}) |
---|
| 234 | if ~exist(link,'dir') |
---|
| 235 | mkdir(link) |
---|
| 236 | end |
---|
| 237 | end |
---|
| 238 | % look for the list of 'devices' |
---|
| 239 | else |
---|
| 240 | %warning for isolated files |
---|
| 241 | end |
---|
| 242 | end |
---|
| 243 | set(handles.ListExperiments,'String',[{'*'};ExpName']) |
---|
| 244 | set(handles.ListExperiments,'Value',1) |
---|
| 245 | ListExperiments_Callback(hObject, eventdata, handles) |
---|
| 246 | else |
---|
| 247 | msgbox_uvmat('ERROR',['The input ' SourceDir ' is not a directory']) |
---|
| 248 | end |
---|
| 249 | set(handles.SourceDir,'BackgroundColor',[1 1 1]) |
---|
| 250 | |
---|
| 251 | |
---|
| 252 | %------------------------------------------------------------------------ |
---|
| 253 | % --- Executes on selection change in ListExperiments. |
---|
| 254 | function ListExperiments_Callback(hObject, eventdata, handles) |
---|
| 255 | %------------------------------------------------------------------------ |
---|
| 256 | SourcePath=get(handles.SourceDir,'String'); |
---|
| 257 | MirrorPath=get(handles.LinkDir,'String'); |
---|
| 258 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 259 | ListDevices={}; |
---|
| 260 | list_val=get(handles.ListExperiments,'Value'); |
---|
| 261 | if isequal(list_val(1),1) |
---|
| 262 | ListExperiments=ListExperiments(2:end); %choose all experiments |
---|
| 263 | testList=1; |
---|
| 264 | set(handles.ListExperiments,'Value',1) |
---|
| 265 | else |
---|
| 266 | ListExperiments=ListExperiments(list_val);%choose selected experiments |
---|
| 267 | testList=0; |
---|
| 268 | end |
---|
| 269 | for iexp=1:numel(ListExperiments) |
---|
| 270 | hdir=dir(fullfile(SourcePath,ListExperiments{iexp})); %list files and dirs |
---|
| 271 | idir=0; |
---|
| 272 | for ilist=1:length(hdir) |
---|
| 273 | if ~isequal(hdir(ilist).name(1),'.') |
---|
| 274 | source=fullfile(SourcePath,ListExperiments{iexp},hdir(ilist).name); |
---|
| 275 | link=fullfile(MirrorPath,ListExperiments{iexp},hdir(ilist).name); |
---|
| 276 | if ~exist(link) |
---|
| 277 | system(['ln -s ' source ' ' link]) |
---|
| 278 | end |
---|
| 279 | check_list=strcmp(hdir(ilist).name,ListDevices); |
---|
| 280 | if isempty(find(check_list)) |
---|
| 281 | ListDevices=[ListDevices;hdir(ilist).name]; |
---|
| 282 | end |
---|
| 283 | end |
---|
| 284 | end |
---|
| 285 | end |
---|
| 286 | set(handles.ListDevices,'String',ListDevices) |
---|
| 287 | % if hdir(ilist).isdir |
---|
| 288 | % dirname=hdir(ilist).name; |
---|
| 289 | % if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 290 | % idir=idir+1; |
---|
| 291 | % ExpName{idir}=hdir(ilist).name; |
---|
| 292 | % link=fullfile(LinkDir,ExpName{idir}); |
---|
| 293 | % if ~exist(link,'dir') |
---|
| 294 | % mkdir(link) |
---|
| 295 | % end |
---|
| 296 | % end |
---|
| 297 | % % look for the list of 'devices' |
---|
| 298 | % else |
---|
| 299 | % %warning for isolated files |
---|
| 300 | % end |
---|
| 301 | % end |
---|
| 302 | % set(handles.ListExperiments,'String',[{'*'};ExpName']) |
---|
| 303 | % set(handles.ListExperiments,'Value',1) |
---|
| 304 | % ListExperiments_Callback(hObject, eventdata, handles) |
---|
| 305 | |
---|
| 306 | |
---|
| 307 | % set(handles.ListDevices,'Value',1) |
---|
| 308 | % set(handles.ListRecords,'Value',1) |
---|
| 309 | % set(handles.ListXml,'Value',1) |
---|
| 310 | % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,{},{}); |
---|
| 311 | % set(handles.ListRecords,'String',[{'*'};ListRecords']) |
---|
| 312 | % set(handles.ListDevices,'String',[{'*'};ListDevices']) |
---|
| 313 | % set(handles.ListXml,'String',[{'*'};ListXml']) |
---|
| 314 | % if testList |
---|
| 315 | % DataviewData=get(handles.figure,'UserData'); |
---|
| 316 | % DataviewData.List=List; |
---|
| 317 | % set(handles.figure,'UserData',DataviewData) |
---|
| 318 | % end |
---|
| 319 | % set(handles.CampaignDoc,'Visible','on') |
---|
| 320 | % set(handles.edit_xml,'Visible','on') |
---|
| 321 | |
---|
| 322 | %------------------------------------------------------------------------ |
---|
| 323 | % --- Executes on button press in update_headings. |
---|
| 324 | function ListDevices_Callback(hObject, eventdata, handles) |
---|
| 325 | CurrentPath=get(handles.SourceDir,'String'); |
---|
| 326 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 327 | list_val=get(handles.ListExperiments,'Value'); |
---|
| 328 | if isequal(list_val,1) |
---|
| 329 | ListExperiments=ListExperiments(2:end); |
---|
| 330 | else |
---|
| 331 | ListExperiments=ListExperiments(list_val); |
---|
| 332 | end |
---|
| 333 | set(handles.ListRecords,'Value',1) |
---|
| 334 | set(handles.ListXml,'Value',1) |
---|
| 335 | ListDevices=get(handles.ListDevices,'String'); |
---|
| 336 | list_val=get(handles.ListDevices,'Value'); |
---|
| 337 | if isequal(list_val,1) |
---|
| 338 | ListDevices=ListDevices(2:end); |
---|
| 339 | else |
---|
| 340 | ListDevices=ListDevices(list_val); |
---|
| 341 | end |
---|
| 342 | [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{}); |
---|
| 343 | set(handles.ListRecords,'String',[{'*'};ListRecords']) |
---|
| 344 | set(handles.ListXml,'String',[{'*'};ListXml']) |
---|
| 345 | |
---|
| 346 | |
---|
| 347 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 348 | |
---|
| 349 | |
---|
| 350 | |
---|
| 351 | %------------------------------------------------------------------------ |
---|
| 352 | % --- Executes on selection change in ListRecords. |
---|
| 353 | function ListRecords_Callback(hObject, eventdata, handles) |
---|
| 354 | Value=get(handles.ListRecords,'Value'); |
---|
| 355 | if isequal(Value(1),1) |
---|
| 356 | set(handles.ListRecords,'Value',1); |
---|
| 357 | end |
---|
| 358 | |
---|
| 359 | %------------------------------------------------------------------------ |
---|
| 360 | % --- Executes on button press in CampaignDoc. |
---|
| 361 | function CampaignDoc_Callback(hObject, eventdata, handles) |
---|
| 362 | %------------------------------------------------------------------------ |
---|
| 363 | answer=msgbox_uvmat('INPUT_Y-N','This function will update the global xml rpresentation of the data set and the Heading of each xml file') |
---|
| 364 | if ~isequal(answer{1},'OK') |
---|
| 365 | return |
---|
| 366 | end |
---|
| 367 | set(handles.ListExperiments,'Value',1) |
---|
| 368 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
---|
| 369 | DataviewData=get(handles.figure,'UserData'); |
---|
| 370 | List=DataviewData.List; |
---|
| 371 | Currentpath=get(handles.SourceDir,'String'); |
---|
| 372 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 373 | Campaign=[Campaign DirExt]; |
---|
| 374 | t=xmltree; |
---|
| 375 | t=set(t,1,'name','CampaignDoc'); |
---|
| 376 | t = attributes(t,'add',1,'source','directory'); |
---|
| 377 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
---|
| 378 | root_uid=1; |
---|
| 379 | if SubCampaignTest |
---|
| 380 | %TO DO open an exoiting xml doc |
---|
| 381 | [t,root_uid]=add(t,1,'element','SubCampaign'); |
---|
| 382 | t =attributes(t,'add',root_uid,'DirName',Campaign); |
---|
| 383 | end |
---|
| 384 | for iexp=1:length(List.Experiment) |
---|
| 385 | set(handles.ListExperiments,'Value',iexp+1) |
---|
| 386 | drawnow |
---|
| 387 | test_mod=0; |
---|
| 388 | [t,uid_exp]=add(t,root_uid,'element','Experiment'); |
---|
| 389 | t = attributes(t,'add',uid_exp,'i',num2str(iexp)); |
---|
| 390 | ExpName=List.Experiment{iexp}.name; |
---|
| 391 | t = attributes(t,'add',uid_exp,'DirName',List.Experiment{iexp}.name); |
---|
| 392 | |
---|
| 393 | if isfield(List.Experiment{iexp},'Device') |
---|
| 394 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 395 | [t,uid_device]=add(t,uid_exp,'element','Device'); |
---|
| 396 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 397 | t = attributes(t,'add',uid_device,'DirName',List.Experiment{iexp}.Device{idevice}.name); |
---|
| 398 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 399 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 400 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
---|
| 401 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,[],FileName,SubCampaignTest); |
---|
| 402 | if test |
---|
| 403 | [List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated'] |
---|
| 404 | end |
---|
| 405 | if isequal(Title,'ImaDoc') |
---|
| 406 | [t,uid_xml]=add(t,uid_device,'element','ImaDoc'); |
---|
| 407 | t = attributes(t,'add',uid_xml,'source','file'); |
---|
| 408 | [t]=add(t,uid_xml,'chardata',List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}); |
---|
| 409 | end |
---|
| 410 | end |
---|
| 411 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 412 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 413 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 414 | [t,uid_record]=add(t,uid_device,'element','Record'); |
---|
| 415 | t = attributes(t,'add',uid_record,'DirName',RecordName); |
---|
| 416 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 417 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 418 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 419 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,RecordName,FileName,SubCampaignTest); |
---|
| 420 | if test |
---|
| 421 | [FileName ' , Heading updated'] |
---|
| 422 | end |
---|
| 423 | [t,uid_xml]=add(t,uid_record,'element','ImaDoc'); |
---|
| 424 | t = attributes(t,'add',uid_xml,'source','file'); |
---|
| 425 | [t]=add(t,uid_xml,'chardata',FileName); |
---|
| 426 | end |
---|
| 427 | end |
---|
| 428 | end |
---|
| 429 | end |
---|
| 430 | end |
---|
| 431 | end |
---|
| 432 | end |
---|
| 433 | set(handles.ListExperiments,'Value',1) |
---|
| 434 | outputdir=get(handles.SourceDir,'String'); |
---|
| 435 | [path,dirname]=fileparts(outputdir); |
---|
| 436 | outputfile=fullfile(outputdir,[dirname '.xml']); |
---|
| 437 | %campaigndoc(t); |
---|
| 438 | save(t,outputfile) |
---|
| 439 | |
---|
| 440 | %------------------------------------------------------------------------ |
---|
| 441 | % --- Executes on button press in CampaignDoc. |
---|
| 442 | function edit_xml_Callback(hObject, eventdata, handles) |
---|
| 443 | %------------------------------------------------------------------------ |
---|
| 444 | CurrentPath=get(handles.SourceDir,'String'); |
---|
| 445 | %[CurrentPath,Name,Ext]=fileparts(CurrentDir); |
---|
| 446 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 447 | Value=get(handles.ListExperiments,'Value'); |
---|
| 448 | if ~isequal(Value,1) |
---|
| 449 | ListExperiments=ListExperiments(Value); |
---|
| 450 | end |
---|
| 451 | ListDevices=get(handles.ListDevices,'String'); |
---|
| 452 | Value=get(handles.ListDevices,'Value'); |
---|
| 453 | if ~isequal(Value,1) |
---|
| 454 | ListDevices=ListDevices(Value); |
---|
| 455 | end |
---|
| 456 | ListRecords=get(handles.ListRecords,'String'); |
---|
| 457 | Value=get(handles.ListRecords,'Value'); |
---|
| 458 | if ~isequal(Value,1) |
---|
| 459 | ListRecords=ListRecords(Value); |
---|
| 460 | end |
---|
| 461 | [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 462 | ListXml=get(handles.ListXml,'String'); |
---|
| 463 | Value=get(handles.ListXml,'Value'); |
---|
| 464 | set(handles.ListXml,'Value',Value(1)); |
---|
| 465 | if isequal(Value(1),1) |
---|
| 466 | msgbox_uvmat('ERROR','an xml file needs to be selected') |
---|
| 467 | return |
---|
| 468 | else |
---|
| 469 | XmlName=ListXml{Value(1)}; |
---|
| 470 | end |
---|
| 471 | for iexp=1:length(List.Experiment) |
---|
| 472 | ExpName=List.Experiment{iexp}.name; |
---|
| 473 | if isfield(List.Experiment{iexp},'Device') |
---|
| 474 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 475 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 476 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 477 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 478 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} |
---|
| 479 | if isequal(FileName,XmlName) |
---|
| 480 | editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName)); |
---|
| 481 | return |
---|
| 482 | end |
---|
| 483 | end |
---|
| 484 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 485 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 486 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 487 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 488 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 489 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 490 | if isequal(FileName,XmlName) |
---|
| 491 | editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName)); |
---|
| 492 | return |
---|
| 493 | end |
---|
| 494 | end |
---|
| 495 | end |
---|
| 496 | end |
---|
| 497 | end |
---|
| 498 | end |
---|
| 499 | end |
---|
| 500 | end |
---|
| 501 | |
---|
| 502 | |
---|
| 503 | |
---|
| 504 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 505 | % CurrentPath/Campaign: root directory |
---|
| 506 | function [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign) |
---|
| 507 | |
---|
| 508 | %Shema for Heading: |
---|
| 509 | % Campaign |
---|
| 510 | % (SubCampaign) |
---|
| 511 | % Experiment |
---|
| 512 | % Device |
---|
| 513 | % (Record) |
---|
| 514 | % ImageName |
---|
| 515 | % DateExp |
---|
| 516 | % old: %Project: suppressed ( changed to Campaign) |
---|
| 517 | %Exp: suppressed (changed to experiment) |
---|
| 518 | %ImaNames: changed to ImageName |
---|
| 519 | if exist('Record','var') && ~isempty(Record) |
---|
| 520 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname); |
---|
| 521 | testrecord=1; |
---|
| 522 | else |
---|
| 523 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname); |
---|
| 524 | testrecord=0; |
---|
| 525 | end |
---|
| 526 | if ~exist('testSubCampaign','var') |
---|
| 527 | testSubCampaign=0; |
---|
| 528 | end |
---|
| 529 | if testSubCampaign |
---|
| 530 | SubCampaign=Campaign; |
---|
| 531 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 532 | Campaign=[Campaign DirExt]; |
---|
| 533 | end |
---|
| 534 | test_mod=0; %test for the modification of the xml file |
---|
| 535 | t_device=xmltree(xmlfullname); |
---|
| 536 | Title=get(t_device,1,'name'); |
---|
| 537 | uid_child=children(t_device,1); |
---|
| 538 | Heading_old=[]; |
---|
| 539 | uidheading=0; |
---|
| 540 | for ilist=1:length(uid_child) |
---|
| 541 | name=get(t_device,uid_child(ilist),'name'); |
---|
| 542 | if isequal(name,'Heading') |
---|
| 543 | uidheading=uid_child(ilist); |
---|
| 544 | end |
---|
| 545 | end |
---|
| 546 | if uidheading |
---|
| 547 | subt=branch(t_device,uidheading); |
---|
| 548 | Heading_old=convert(subt); |
---|
| 549 | else |
---|
| 550 | return % do not edit xml files without element 'Heading' |
---|
| 551 | end |
---|
| 552 | if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign)) |
---|
| 553 | test_mod=1; |
---|
| 554 | end |
---|
| 555 | Heading.Campaign=Campaign; |
---|
| 556 | if testSubCampaign |
---|
| 557 | if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign)) |
---|
| 558 | test_mod=1; |
---|
| 559 | end |
---|
| 560 | Heading.SubCampaign=SubCampaign; |
---|
| 561 | end |
---|
| 562 | if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment)) |
---|
| 563 | test_mod=1; |
---|
| 564 | end |
---|
| 565 | Heading.Experiment=Experiment; |
---|
| 566 | if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device)) |
---|
| 567 | test_mod=1; |
---|
| 568 | end |
---|
| 569 | Heading.Device=Device; |
---|
| 570 | if testrecord |
---|
| 571 | if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record)) |
---|
| 572 | test_mod=1; |
---|
| 573 | end |
---|
| 574 | Heading.Record=Record; |
---|
| 575 | end |
---|
| 576 | if isfield(Heading_old,'ImaNames') |
---|
| 577 | test_mod=1; |
---|
| 578 | if ~isempty(Heading_old.ImaNames) |
---|
| 579 | Heading.ImageName=Heading_old.ImaNames; |
---|
| 580 | end |
---|
| 581 | end |
---|
| 582 | if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName) |
---|
| 583 | Heading.ImageName=Heading_old.ImageName; |
---|
| 584 | end |
---|
| 585 | if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp) |
---|
| 586 | Heading.DateExp=Heading_old.DateExp; |
---|
| 587 | end |
---|
| 588 | if test_mod && uidheading |
---|
| 589 | uid_child=children(t_device,uidheading); |
---|
| 590 | t_device=delete(t_device,uid_child); |
---|
| 591 | t_device=struct2xml(Heading,t_device,uidheading); |
---|
| 592 | backupfile=xmlfullname; |
---|
| 593 | testexist=2; |
---|
| 594 | while testexist==2 |
---|
| 595 | backupfile=[backupfile '~']; |
---|
| 596 | testexist=exist(backupfile,'file'); |
---|
| 597 | end |
---|
| 598 | [success,message]=copyfile(xmlfullname,backupfile);%make backup |
---|
| 599 | if isequal(success,1) |
---|
| 600 | delete(xmlfullname) |
---|
| 601 | else |
---|
| 602 | return |
---|
| 603 | end |
---|
| 604 | save(t_device,xmlfullname) |
---|
| 605 | end |
---|
| 606 | |
---|
| 607 | %------------------------------------------------------------------------ |
---|
| 608 | % --- Executes on button press in HELP. |
---|
| 609 | function HELP_Callback(hObject, eventdata, handles) |
---|
| 610 | path_to_uvmat=which ('uvmat')% check the path of uvmat |
---|
| 611 | pathelp=fileparts(path_to_uvmat); |
---|
| 612 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
---|
| 613 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
---|
| 614 | else |
---|
| 615 | web([helpfile '#dataview']) |
---|
| 616 | end |
---|
| 617 | |
---|
| 618 | |
---|
| 619 | |
---|
| 620 | % --- Executes on selection change in ListXml. |
---|
| 621 | function ListXml_Callback(hObject, eventdata, handles) |
---|
| 622 | Value=get(handles.ListXml,'Value'); |
---|
| 623 | if isequal(Value(1),1) |
---|
| 624 | set(handles.ListXml,'Value',1); |
---|
| 625 | end |
---|
| 626 | |
---|
| 627 | |
---|
| 628 | % --- Executes on button press in clean_civ_cmx. |
---|
| 629 | function clean_civ_cmx_Callback(hObject, eventdata, handles) |
---|
| 630 | message='this function will delete all files with extensions .log, .bat, .cmx,.cmx2,.errors in the input directory(ies)'; |
---|
| 631 | answer=msgbox_uvmat('INPUT_Y-N',message); |
---|
| 632 | if ~isequal(answer,'Yes') |
---|
| 633 | return |
---|
| 634 | end |
---|
| 635 | set(handles.ListExperiments,'Value',1) |
---|
| 636 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
---|
| 637 | DataviewData=get(handles.figure,'UserData') |
---|
| 638 | List=DataviewData.List; |
---|
| 639 | Currentpath=get(handles.SourceDir,'String'); |
---|
| 640 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 641 | Campaign=[Campaign DirExt]; |
---|
| 642 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
---|
| 643 | nbdelete_tot=0; |
---|
| 644 | for iexp=1:length(List.Experiment) |
---|
| 645 | set(handles.ListExperiments,'Value',iexp+1) |
---|
| 646 | drawnow |
---|
| 647 | test_mod=0; |
---|
| 648 | ExpName=List.Experiment{iexp}.name; |
---|
| 649 | nbdelete=0; |
---|
| 650 | if isfield(List.Experiment{iexp},'Device') |
---|
| 651 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 652 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 653 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 654 | currentdir=fullfile(Currentpath,Campaign,ExpName,DeviceName); |
---|
| 655 | hdir=dir(currentdir); %list files and dirs |
---|
| 656 | idir=0; |
---|
| 657 | for ilist=1:length(hdir) |
---|
| 658 | if hdir(ilist).isdir |
---|
| 659 | dirname=hdir(ilist).name; |
---|
| 660 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 661 | CivDir=fullfile(currentdir,dirname) |
---|
| 662 | hCivDir=dir(CivDir); |
---|
| 663 | for ilist=1:length(hCivDir) |
---|
| 664 | FileName=hCivDir(ilist).name; |
---|
| 665 | [dd,ff,Ext]=fileparts(FileName); |
---|
| 666 | if isequal(Ext,'.log')||isequal(Ext,'.bat')||isequal(Ext,'.cmx')||isequal(Ext,'.cmx2')|| isequal(Ext,'.errors') |
---|
| 667 | delete(fullfile(CivDir,FileName)) |
---|
| 668 | nbdelete=nbdelete+1; |
---|
| 669 | end |
---|
| 670 | end |
---|
| 671 | end |
---|
| 672 | end |
---|
| 673 | end |
---|
| 674 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 675 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 676 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 677 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 678 | 'look at subdirectories' |
---|
| 679 | end |
---|
| 680 | end |
---|
| 681 | end |
---|
| 682 | end |
---|
| 683 | end |
---|
| 684 | display([num2str(nbdelete) ' files deleted']) |
---|
| 685 | nbdelete_tot=nbdelete_tot+nbdelete; |
---|
| 686 | end |
---|
| 687 | msgbox_uvmat('CONFIRMATION',['END: ' num2str(nbdelete_tot) ' files deleted by clean_civ_cmx']) |
---|
| 688 | set(handles.ListExperiments,'Value',1) |
---|
| 689 | |
---|
| 690 | |
---|
| 691 | % --- Executes on button press in OK. |
---|
| 692 | function OK_Callback(hObject, eventdata, handles) |
---|
| 693 | %------------------------------------------------------------------------ |
---|
| 694 | CurrentPath=get(handles.SourceDir,'String'); |
---|
| 695 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 696 | IndicesExp=get(handles.ListExperiments,'Value'); |
---|
| 697 | if ~isequal(IndicesExp,1) |
---|
| 698 | ListExperiments=ListExperiments(IndicesExp); |
---|
| 699 | end |
---|
| 700 | ListDevices=get(handles.ListDevices,'String'); |
---|
| 701 | Value=get(handles.ListDevices,'Value'); |
---|
| 702 | if isequal(Value,1) |
---|
| 703 | msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated') |
---|
| 704 | return |
---|
| 705 | else |
---|
| 706 | ListDevices=ListDevices(Value); |
---|
| 707 | end |
---|
| 708 | ListRecords=get(handles.ListRecords,'String'); |
---|
| 709 | Value=get(handles.ListRecords,'Value'); |
---|
| 710 | if ~isequal(Value,1) |
---|
| 711 | ListRecords=ListRecords(Value); |
---|
| 712 | end |
---|
| 713 | [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 714 | ListXml=get(handles.ListXml,'String'); |
---|
| 715 | Value=get(handles.ListXml,'Value'); |
---|
| 716 | if isequal(Value,1) |
---|
| 717 | msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit') |
---|
| 718 | return |
---|
| 719 | else |
---|
| 720 | ListXml=ListXml(Value); |
---|
| 721 | end |
---|
| 722 | |
---|
| 723 | %update all the selected xml files |
---|
| 724 | DataviewData=get(handles.figure,'UserData'); |
---|
| 725 | % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ... |
---|
| 726 | % DataviewData.GeometryCalib.CalibrationType ' calibration data']) |
---|
| 727 | % if ~isequal(answer,'Yes') |
---|
| 728 | % return |
---|
| 729 | % end |
---|
| 730 | %List.Experiment{1}.Device{1} |
---|
| 731 | %List.Experiment{2}.Device{1} |
---|
| 732 | for iexp=1:length(List.Experiment) |
---|
| 733 | ExpName=List.Experiment{iexp}.name; |
---|
| 734 | set(handles.ListExperiments,'Value',IndicesExp(iexp)); |
---|
| 735 | if isfield(List.Experiment{iexp},'Device') |
---|
| 736 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 737 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 738 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 739 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 740 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
---|
| 741 | for ilistxml=1:length(ListXml) |
---|
| 742 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 743 | set(handles.ListXml,'Value',Value(ilistxml)) |
---|
| 744 | drawnow |
---|
| 745 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); |
---|
| 746 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
---|
| 747 | display([xmlfullname ' updated']) |
---|
| 748 | break |
---|
| 749 | end |
---|
| 750 | end |
---|
| 751 | end |
---|
| 752 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 753 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 754 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 755 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 756 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 757 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 758 | for ilistxml=1:length(ListXml) |
---|
| 759 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 760 | set(handles.ListXml,'Value',Value(ilistxml)) |
---|
| 761 | drawnow |
---|
| 762 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); |
---|
| 763 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
---|
| 764 | display([xmlfullname ' updated']) |
---|
| 765 | break |
---|
| 766 | end |
---|
| 767 | end |
---|
| 768 | end |
---|
| 769 | end |
---|
| 770 | end |
---|
| 771 | end |
---|
| 772 | end |
---|
| 773 | end |
---|
| 774 | end |
---|
| 775 | set(handles.ListXml,'Value',Value) |
---|
| 776 | % |
---|
| 777 | % |
---|
| 778 | % |
---|
| 779 | % |
---|
| 780 | % |
---|
| 781 | % |
---|
| 782 | % |
---|
| 783 | % CurrentPath=get(handles.SourceDir,'String');%= get(hObject,'String'); |
---|
| 784 | % ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 785 | % Value=get(handles.ListExperiments,'Value'); |
---|
| 786 | % if ~isequal(Value,1) |
---|
| 787 | % ListExperiments=ListExperiments(Value); |
---|
| 788 | % end |
---|
| 789 | % ListDevices=get(handles.ListDevices,'String'); |
---|
| 790 | % Value=get(handles.ListDevices,'Value'); |
---|
| 791 | % if isequal(Value,1) |
---|
| 792 | % msgbox_uvmat('ERROR','manually select in the GUI datatree_browser the device being calibrated') |
---|
| 793 | % return |
---|
| 794 | % else |
---|
| 795 | % ListDevices=ListDevices(Value); |
---|
| 796 | % end |
---|
| 797 | % ListRecords=get(handles.ListRecords,'String'); |
---|
| 798 | % Value=get(handles.ListRecords,'Value'); |
---|
| 799 | % if ~isequal(Value,1) |
---|
| 800 | % ListRecords=ListRecords(Value); |
---|
| 801 | % end |
---|
| 802 | % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 803 | % ListXml=get(handles.ListXml,'String'); |
---|
| 804 | % Value=get(handles.ListXml,'Value'); |
---|
| 805 | % if isequal(Value,1) |
---|
| 806 | % msgbox_uvmat('ERROR','you need to select in the GUI datatree_browser the xml files to edit') |
---|
| 807 | % return |
---|
| 808 | % else |
---|
| 809 | % ListXml=ListXml(Value); |
---|
| 810 | % end |
---|
| 811 | % handles.output.CurrentPath=CurrentPath; |
---|
| 812 | % handles.output.ListExperiments=ListExperiments; |
---|
| 813 | % handles.output.ListDevices=ListDevices; |
---|
| 814 | % handles.output.ListRecords=ListRecords; |
---|
| 815 | % handles.output.ListXml=ListXml; |
---|
| 816 | % handles.output.List=List; |
---|
| 817 | handles.output ='OK, Calibration replicated'; |
---|
| 818 | guidata(hObject, handles);% Update handles structure |
---|
| 819 | uiresume(handles.figure); |
---|
| 820 | |
---|
| 821 | % --- Executes on button press in Cancel. |
---|
| 822 | function Cancel_Callback(hObject, eventdata, handles) |
---|
| 823 | handles.output = get(hObject,'String'); |
---|
| 824 | guidata(hObject, handles); % Update handles structure |
---|
| 825 | % Use UIRESUME instead of delete because the OutputFcn needs |
---|
| 826 | uiresume(handles.figure); |
---|
| 827 | |
---|
| 828 | % --- Executes when user attempts to close figure. |
---|
| 829 | function figure_CloseRequestFcn(hObject, eventdata, handles) |
---|
| 830 | % if isequal(get(handles.figure, 'waitstatus'), 'waiting') |
---|
| 831 | % % The GUI is still in UIWAIT, us UIRESUME |
---|
| 832 | % uiresume(handles.figure); |
---|
| 833 | % else |
---|
| 834 | % % The GUI is no longer waiting, just close it |
---|
| 835 | % delete(handles.figure); |
---|
| 836 | % end |
---|
| 837 | |
---|
| 838 | % --- Executes on key press over figure1 with no controls selected. |
---|
| 839 | function figure_KeyPressFcn(hObject, eventdata, handles) |
---|
| 840 | % Check for "enter" or "escape" |
---|
| 841 | if isequal(get(hObject,'CurrentKey'),'escape') |
---|
| 842 | % User said no by hitting escape |
---|
| 843 | handles.output = 'Cancel'; |
---|
| 844 | |
---|
| 845 | % Update handles structure |
---|
| 846 | guidata(hObject, handles); |
---|
| 847 | |
---|
| 848 | uiresume(handles.figure); |
---|
| 849 | end |
---|
| 850 | if isequal(get(hObject,'CurrentKey'),'return') |
---|
| 851 | uiresume(handles.figure); |
---|
| 852 | end |
---|