- Timestamp:
- Jun 13, 2015, 7:20:37 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r909 r910 1481 1481 errormsg='';%default error message 1482 1482 xmlfile=fullfile(path_series,'PARAM.xml'); 1483 test_batch=0;%default: ,no batch mode available1483 %test_batch=0;%default: ,no batch mode available 1484 1484 if ~exist(xmlfile,'file') 1485 1485 [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile); 1486 1486 end 1487 % RunTime='';1488 1487 if strcmp(ActionExt,'.sh') 1489 1488 if exist(xmlfile,'file') 1490 1489 s=xml2struct(xmlfile); 1491 1490 if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam') 1492 % if isfield(s.BatchParam,'RunTime')1493 % RunTime=s.BatchParam.RunTime;1494 % end1495 1491 if isfield(s.BatchParam,'NbCore') 1496 1492 NbCore=s.BatchParam.NbCore; 1497 1493 end 1498 1494 elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam') 1499 % if isfield(s.RunParam,'RunTime')1500 % RunTime=s.RunParam.RunTime;1501 % end1502 1495 if isfield(s.RunParam,'NbCore') 1503 1496 NbCore=s.RunParam.NbCore; … … 1505 1498 end 1506 1499 end 1507 % if isempty(RunTime) && strcmp(RunMode,'cluster_oar')1508 % errormsg='RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster';1509 % return1510 % end1511 1500 end 1512 1501 … … 1727 1716 end 1728 1717 nbfield_j=numel(ref_j); % number of j indices 1729 BlockLength=numel(ref_i);%default 1730 if isempty(Param.IndexRange.NbSlice) 1731 NbProcess=NbCore;% choose one process per core by default if NbSlice is not imposed 1732 switch RunMode 1733 case 'cluster_oar' 1734 BlockLength= ceil(20/(CPUTime*nbfield_j));% short iterations are grouped such that the minimum time of a process is 20 min. 1735 NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar 1736 end 1737 else 1738 NbProcess=Param.IndexRange.NbSlice;% the parameter NbSlice sets the nbre of run processes 1739 NbCore=min(NbCore,NbProcess);% reduces the number of cores if it exceeds the number of processes 1740 end 1741 1742 %BlockLength=ceil(numel(ref_i)/NbProcess);% nbre of input fields in each process 1743 %nbfield_j=numel(ref_j); % number of j indices 1718 BlockLength=numel(ref_i);% by default, job involves the full set of i field indices 1719 NbProcess=1; 1720 switch RunMode 1721 case {'cluster_oar','cluster_pbs'} 1722 if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined 1723 BlockLength= ceil(20/(CPUTime*nbfield_j));% short iterations are grouped such that the minimum time of a process is 20 min. 1724 BlockLength=max(BlockLength,ceil(numel(ref_i)/1000));% possibly increase the BlockLength to have less than 1000 jobs 1725 NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar 1726 else 1727 NbProcess=Param.IndexRange.NbSlice;% the parameter NbSlice sets the nbre of run processes 1728 NbCore=min(NbCore,NbProcess);% reduces the number of cores if it exceeds the number of processes 1729 end 1730 end 1744 1731 1745 1732 %% record nbre of output files and starting time for computation for status -
trunk/src/series/civ_input.m
r908 r910 130 130 return 131 131 end 132 if isfield(Data,'.Civ1_ImageA') 132 133 [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A 133 134 [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B 135 end 134 136 if isfield(Data,'Civ2_ImageA') 135 137 [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); … … 137 139 end 138 140 if size(Param.InputTable,1)==1 141 if isfield(Data,'.Civ1_ImageA') 139 142 series('display_file_name',hhseries,Data.Civ1_ImageA,'append');%append the image series to the input list 140 end 141 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA); 143 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA); 142 144 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB); 145 else 146 series('display_file_name',hhseries,Data.Civ2_ImageA,'append');%append the image series to the input list 147 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ2_ImageA); 148 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ2_ImageB); 149 end 150 end 151 143 152 iview_image=2;%line # for the input images 144 153 case 'civxdata'% case of civx data, -
trunk/src/series/civ_series.m
r908 r910 1024 1024 if sizemask > 1/2% eliminate point if more than half of the correlation box is masked 1025 1025 F(ivec)=3; % 1026 utable(ivec)=0; 1027 vtable(ivec)=0; 1026 1028 else 1027 1029 image1_crop=image1_crop.*~mask1_crop;% put to zero the masked pixels (mask1_crop='true'=1) … … 1042 1044 F(ivec)=3; 1043 1045 end 1044 if F(ivec)~=3 1046 if F(ivec)==3 1047 utable(ivec)=0; 1048 vtable(ivec)=0; 1049 else 1045 1050 %mask 1046 1051 if checkmask … … 1099 1104 catch ME 1100 1105 F(ivec)=3; 1106 disp(ME.message) 1101 1107 end 1102 1108 else … … 1127 1133 %http://urapiv.wordpress.com 1128 1134 peaky = y; 1129 if y <= npy-1 && y > =11135 if y <= npy-1 && y > 1 1130 1136 f0 = log(result_conv(y,x)); 1131 1137 f1 = log(result_conv(y-1,x)); … … 1136 1142 end 1137 1143 peakx=x; 1138 if x <= npx-1 && x > =11144 if x <= npx-1 && x > 1 1139 1145 f0 = log(result_conv(y,x)); 1140 1146 f1 = log(result_conv(y,x-1)); -
trunk/src/uvmat.m
r909 r910 1469 1469 flag=1; 1470 1470 if ~isfield(UvData.Field,'A') 1471 1472 return1471 msgbox_uvmat('ERROR','an image needs to be opened to set the mask size'); 1472 return 1473 1473 end 1474 1474 npx=size(UvData.Field.A,2); … … 1477 1477 yi=0.5:npy-0.5; 1478 1478 [Xi,Yi]=meshgrid(xi,yi); 1479 for iobj=1:length(UvData.ProjObject) 1480 ObjectData=UvData.ProjObject{iobj}; 1481 if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')); 1482 flagobj=1; 1483 testphys=0; %coordinates in pixels by default 1484 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 1485 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 1486 Calib=UvData.XmlData{1}.GeometryCalib; 1487 testphys=1; 1479 for iobj=1:length(UvData.ProjObject) 1480 ObjectData=UvData.ProjObject{iobj}; 1481 if isfield(ObjectData,'ProjMode') &&(isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')); 1482 flagobj=1; 1483 testphys=0; %coordinates in pixels by default 1484 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 1485 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib') 1486 Calib=UvData.XmlData{1}.GeometryCalib; 1487 testphys=1; 1488 end 1489 end 1490 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type') 1491 if isequal(ObjectData.Type,'polygon') 1492 X=ObjectData.Coord(:,1); 1493 Y=ObjectData.Coord(:,2); 1494 if testphys 1495 pos=[X Y zeros(size(X))]; 1496 if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3 1497 if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0]) 1498 om=norm(Calib.SliceAngle);%norm of rotation angle in radians 1499 OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis 1500 cos_om=cos(pi*om/180); 1501 sin_om=sin(pi*om/180); 1502 pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis; 1503 end 1504 pos(:,1)=pos(:,1)+Calib.SliceCoord(1); 1505 pos(:,2)=pos(:,2)+Calib.SliceCoord(2); 1506 pos(:,3)=pos(:,3)+Calib.SliceCoord(3); 1507 end 1508 [X,Y]=px_XYZ(Calib,pos(:,1),pos(:,2),pos(:,3)); 1488 1509 end 1510 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 1511 elseif isequal(ObjectData.Type,'ellipse') 1512 if testphys 1513 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1514 end 1515 RangeX=max(ObjectData.RangeX); 1516 RangeY=max(ObjectData.RangeY); 1517 X2Max=RangeX*RangeX; 1518 Y2Max=RangeY*RangeY; 1519 distX=(Xi-ObjectData.Coord(1,1)); 1520 distY=(Yi-ObjectData.Coord(1,2)); 1521 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1; 1522 elseif isequal(ObjectData.Type,'rectangle') 1523 if testphys 1524 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1525 end 1526 distX=abs(Xi-ObjectData.Coord(1,1)); 1527 distY=abs(Yi-ObjectData.Coord(1,2)); 1528 flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY); 1489 1529 end 1490 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type') 1491 if isequal(ObjectData.Type,'polygon') 1492 X=ObjectData.Coord(:,1); 1493 Y=ObjectData.Coord(:,2); 1494 if testphys 1495 pos=[X Y zeros(size(X))]; 1496 if isfield(Calib,'SliceCoord') && length(Calib.SliceCoord)>=3 1497 if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0]) 1498 om=norm(Calib.SliceAngle);%norm of rotation angle in radians 1499 OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis 1500 cos_om=cos(pi*om/180); 1501 sin_om=sin(pi*om/180); 1502 pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis; 1503 end 1504 pos(:,1)=pos(:,1)+Calib.SliceCoord(1); 1505 pos(:,2)=pos(:,2)+Calib.SliceCoord(2); 1506 pos(:,3)=pos(:,3)+Calib.SliceCoord(3); 1507 end 1508 [X,Y]=px_XYZ(Calib,pos(:,1),pos(:,2),pos(:,3)); 1509 end 1510 flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside 1511 elseif isequal(ObjectData.Type,'ellipse') 1512 if testphys 1513 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1514 end 1515 RangeX=max(ObjectData.RangeX); 1516 RangeY=max(ObjectData.RangeY); 1517 X2Max=RangeX*RangeX; 1518 Y2Max=RangeY*RangeY; 1519 distX=(Xi-ObjectData.Coord(1,1)); 1520 distY=(Yi-ObjectData.Coord(1,2)); 1521 flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1; 1522 elseif isequal(ObjectData.Type,'rectangle') 1523 if testphys 1524 %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys 1525 end 1526 distX=abs(Xi-ObjectData.Coord(1,1)); 1527 distY=abs(Yi-ObjectData.Coord(1,2)); 1528 flagobj=distX>max(ObjectData.RangeX) | distY>max(ObjectData.RangeY); 1529 end 1530 if isequal(ObjectData.ProjMode,'mask_outside') 1531 flagobj=~flagobj; 1532 end 1533 flag=flag & flagobj; 1530 if isequal(ObjectData.ProjMode,'mask_outside') 1531 flagobj=~flagobj; 1534 1532 end 1535 end 1536 end 1533 flag=flag & flagobj; 1534 end 1535 end 1536 end 1537 1537 %mask name 1538 1538 RootPath=get(handles.RootPath,'String'); … … 1548 1548 imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200) 1549 1549 imflag=flipdim(imflag,1); 1550 1550 1551 1551 %display the mask 1552 1552 hfigmask=figure; … … 1570 1570 end 1571 1571 end 1572 imwrite(imflag,answer,'BitDepth',8); 1572 try 1573 imwrite(imflag,answer,'BitDepth',8); 1574 catch ME 1575 msgbox_uvmat('ERROR',ME.message) 1576 end 1573 1577 end 1574 1578 set(handles.ListObject,'Value',1)
Note: See TracChangeset
for help on using the changeset viewer.