Changeset 1059 for trunk/src/uvmat.m


Ignore:
Timestamp:
Nov 29, 2018, 5:44:44 PM (5 years ago)
Author:
sommeria
Message:

various bugs repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1058 r1059  
    12021202uicontrol('Style','pushbutton','Units','normalized', 'Position', [ii ii wwp hh],'BackgroundColor',[1 0 0],'String','APPLY','Callback',@(hObject,eventdata)set_slice_APPLY_Callback(hObject,eventdata),...
    12031203    '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','''REPLICATE'': replicate the output for a series of experiments');
     1204uicontrol('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');
    12061206uicontrol('Style','pushbutton','Units','normalized', 'Position', [3*ii+2*wwp ii wwp hh],'Callback',@(hObject,eventdata)set_slice_Cancel_Callback(hObject,eventdata),...
    12071207    'String','Cancel','FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''Cancel'': quit GUI without action');
     
    12721272end
    12731273
     1274hreplicate=findobj(hObject,'Tag','Replicate');
     1275if get(hreplicate,'Value')
     1276    'TEST'
     1277else
     1278
    12741279%% store the result in the xml file used for calibration
    12751280errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file
     
    12841289uvmat('InputFileREFRESH_Callback',huvmat,[],hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
    12851290set(hObject,'BackgroundColor',[1 0 0]);% paint button back to red
     1291end
    12861292
    12871293delete(hset_slice)
     
    12911297function set_slice_REPLICATE_Callback(hObject,eventdata)
    12921298%------------------------------------------------------------------------
    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 
     1299if 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))
     1306else
     1307    hbrowse=findobj(allchild(0),'Tag','browse_data');
     1308    if ~isempty(hbrowse)
     1309        delete(hbrowse)
     1310    end
     1311end
     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%
    13521373
    13531374%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.