Changeset 174 for trunk/src/civ.m


Ignore:
Timestamp:
Jan 5, 2011, 9:43:28 AM (14 years ago)
Author:
sommeria
Message:

civ.m : clarification of .cmx : creation of .civ1.cmx and .civ2.cmx
uvmat: reading and projecting volume images (not yet successfull)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r173 r174  
    267267    oldfile=filebase;
    268268end
    269 testall=get(handles.ImaDoc,'UserData');
     269% testall=get(handles.ImaDoc,'UserData');
    270270ind_opening=1;%default
    271271browse.incr_pair=[0 0]; %default
    272 if testall
    273     menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
    274         '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'};
    275 else % menu selecting only .civ or .avi files
    276     menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
    277         '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';...
    278         '*.*', 'All Files (*.*)'};
    279 end
     272% if testall
     273%     menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
     274%         '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'};
     275% else % menu selecting only .civ or .avi files
     276 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
     277       '*.xml',  '.xml files '; ...
     278        '*.civ',  '.civ files '; ...
     279        '*.png','.png image files'; ...
     280        '*.jpg',' jpeg image files'; ...
     281        '*.tif','.tif image files'; ...
     282        '*.avi;*.AVI','.avi movie files'; ...
     283        '*.nc','.netcdf files'; ...
     284        '*.*',  'All Files (*.*)'};
     285   % menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
     286     %   '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';...
     287    %    '*.*', 'All Files (*.*)'};
     288% end
    280289[FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
    281290fileinput=[PathName FileName];%complete file name
     
    431440end
    432441set(handles.browse_root,'UserData',browse);% store information from browser
    433 testall=isequal(menu(filtindex,1),{'*.*'});
    434 set(handles.ImaDoc,'UserData',testall);
     442% testall=isequal(menu(filtindex,1),{'*.*'});
     443% set(handles.ImaDoc,'UserData',testall);
    435444
    436445RootName_Callback(hObject, eventdata, handles);
     
    18681877            civAllxml=set(civAllxml,1,'name','CivDoc');
    18691878        end
    1870         filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file
    1871         filename_cmx(end-1:end+1)='cmx';%name of cmx file
     1879        %filename_cur=filecell.nc.civ1{ifile,j};%output netcdf file
     1880        [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention)
     1881        %filename_cmx(end-1:end+6)='civ1.cmx';%name of cmx file
    18721882        if batch
    1873             [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
    1874             filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
     1883%             [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
     1884            filename_bat=fullfile(Rootbat,['job_' Filebat]);
    18751885         else
    1876             filename_bat=filename_cmx;
    1877         end
    1878         filename_bat(end-2:end)='bat';
     1886            filename_bat=fullfile(Rootbat,Filebat);
     1887        end
     1888        filename_bat=[filename_bat '.bat'];
    18791889       
    18801890        %CIV1
     
    18821892            par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    18831893            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
    1884             namelog=[filename_cmx([1:end-3]) 'log'];
     1894            namelog=[fullfile(Rootbat,Filebat) '.civ1.log'];
    18851895            par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
    18861896            par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2);
     
    19351945            i_cmd=i_cmd+1;
    19361946            if isequal(civAll,0)
    1937                 cmd=[cmd CIV1_CMD(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n'];
     1947                cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n'];
    19381948            else
    19391949                civAllCmd=[civAllCmd ' civ1 '];
    1940                 str=CIV1_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ1);
     1950                str=CIV1_CMD_Unified(fullfile(Rootbat,Filebat),'',par_civ1);
    19411951                fieldnames=fields(str);
    19421952                [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1');
     
    20542064            par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};
    20552065            %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension
    2056             namelog=[filename_cmx([1:end-3]) 'log'];
     2066            [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention)
     2067            namelog=[fullfile(Rootbat,Filebat) '.civ2.log'];
    20572068            par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j)));
    20582069            par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2);
     
    21082119            %endTESTgrid
    21092120            i_cmd=i_cmd+1;
    2110             cmd_CIV2=CIV2_CMD(filename_cmx(1:end-4),namelog,par_civ2,sparam);
     2121            cmd_CIV2=CIV2_CMD(fullfile(Rootbat,Filebat),[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx]
    21112122            if isequal(civAll,0)
     2123                flname=fullfile(Rootbat,Filebat);
    21122124                if(isunix)
    2113                     cmd=[cmd 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n'];
     2125                     cmd=[cmd 'cp -f ' flname '.civ2.cmx ' flname '.cmx\n' cmd_CIV2 '\n'];
    21142126                else
    2115                     filename_cmx=regexprep(filename_cmx,'\\','\\\\');
    2116                     cmd=[cmd 'copy /Y "' filename_cmx '2" "' filename_cmx '"\n' cmd_CIV2 '\n'];
     2127                    flname=regexprep(flname,'\\','\\\\');
     2128                    cmd=[cmd 'copy /Y "' flname '.civ2.cmx" "' flname '.cmx"\n' cmd_CIV2 '\n'];
    21172129                end
    21182130            else
     
    22532265            end
    22542266            super_cmd=[super_cmd cmd_str '\n'];         
    2255             %             eval(cmd_str);
    22562267            disp(cmd_str);
    22572268        end
     
    24782489subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data
    24792490subdir_civ2=get(handles.subdir_civ2,'String');
    2480 if isequal(subdir_civ1,''),subdir_civ1='A'; end% put default subdir
     2491if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir
    24812492if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir
    24822493currentdir=pwd;%store the current working directory
     
    27082719        %create the new subdir_civ2_new
    27092720        if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir')
    2710             [xx,m2]=mkdir(subdir_civ2_new);
     2721            [xx,m2]=mkdir(fullfile(Path_ima,subdir_civ2_new));
    27112722            [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g)
    27122723            if ~isequal(m2,'')
     
    40434054
    40444055%changes : filename_cmx -> filename ( no extension )
    4045 
     4056% input namelog not used
    40464057if isequal(par.Dt,'0')
    40474058    par.Dt='1' ;%case of 'displacement' mode
     
    40864097% namelog=regexprep(namelog,'\\','\\\\');
    40874098if(isunix)
    4088     [Rootbat,Filebat,extbat]=fileparts(namelog);
    4089     ncName=fullfile(Rootbat,[ Filebat '.nc']);
    4090     cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
    4091     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName];
     4099%     filename
     4100%     namelog
     4101%     
     4102%     [Rootbat,Filebat,extbat]=fileparts(namelog);
     4103%     ncName=fullfile(Rootbat,[ Filebat '.nc']);
     4104    cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
     4105    cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting
     4106    cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx
    40924107else %Windows system
     4108    filename=regexprep(filename,'\\','\\\\');
    40934109    cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    40944110    cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
    40954111    namelog=regexprep(namelog,'\\','\\\\');
    4096     cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ1.log"'];
     4112    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"'];
     4113    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"'];
    40974114end
    40984115
     
    41974214    par.Dt='1' ;%case of 'displacement' mode
    41984215end
    4199 
    42004216par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
    42014217par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ?
    4202 fid=fopen([filename '.cmx2'],'w');
     4218[fid,errormsg]=fopen([filename '.civ2.cmx'],'w');
     4219if isequal(fid,-1)
     4220    msgbox_uvmat('ERROR',errormsg)
     4221    cmd_CIV2='';
     4222    return
     4223end
    42034224fprintf(fid,['##############   CMX file' '\n' ]);
    42044225fprintf(fid,   ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     
    42344255
    42354256if(isunix)
    4236     cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
    4237     [Rootbat,Filebat,extbat]=fileparts(namelog);
    4238     ncName=fullfile(Rootbat,[ Filebat '.nc']);
    4239     cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName];
     4257%         cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
     4258%     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];
     4259%     cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx, the result file is named [filename '.nc'] by CIVx
     4260   
     4261    cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
     4262    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];
     4263    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.civ2.cmx' '\n'];%rename .cmx as .civ2.cmx, the result file is named [filename '.nc'] by CIVx
     4264%     [Rootbat,Filebat,extbat]=fileparts(namelog);
     4265%     ncName=fullfile(Rootbat,[ Filebat '.nc']);
     4266%    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName];
    42404267else
     4268    filename=regexprep(filename,'\\','\\\\');
    42414269    cmd_CIV2=['"' sparam.Civ2Bin '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    42424270    cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
    4243     namelog=regexprep(namelog,'\\','\\\\');
    4244     cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ2.log"'];
     4271    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"'];
     4272     cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"'];
    42454273end
    42464274
Note: See TracChangeset for help on using the changeset viewer.