- Timestamp:
- Apr 17, 2019, 6:22:25 PM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/browse_data.m
r1061 r1063 24 24 function varargout = browse_data(varargin) 25 25 26 % Last Modified by GUIDE v2.5 08-Sep-2018 19:03:4026 % Last Modified by GUIDE v2.5 17-Apr-2019 18:15:24 27 27 28 28 % Begin initialization code - DO NOT EDIT … … 75 75 set(hObject, 'Units', OldUnits); 76 76 if exist('MultiDevices','var') && strcmp(MultiDevices,'on') 77 set(handles. ListDevices,'Max',2)78 else 79 set(handles. ListDevices,'Max',1)77 set(handles.DataSeries,'Max',2) 78 else 79 set(handles.DataSeries,'Max',1) 80 80 end 81 81 if exist('EnableMirror','var') && strcmp(EnableMirror,'on') … … 212 212 % List the experiments in a campaign, filling the menu ListExperiments 213 213 %------------------------------------------------------------------------ 214 function errormsg=scan_campaign(handles,Campaign,Experiment,Data Series)214 function errormsg=scan_campaign(handles,Campaign,Experiment,DataInput) 215 215 %------------------------------------------------------------------------ 216 216 errormsg=''; … … 233 233 set(handles.ListExperiments,'Value',index)% initialise the menu selection with the folder defined by the input 234 234 ListExperiments_Callback([],[], handles) 235 ListDevices=get(handles.ListDevices,'String');236 index=find(strcmp(['+/' Data Series],ListDevices));235 DataSeries=get(handles.DataSeries,'String'); 236 index=find(strcmp(['+/' DataInput],DataSeries)); 237 237 if isempty(index) 238 index=find(strcmp(['~/' Data Series],ListDevices));238 index=find(strcmp(['~/' DataInput],DataSeries)); 239 239 end 240 240 if ~isempty(index) 241 set(handles. ListDevices,'Value',index)241 set(handles.DataSeries,'Value',index) 242 242 end 243 243 else … … 270 270 function list_dataseries(handles,ListExperiments,MirrorPath) 271 271 272 ListDevices={};272 DataSeries={}; 273 273 for iexp=1:numel(ListExperiments) 274 274 if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory … … 295 295 ListFiles{ilist}=['+/' ListFiles{ilist}];%mark dir by '+' in the list 296 296 end 297 if isempty(find(strcmp(ListFiles{ilist}, ListDevices), 1))% if the item is not already in ListDevices298 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list297 if isempty(find(strcmp(ListFiles{ilist},DataSeries), 1))% if the item is not already in DataSeries 298 DataSeries=[DataSeries;ListFiles{ilist}]; %append the item to the list 299 299 end 300 300 end … … 303 303 end 304 304 end 305 set(handles. ListDevices,'Value',1)306 set(handles. ListDevices,'String',sort(ListDevices))305 set(handles.DataSeries,'Value',1) 306 set(handles.DataSeries,'String',sort(DataSeries)) 307 307 308 308 %------------------------------------------------------------------------ … … 311 311 function update_experiments(handles,ListExperiments,CampaignPath,MirrorPath) 312 312 313 ListDevices={};313 DataSeries={}; 314 314 for iexp=1:numel(ListExperiments) 315 315 if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory … … 350 350 system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder 351 351 end 352 if isempty(find(strcmp(ListFiles{ilist}, ListDevices), 1))% if the item is not already in ListDevices352 if isempty(find(strcmp(ListFiles{ilist},DataSeries), 1))% if the item is not already in DataSeries 353 353 if check_dir(ilist) 354 354 ListFiles{ilist}=['+/' ListFiles{ilist}];%mark dir by '+' in the list 355 355 end 356 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list356 DataSeries=[DataSeries;ListFiles{ilist}]; %append the item to the list 357 357 end 358 358 end … … 361 361 end 362 362 end 363 set(handles. ListDevices,'String',sort(ListDevices))363 set(handles.DataSeries,'String',sort(DataSeries)) 364 364 365 365 %------------------------------------------------------------------------ … … 464 464 end 465 465 Experiment=regexprep(Experiment,'^\+/','');% remove the +/ used to mark dir 466 Device=get(handles. ListDevices,'String');467 Value=get(handles. ListDevices,'Value');466 Device=get(handles.DataSeries,'String'); 467 Value=get(handles.DataSeries,'Value'); 468 468 Device=Device(Value); 469 469 Device=regexprep(Device,'^\+/','');% remove the +/ used to mark dir … … 553 553 function Up_Callback(hObject, eventdata, handles) 554 554 SourceDir=get(handles.SourceDir,'String'); 555 % Device= ListDevices{get(handles.ListDevices,'Value')};555 % Device=DataSeries{get(handles.DataSeries,'Value')}; 556 556 % DataSeries=uigetfile_uvmat('open a data folder',Device,'uigetdir'); 557 557 % uiresume(handles.browse_data); … … 566 566 SourceFolder=regexprep(ListExperiments{list_val(1)},'+',''); 567 567 set(handles.SourceDir,'String',fullfile(SourceDir,SourceFolder)) 568 ListDevices=get(handles.ListDevices,'String');569 ValueDevice=get(handles. ListDevices,'Value');570 set(handles.ListExperiments,'String', ListDevices)568 DataSeries=get(handles.DataSeries,'String'); 569 ValueDevice=get(handles.DataSeries,'Value'); 570 set(handles.ListExperiments,'String',DataSeries) 571 571 set(handles.ListExperiments,'Value',ValueDevice) 572 572 ListExperiments_Callback(hObject, [], handles) 573 % Device=regexprep( ListDevices{get(handles.ListDevices,'Value')},'+','');573 % Device=regexprep(DataSeries{get(handles.DataSeries,'Value')},'+',''); 574 574 % Device=regexprep(Device,'~',''); 575 575 % PathDevice=fullfile(SourceDir,SourceFolder,Device); … … 578 578 % % uiresume(handles.browse_data); 579 579 % browse_data(fullfile(PathDevice,NewDevice)) 580 581 582 % --- Executes on selection change in DataSeries. 583 function DataSeries_Callback(hObject, eventdata, handles) 584 % hObject handle to DataSeries (see GCBO) 585 % eventdata reserved - to be defined in a future version of MATLAB 586 % handles structure with handles and user data (see GUIDATA) 587 588 % Hints: contents = cellstr(get(hObject,'String')) returns DataSeries contents as cell array 589 % contents{get(hObject,'Value')} returns selected item from DataSeries 590 591 592 % --- Executes on button press in CheckDevices. 593 function CheckDevices_Callback(hObject, eventdata, handles) 594 if get(handles.CheckDevices,'Value') 595 set(handles.ListDevices,'Visible','on') 596 else 597 set(handles.ListDevices,'Visible','off') 598 end -
trunk/src/geometry_calib.m
r1062 r1063 255 255 ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']; 256 256 [num2str(numel(ind_removed)) ' points removed']}); 257 SliceCoord_ref=[0 0 0]; %default reference plane 257 258 if strcmp(answer,'Yes') %store the calibration data 258 259 if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration … … 268 269 %%%%% use of the option 'replicate' 269 270 if get(handles.Replicate,'Value')% if the option replicate is activated 271 nbcalib=0; 270 272 %% open the GUI browse_data 271 273 hbrowse=findobj(allchild(0),'Tag','browse_data'); … … 276 278 ListValues=get(BrowseHandles.ListExperiments,'Value'); 277 279 ListExperiments=ListExperiments(ListValues); 278 ListDevices=get(BrowseHandles.ListDevices,'String'); 279 Val=get(BrowseHandles.ListDevices,'Value'); 280 DataFolder=ListDevices{Val}; 281 nbcalib=0; 280 DataSeries=get(BrowseHandles.DataSeries,'String'); 281 Val=get(BrowseHandles.DataSeries,'Value'); 282 DataFolder=DataSeries{Val}; 282 283 for ilist=1:numel(ListExperiments) 283 284 SubDirBase=regexprep(DataFolder,'+/',''); 284 285 ListExperiments{ilist}=regexprep(ListExperiments{ilist},'+/',''); 285 286 XmlName=fullfile(SourceDir,ListExperiments{ilist},[SubDirBase '.xml']); 286 % copy the xml file from the old location if appropriate, then update with the calibration parameters 287 % if ~exist(XmlName,'file') && ~isempty(SubDirBase) 288 % oldxml=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},SubDirBase,[get(hhuvmat.RootFile,'String') '.xml']); 289 GeometryCalib.SliceCoord=SliceCoord_ref;%default input 290 if exist(XmlName,'file') 291 %[success,message]=copyfile(oldxml,XmlName);%copy the old xml file to a new one with the new convention 292 dispmesGeometryCalib=UvData.XmlData{1}.GeometryCalib; 287 errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file 288 if ~strcmp(errormsg,'') 289 msgbox_uvmat('ERROR',errormsg); 293 290 else 294 msgbox_uvmat('ERROR','3D geometric calibration needed before defining slices') 295 return 296 end 297 SliceCoord=GeometryCalib.SliceCoord; 298 InterfaceCoord=min(SliceCoord(:,3)); 299 if isfield(GeometryCalib,'InterfaceCoord') 300 InterfaceCoord=GeometryCalib.InterfaceCoord(1,3); 301 end 302 NbSlice=size(SliceCoord,1); 303 CheckVolumeScan=0; 304 if isfield(GeometryCalib,'CheckVolumeScan') 305 CheckVolumeScan=GeometryCalib.CheckVolumeScan; 306 end 307 RefractionIndex=1.33; 308 CheckRefraction=0;% default value of the check box refraction 309 if isfield(GeometryCalib,'RefractionIndex') 310 RefractionIndex=GeometryCalib.RefractionIndex; 311 CheckRefraction=1; 312 end 313 SliceAngle=[0 0 0]; 314 if isfield(GeometryCalib,'SliceAngle') 315 SliceAngle=GeometryCalib.SliceAngle; 316 end 317 dispmessage=' updated with calibration parameters'; 318 % if ~strcmp(answer,'yes') 319 [XmlDataOld,warntext]=imadoc2struct(XmlName); 320 if isfield(XmlDataOld,'GeometryCalib') 321 if isfield(XmlDataOld.GeometryCalib,'SliceAngle') 322 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.SliceAngle; 323 end 324 if isfield(XmlDataOld.GeometryCalib,'CheckRefraction') 325 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.CheckRefraction; 326 end 327 if isfield(XmlDataOld.GeometryCalib,'RefractionIndex') 328 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.RefractionIndex; 329 end 330 if isfield(XmlDataOld.GeometryCalib,'InterfaceCoord') 331 GeometryCalib.SliceAngle=XmlDataOld.GeometryCalib.InterfaceCoord; 332 end 291 display([XmlName ' updated with calibration parameters']) 292 nbcalib=nbcalib+1; 333 293 end 334 294 end 335 336 else % in case the GUI 'replicate'is not found337 dispmessage=' created with calibration parameters';338 295 end 339 errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file 296 msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated for ' num2str(nbcalib) ' experiments']); 297 else 298 %% copy the xml file from the old location if appropriate, then update with the calibration parameters 299 if ~exist(outputfile,'file') && ~isempty(SubDirBase) 300 oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml']; 301 if exist(oldxml,'file') 302 [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention 303 end 304 end 305 errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file 340 306 if ~strcmp(errormsg,'') 341 307 msgbox_uvmat('ERROR',errormsg); 308 end 309 310 %% display image with new calibration in the currently opened uvmat interface 311 FieldList=get(hhuvmat.FieldName,'String'); 312 val=get(hhuvmat.FieldName,'Value'); 313 if strcmp(FieldList{val},'image') 314 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image 315 UserData=get(handles.geometry_calib,'UserData'); 316 UserData.XmlInputFile=outputfile;%save the current xml file name 317 set(handles.geometry_calib,'UserData',UserData) 318 uvmat('InputFileREFRESH_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 319 PLOT_Callback(hObject, eventdata, handles) 320 set(handles.CoordLine,'string',num2str(index)) 321 Coord=get(handles.ListCoord,'Data'); 322 update_calib_marker(Coord(index,:)); %indicate the point with max deviations from phys coord to calibration 323 figure(handles.geometry_calib)% put the GUI geometry_calib in front 342 324 else 343 display([XmlName dispmessage]) 344 nbcalib=nbcalib+1; 325 msgbox_uvmat('WARNING','open the image to see the effect of the new calibration') 345 326 end 346 327 end 347 % Use of the option replicate348 end349 msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated for ' num2str(nbcalib) ' experiments']);350 351 352 %% copy the xml file from the old location if appropriate, then update with the calibration parameters353 if ~exist(outputfile,'file') && ~isempty(SubDirBase)354 oldxml=[fullfile(RootPath,SubDirBase,get(hhuvmat.RootFile,'String')) '.xml'];355 if exist(oldxml,'file')356 [success,message]=copyfile(oldxml,outputfile);%copy the old xml file to a new one with the new convention357 end358 end359 errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file360 if ~strcmp(errormsg,'')361 msgbox_uvmat('ERROR',errormsg);362 end363 364 %% display image with new calibration in the currently opened uvmat interface365 FieldList=get(hhuvmat.FieldName,'String');366 val=get(hhuvmat.FieldName,'Value');367 if strcmp(FieldList{val},'image')368 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image369 UserData=get(handles.geometry_calib,'UserData');370 UserData.XmlInputFile=outputfile;%save the current xml file name371 set(handles.geometry_calib,'UserData',UserData)372 uvmat('InputFileREFRESH_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates373 PLOT_Callback(hObject, eventdata, handles)374 set(handles.CoordLine,'string',num2str(index))375 Coord=get(handles.ListCoord,'Data');376 update_calib_marker(Coord(index,:)); %indicate the point with max deviations from phys coord to calibration377 figure(handles.geometry_calib)% put the GUI geometry_calib in front378 else379 msgbox_uvmat('WARNING','open the image to see the effect of the new calibration')380 328 end 381 329 382 330 set(handles.APPLY,'BackgroundColor',[1 0 0]) % set APPLY button to red color 383 331 384 332 %------------------------------------------------------------------------ 385 333 % --- Executes on button press in Replicate 386 function Replicate_Callback(hObject, eventdata, handles)387 % %------------------------------------------------------------------------388 set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)389 390 if get(handles.Replicate,'Value') %open the GUI browse_data391 % look for the GUI uvmat and check for an image as input392 huvmat=findobj(allchild(0),'Name','uvmat');393 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat394 RootPath=get(hhuvmat.RootPath,'String');395 SubDir=get(hhuvmat.SubDir,'String');396 browse_data(fullfile(RootPath,SubDir))397 else398 hbrowse=findobj(allchild(0),'Tag','browse_data');399 if ~isempty(hbrowse)400 delete(hbrowse)401 end402 end334 function Replicate_Callback(hObject, eventdata, handles) 335 % %------------------------------------------------------------------------ 336 set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points) 337 338 if get(handles.Replicate,'Value') %open the GUI browse_data 339 % look for the GUI uvmat and check for an image as input 340 huvmat=findobj(allchild(0),'Name','uvmat'); 341 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat 342 RootPath=get(hhuvmat.RootPath,'String'); 343 SubDir=get(hhuvmat.SubDir,'String'); 344 browse_data(fullfile(RootPath,SubDir)) 345 else 346 hbrowse=findobj(allchild(0),'Tag','browse_data'); 347 if ~isempty(hbrowse) 348 delete(hbrowse) 349 end 350 end 403 351 %------------------------------------------------------------------------ 404 352 % --- activate calibration and store parameters in ouputfile . -
trunk/src/set_object.m
r1062 r1063 340 340 set(handles.num_RangeX_2,'Visible','on') 341 341 set(handles.num_RangeY_1,'Visible','on') 342 %set(handles.num_RangeY_2,'Visible','on')342 set(handles.num_RangeY_2,'Visible','on') 343 343 set(handles.num_RangeZ_2,'TooltipString','num_ZMax: range of projection normal to the plane') 344 344 if test3D
Note: See TracChangeset
for help on using the changeset viewer.