Changeset 1059 for trunk/src/uvmat.m
- Timestamp:
- Nov 29, 2018, 5:44:44 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1058 r1059 1202 1202 uicontrol('Style','pushbutton','Units','normalized', 'Position', [ii ii wwp hh],'BackgroundColor',[1 0 0],'String','APPLY','Callback',@(hObject,eventdata)set_slice_APPLY_Callback(hObject,eventdata),... 1203 1203 'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''APPLY'': apply the output to the current field series in uvmat'); 1204 uicontrol('Style',' pushbutton','Units','normalized', 'Position', [2*ii+wwp ii wwp hh],'BackgroundColor',[1 0 0],'String','REPLICATE','Callback',@(hObject,eventdata)set_slice_REPLICATE_Callback(hObject,eventdata),...1205 'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''R EPLICATE'': replicate the output fora series of experiments');1204 uicontrol('Style','checkbox','Units','normalized', 'Position', [2*ii+wwp ii wwp hh],'BackgroundColor',[1 0 0],'String','Replicate','Callback',@(hObject,eventdata)set_slice_REPLICATE_Callback(hObject,eventdata),... 1205 'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''Replicate'': select to replicate the output of APPLY to a series of experiments'); 1206 1206 uicontrol('Style','pushbutton','Units','normalized', 'Position', [3*ii+2*wwp ii wwp hh],'Callback',@(hObject,eventdata)set_slice_Cancel_Callback(hObject,eventdata),... 1207 1207 'String','Cancel','FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''Cancel'': quit GUI without action'); … … 1272 1272 end 1273 1273 1274 hreplicate=findobj(hObject,'Tag','Replicate'); 1275 if get(hreplicate,'Value') 1276 'TEST' 1277 else 1278 1274 1279 %% store the result in the xml file used for calibration 1275 1280 errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file … … 1284 1289 uvmat('InputFileREFRESH_Callback',huvmat,[],hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 1285 1290 set(hObject,'BackgroundColor',[1 0 0]);% paint button back to red 1291 end 1286 1292 1287 1293 delete(hset_slice) … … 1291 1297 function set_slice_REPLICATE_Callback(hObject,eventdata) 1292 1298 %------------------------------------------------------------------------ 1293 set(hObject,'BackgroundColor',[1 1 0]) 1294 drawnow 1295 1296 %% read the GUI set_slice 1297 SliceData=read_GUI(get(hObject,'parent')); 1298 1299 %% get info on the GUI uvmat 1300 huvmat=findobj(allchild(0),'Tag','uvmat'); 1301 hhuvmat=guidata(huvmat); 1302 RootPath=read_file_boxes(hhuvmat); 1303 1304 OutPutDir=uigetfile_uvmat('choose an image folder to document with slice position?',fileparts(RootPath),'uigetdir'); 1305 OutPut=browse_data(OutPutDir,'off','on'); 1306 nbcalib=0; 1307 for ilist=1:numel(OutPut.Experiment) 1308 for idevice=1:numel(OutPut.DataSeries) 1309 SubDirBase=regexprep(OutPut.DataSeries{idevice},'\..+$',''); 1310 XmlFile=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},[SubDirBase '.xml']); 1311 1312 % read the current xml file 1313 if exist(XmlFile,'file') 1314 [s,errormsg]=imadoc2struct(XmlFile,'GeometryCalib'); 1315 if ~isempty(errormsg) 1316 msgbox_uvmat('ERROR',['error in reading ' XmlFile ': ' errormsg]) 1317 return 1318 end 1319 GeometryCalib=s.GeometryCalib; 1320 GeometryCalib.NbSlice=SliceData.NbSlice; 1321 GeometryCalib.CheckVolumeScan=SliceData.CheckVolumeScan; 1322 Z_plane=linspace(SliceData.Z(1),SliceData.Z(2),SliceData.NbSlice); 1323 GeometryCalib.SliceCoord=Z_plane'*[0 0 1]; 1324 GeometryCalib.SliceAngle=zeros(GeometryCalib.NbSlice,3); 1325 Angle_1=linspace(SliceData.SliceAngle_1(1),SliceData.SliceAngle_1(2),SliceData.NbSlice); 1326 Angle_2=linspace(SliceData.SliceAngle_2(1),SliceData.SliceAngle_2(2),SliceData.NbSlice); 1327 GeometryCalib.SliceAngle(:,1)=Angle_1';%rotation around x axis (to generalise) 1328 GeometryCalib.SliceAngle(:,2)=Angle_2';%rotation around y axis (to generalise) 1329 GeometryCalib.SliceAngle(:,3)=0; 1330 if SliceData.CheckRefraction 1331 GeometryCalib.InterfaceCoord=[0 0 SliceData.H]; 1332 GeometryCalib.RefractionIndex=SliceData.RefractionIndex; 1333 elseif isfield(GeometryCalib,'RefractionIndex') 1334 GeometryCalib=rmfield(GeometryCalib,'RefractionIndex'); 1335 GeometryCalib=rmfield(GeometryCalib,'InterfaceCoord'); 1336 end 1337 1338 % update the current xml file 1339 errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file 1340 if ~strcmp(errormsg,'') 1341 msgbox_uvmat('ERROR',errormsg); 1342 else 1343 display([XmlFile ' updated with slice positions']) 1344 nbcalib=nbcalib+1; 1345 end 1346 end 1347 end 1348 end 1349 set(hObject,'BackgroundColor',[1 0 0]) 1350 msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated with slice positions for ' num2str(nbcalib) ' experiments']); 1351 1299 if get(hObject,'Value') %open the GUI browse_data 1300 % look for the GUI uvmat and check for an image as input 1301 huvmat=findobj(allchild(0),'Name','uvmat'); 1302 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat 1303 RootPath=get(hhuvmat.RootPath,'String'); 1304 SubDir=get(hhuvmat.SubDir,'String'); 1305 browse_data(fullfile(RootPath,SubDir)) 1306 else 1307 hbrowse=findobj(allchild(0),'Tag','browse_data'); 1308 if ~isempty(hbrowse) 1309 delete(hbrowse) 1310 end 1311 end 1312 1313 % 1314 % set(hObject,'BackgroundColor',[1 1 0]) 1315 % drawnow 1316 % 1317 % %% read the GUI set_slice 1318 % SliceData=read_GUI(get(hObject,'parent')); 1319 % 1320 % %% get info on the GUI uvmat 1321 % huvmat=findobj(allchild(0),'Tag','uvmat'); 1322 % hhuvmat=guidata(huvmat); 1323 % RootPath=read_file_boxes(hhuvmat); 1324 % 1325 % OutPutDir=uigetfile_uvmat('choose an image folder to document with slice position?',fileparts(RootPath),'uigetdir'); 1326 % OutPut=browse_data(OutPutDir,'off','on'); 1327 % nbcalib=0; 1328 % for ilist=1:numel(OutPut.Experiment) 1329 % for idevice=1:numel(OutPut.DataSeries) 1330 % SubDirBase=regexprep(OutPut.DataSeries{idevice},'\..+$',''); 1331 % XmlFile=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},[SubDirBase '.xml']); 1332 % 1333 % % read the current xml file 1334 % if exist(XmlFile,'file') 1335 % [s,errormsg]=imadoc2struct(XmlFile,'GeometryCalib'); 1336 % if ~isempty(errormsg) 1337 % msgbox_uvmat('ERROR',['error in reading ' XmlFile ': ' errormsg]) 1338 % return 1339 % end 1340 % GeometryCalib=s.GeometryCalib; 1341 % GeometryCalib.NbSlice=SliceData.NbSlice; 1342 % GeometryCalib.CheckVolumeScan=SliceData.CheckVolumeScan; 1343 % Z_plane=linspace(SliceData.Z(1),SliceData.Z(2),SliceData.NbSlice); 1344 % GeometryCalib.SliceCoord=Z_plane'*[0 0 1]; 1345 % GeometryCalib.SliceAngle=zeros(GeometryCalib.NbSlice,3); 1346 % Angle_1=linspace(SliceData.SliceAngle_1(1),SliceData.SliceAngle_1(2),SliceData.NbSlice); 1347 % Angle_2=linspace(SliceData.SliceAngle_2(1),SliceData.SliceAngle_2(2),SliceData.NbSlice); 1348 % GeometryCalib.SliceAngle(:,1)=Angle_1';%rotation around x axis (to generalise) 1349 % GeometryCalib.SliceAngle(:,2)=Angle_2';%rotation around y axis (to generalise) 1350 % GeometryCalib.SliceAngle(:,3)=0; 1351 % if SliceData.CheckRefraction 1352 % GeometryCalib.InterfaceCoord=[0 0 SliceData.H]; 1353 % GeometryCalib.RefractionIndex=SliceData.RefractionIndex; 1354 % elseif isfield(GeometryCalib,'RefractionIndex') 1355 % GeometryCalib=rmfield(GeometryCalib,'RefractionIndex'); 1356 % GeometryCalib=rmfield(GeometryCalib,'InterfaceCoord'); 1357 % end 1358 % 1359 % % update the current xml file 1360 % errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file 1361 % if ~strcmp(errormsg,'') 1362 % msgbox_uvmat('ERROR',errormsg); 1363 % else 1364 % display([XmlFile ' updated with slice positions']) 1365 % nbcalib=nbcalib+1; 1366 % end 1367 % end 1368 % end 1369 % end 1370 % set(hObject,'BackgroundColor',[1 0 0]) 1371 % msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated with slice positions for ' num2str(nbcalib) ' experiments']); 1372 % 1352 1373 1353 1374 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.