Changeset 435 for trunk/src/uvmat.m
Legend:
 Unmodified
 Added
 Removed

trunk/src
 Property svn:ignore

old new 4 4 XML_SCHEMAS 5 5 bin 6 check_files.m 6 7 toolbox_calib 7 8 uvmat_doc

 Property svn:ignore

trunk/src/uvmat.m
r434 r435 1528 1528 UvData=get(handles.uvmat,'UserData'); 1529 1529 1530 while get(handles. speed,'Value')~=0 && isequal(get(handles.Movie,'BusyAction'),'queue') % enable STOP command1530 while get(handles.Movie,'Value')==1 && get(handles.speed,'Value')~=0 && isequal(get(handles.Movie,'BusyAction'),'queue') % enable STOP command 1531 1531 errormsg=runpm(hObject,eventdata,handles,increment); 1532 1532 if ~isempty(errormsg) … … 1555 1555 UvData=get(handles.uvmat,'UserData'); 1556 1556 1557 while get(handles. speed,'Value')~=0 && isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command1557 while get(handles.MovieBackward,'Value')==1 && get(handles.speed,'Value')~=0 && isequal(get(handles.MovieBackward,'BusyAction'),'queue') % enable STOP command 1558 1558 errormsg=runpm(hObject,eventdata,handles,increment); 1559 1559 if ~isempty(errormsg) … … 2034 2034 end 2035 2035 end 2036 case 'video'2036 case {'video','mmreader'} 2037 2037 ObjectName=UvData.MovieObject{1}; 2038 2038 case 'vol' %TODO: update … … 2094 2094 end 2095 2095 end 2096 case 'video'2096 case {'video','mmreader'} 2097 2097 Name=UvData.MovieObject{2}; 2098 2098 case 'vol' %TODO: update … … 2406 2406 2407 2407 %% get bounds and mesh (needed for mouse action and to open set_object) 2408 XName=''; %default 2409 YName=''; 2410 if ~isempty(VarType{imax}.coord_x) 2411 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2412 DimIndex=VarDimIndex{CellVarIndex{imax}(1)}; %list of dim indices for the variable 2413 nbpoints_x=DimValue(DimIndex(NbDim)); 2414 %unstructured coordinates 2415 if ~isempty(VarType{imax}.coord_y) 2408 if NbDim>1 2409 XName=''; %default 2410 YName=''; 2411 %unstructured coordinates 2412 if ~isempty(VarType{imax}.coord_x)&&~isempty(VarType{imax}.coord_y) 2413 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2416 2414 YName=UvData.Field.ListVarName{VarType{imax}.coord_y}; 2417 2415 %nbvec=length(UvData.Field.(XName));%nbre of measurement points (e.g. vectors) … … 2422 2420 NbDim=2; 2423 2421 end 2424 end 2425 %structured coordinate 2426 elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 2427 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2428 if NbDim> 1 && VarType{imax}.coord(NbDim1)>0 2429 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim1)}; %structured coordinates 2430 end 2431 % VarIndex=CellVarIndex{imax}; % list of variable indices 2432 DimIndex=VarDimIndex{CellVarIndex{imax}(1)}; %list of dim indices for the variable 2433 nbpoints_x=DimValue(DimIndex(NbDim)); 2434 XMax=nbpoints_x;%default 2435 XMin=1;%default 2436 end 2437 2438 if NbDim==3 2439 if ~test_x 2440 ZName=UvData.Field.ListVarName{VarType{imax}.coord(1)};%structured coordinates in 3D 2441 end 2442 ZMax=max(UvData.Field.(ZName)); 2443 ZMin=min(UvData.Field.(ZName)); 2444 UvData.Field.ZMax=ZMax; 2445 UvData.Field.ZMin=ZMin; 2446 test_z=1; 2447 if isequal(ZMin,ZMax)%no z dependency 2448 NbDim=2; 2449 test_z=0; 2450 end 2451 end 2452 if ~isempty (XName) 2453 XMax=max(max(UvData.Field.(XName))); 2454 XMin=min(min(UvData.Field.(XName))); 2455 UvData.Field.NbDim=NbDim; 2456 UvData.Field.XMax=XMax; 2457 UvData.Field.XMin=XMin; 2458 if NbDim >1&& ~isempty(YName) 2459 YMax=max(max(UvData.Field.(YName))); 2460 YMin=min(min(UvData.Field.(YName))); 2461 UvData.Field.YMax=YMax; 2462 UvData.Field.YMin=YMin; 2463 end 2464 nbvec=length(UvData.Field.(XName)); 2465 if test_x %unstructured coordinates 2466 if test_z 2467 UvData.Field.Mesh=((XMaxXMin)*(YMaxYMin)*(ZMaxZMin))/nbvec;% volume per vector 2468 UvData.Field.Mesh=(UvData.Field.Mesh)^(1/3); 2469 else 2470 UvData.Field.Mesh=sqrt((XMaxXMin)*(YMaxYMin)/nbvec);%2D 2471 end 2472 end 2473 end 2474 % case of structured coordinates 2475 if ~test_x 2476 DX=(XMaxXMin)/(nbpoints_x1); 2477 if NbDim >1 2478 nbpoints_y=DimValue(DimIndex(NbDim1)); 2479 if isempty(YName)% if the y coordinate is not expressed, it is taken as the matrix index 2480 DY=1; 2481 UvData.Field.YMax=nbpoints_y; 2482 UvData.Field.YMin=1; 2483 else 2484 DY=(YMaxYMin)/(nbpoints_y1); 2485 end 2486 end 2422 %structured coordinate 2423 elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 2424 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2425 if NbDim> 1 && VarType{imax}.coord(NbDim1)>0 2426 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim1)}; %structured coordinates 2427 end 2428 % VarIndex=CellVarIndex{imax}; % list of variable indices 2429 DimIndex=VarDimIndex{CellVarIndex{imax}(1)}; %list of dim indices for the variable 2430 nbpoints_x=DimValue(DimIndex(NbDim)); 2431 XMax=nbpoints_x;%default 2432 XMin=1;%default 2433 end 2434 2487 2435 if NbDim==3 2488 nbpoints_z=DimValue(DimIndex(1)); 2489 DZ=(ZMaxZMin)/(nbpoints_z1); 2490 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2436 if ~test_x 2437 ZName=UvData.Field.ListVarName{VarType{imax}.coord(1)};%structured coordinates in 3D 2438 end 2439 ZMax=max(UvData.Field.(ZName)); 2440 ZMin=min(UvData.Field.(ZName)); 2491 2441 UvData.Field.ZMax=ZMax; 2492 2442 UvData.Field.ZMin=ZMin; 2443 test_z=1; 2444 if isequal(ZMin,ZMax)%no z dependency 2445 NbDim=2; 2446 test_z=0; 2447 end 2448 end 2449 if ~isempty (XName) 2450 XMax=max(max(UvData.Field.(XName))); 2451 XMin=min(min(UvData.Field.(XName))); 2452 UvData.Field.NbDim=NbDim; 2453 UvData.Field.XMax=XMax; 2454 UvData.Field.XMin=XMin; 2455 if NbDim >1&& ~isempty(YName) 2456 YMax=max(max(UvData.Field.(YName))); 2457 YMin=min(min(UvData.Field.(YName))); 2458 UvData.Field.YMax=YMax; 2459 UvData.Field.YMin=YMin; 2460 end 2461 nbvec=length(UvData.Field.(XName)); 2462 if test_x %unstructured coordinates 2463 if test_z 2464 UvData.Field.Mesh=((XMaxXMin)*(YMaxYMin)*(ZMaxZMin))/nbvec;% volume per vector 2465 UvData.Field.Mesh=(UvData.Field.Mesh)^(1/3); 2466 else 2467 UvData.Field.Mesh=sqrt((XMaxXMin)*(YMaxYMin)/nbvec);%2D 2468 end 2469 end 2470 end 2471 % case of structured coordinates 2472 if ~test_x 2473 DX=(XMaxXMin)/(nbpoints_x1); 2474 if NbDim >1 2475 nbpoints_y=DimValue(DimIndex(NbDim1)); 2476 if isempty(YName)% if the y coordinate is not expressed, it is taken as the matrix index 2477 DY=1; 2478 UvData.Field.YMax=nbpoints_y; 2479 UvData.Field.YMin=1; 2480 else 2481 DY=(YMaxYMin)/(nbpoints_y1); 2482 end 2483 end 2484 if NbDim==3 2485 nbpoints_z=DimValue(DimIndex(1)); 2486 DZ=(ZMaxZMin)/(nbpoints_z1); 2487 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2488 UvData.Field.ZMax=ZMax; 2489 UvData.Field.ZMin=ZMin; 2490 else 2491 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2492 end 2493 end 2494 % adjust the mesh to a value 1, 2 , 5 *10^n 2495 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2496 if UvData.Field.Mesh/ord>=5 2497 UvData.Field.Mesh=5*ord; 2498 elseif UvData.Field.Mesh/ord>=2 2499 UvData.Field.Mesh=2*ord; 2493 2500 else 2494 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2495 end 2496 end 2497 % adjust the mesh to a value 1, 2 , 5 *10^n 2498 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2499 if UvData.Field.Mesh/ord>=5 2500 UvData.Field.Mesh=5*ord; 2501 elseif UvData.Field.Mesh/ord>=2 2502 UvData.Field.Mesh=2*ord; 2503 else 2504 UvData.Field.Mesh=ord; 2505 end 2506 UvData.Object{1}.Type='plane';%main plotting plane 2507 UvData.Object{1}.ProjMode='projection';%main plotting plane 2508 UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat 2509 UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat 2510 2511 %% 3D case (menuvolume) 2512 if NbDim==3% && UvData.NewSeries 2513 test_set_object=1; 2514 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 2515 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 2516 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 2517 if ~isempty(hset_object) %if set_object is detected 2518 delete(hset_object);% delete the GUI set_object if it does not fit 2519 end 2520 if test_set_object% reinitiate the GUI set_object 2521 delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2 2522 UvData.Object{1}.NbDim=NbDim;%test for 3D objects 2523 UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane 2524 UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen 2525 UvData.Object{1}.Angle=[0 0 0]; 2526 UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR 2527 UvData.Object{1}.Name='1PLANE'; 2528 UvData.Object{1}.enable_plot=1; 2529 set_object(UvData.Object{1},handles,ZBounds); 2530 set(handles.ListObject,'Value',1); 2531 set(handles.ListObject,'String',{'1PLANE'}); 2532 set(handles.edit_object,'Value',1)% put the plane in edit mode to enable the z cursor 2533 edit_object_Callback([],[], handles) 2534 end 2535 %multilevel case (single menuplane in a 3D space) 2536 elseif isfield(UvData,'Z') 2537 if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData') 2538 XmlData=UvData.XmlData{1}; 2539 if isfield(XmlData,'PlanePos') 2540 UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:); 2541 end 2542 if isfield(XmlData,'PlaneAngle') 2543 siz=size(XmlData.PlaneAngle); 2544 indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning) 2545 UvData.Object{1}.PlaneAngle=XmlData.PlaneAngle(indangle,:); 2546 end 2547 elseif isfield(UvData,'ZIndex') 2548 UvData.Object{1}.ZObject=UvData.ZIndex; 2549 end 2550 end 2501 UvData.Field.Mesh=ord; 2502 end 2503 UvData.Object{1}.Type='plane';%main plotting plane 2504 UvData.Object{1}.ProjMode='projection';%main plotting plane 2505 UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat 2506 UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat 2507 2508 %% 3D case (menuvolume) 2509 if NbDim==3% && UvData.NewSeries 2510 test_set_object=1; 2511 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 2512 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 2513 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 2514 if ~isempty(hset_object) %if set_object is detected 2515 delete(hset_object);% delete the GUI set_object if it does not fit 2516 end 2517 if test_set_object% reinitiate the GUI set_object 2518 delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2 2519 UvData.Object{1}.NbDim=NbDim;%test for 3D objects 2520 UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane 2521 UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen 2522 UvData.Object{1}.Angle=[0 0 0]; 2523 UvData.Object{1}.HandlesDisplay=plot(0,0,'Tag','proj_object');% A REVOIR 2524 UvData.Object{1}.Name='1PLANE'; 2525 UvData.Object{1}.enable_plot=1; 2526 set_object(UvData.Object{1},handles,ZBounds); 2527 set(handles.ListObject,'Value',1); 2528 set(handles.ListObject,'String',{'1PLANE'}); 2529 set(handles.edit_object,'Value',1)% put the plane in edit mode to enable the z cursor 2530 edit_object_Callback([],[], handles) 2531 end 2532 %multilevel case (single menuplane in a 3D space) 2533 elseif isfield(UvData,'Z') 2534 if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData') 2535 XmlData=UvData.XmlData{1}; 2536 if isfield(XmlData,'PlanePos') 2537 UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:); 2538 end 2539 if isfield(XmlData,'PlaneAngle') 2540 siz=size(XmlData.PlaneAngle); 2541 indangle=min(siz(1),UvData.ZIndex);%take first angle if a single angle is defined (translating scanning) 2542 UvData.Object{1}.PlaneAngle=XmlData.PlaneAngle(indangle,:); 2543 end 2544 elseif isfield(UvData,'ZIndex') 2545 UvData.Object{1}.ZObject=UvData.ZIndex; 2546 end 2547 end 2548 end 2549 2551 2550 testnewseries=UvData.NewSeries; 2552 2551 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback)
Note: See TracChangeset
for help on using the changeset viewer.