Changeset 450 for trunk/src/read_field.m
- Timestamp:
- Jun 12, 2012, 12:27:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_field.m
r445 r450 2 2 %'read_field': read input fields in different formats 3 3 %-------------------------------------------------------------------------- 4 % function [Field,ParamOut,errormsg] = read_field( ObjectName,FileType,ParamIn)4 % function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num) 5 5 % 6 6 % OUTPUT: … … 23 23 % = video: movie read with VideoReader (recent versions of Matlab) 24 24 % = vol: images representing scanned volume (images concatened in the y direction) 25 % ParamIn: Matlab structure of input parameters25 % ParamIn: movie object or Matlab structure of input parameters 26 26 % .FieldName: name (char string) of the input field (for Civx data) 27 27 % .VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...) 28 28 % .ColorVar: variable used for vector color 29 29 % .Npx, .Npy: nbre of pixels along x and y (used for .vol input files) 30 function [Field,ParamOut,errormsg] = read_field( ObjectName,FileType,ParamIn,num)30 function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num) 31 31 Field=[]; 32 32 if ~exist('num','var') … … 57 57 field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 58 58 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 59 Data=nc2struct( ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');59 Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 60 60 % case of new civdata conventions 61 61 if isequal(Data.Conventions,'uvmat/civdata') … … 63 63 ParamOut.ColorVar='ima_cor'; 64 64 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 65 [Field,ParamOut.VelType,errormsg]=read_civdata( ObjectName,InputField,ParamIn.VelType,Data.CivStage);65 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,Data.CivStage); 66 66 CivStage=Field.CivStage; 67 67 ParamOut.CivStage=Field.CivStage; … … 71 71 ParamOut.ColorVar='ima_cor'; 72 72 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 73 [Field,ParamOut.VelType]=read_civxdata( ObjectName,InputField,ParamIn.VelType);73 [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 74 74 CivStage=Field.CivStage; 75 75 ParamOut.CivStage=Field.CivStage; … … 88 88 InputField=[InputField {ParamOut.ColorVar}]; 89 89 end 90 [Field,ParamOut.VelType,errormsg]=read_civxdata( ObjectName,InputField,ParamIn.VelType);90 [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 91 91 if ~isempty(errormsg) 92 92 return … … 100 100 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 101 101 if isempty(hget_field)% open the GUI get_field if it is not found 102 hget_field= get_field( ObjectName);%open the get_field GUI102 hget_field= get_field(FileName);%open the get_field GUI 103 103 set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1) 104 104 end 105 105 hhget_field=guidata(hget_field); 106 106 %% update the get_field GUI 107 set(hhget_field.inputfile,'String', ObjectName)107 set(hhget_field.inputfile,'String',FileName) 108 108 set(hhget_field.list_fig,'Value',1) 109 109 if exist('num','var')&&~isnan(num) … … 116 116 Tabchar={''};%default 117 117 Tabcell=[]; 118 set(hhget_field.inputfile,'String', ObjectName)118 set(hhget_field.inputfile,'String',FileName) 119 119 if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute) 120 120 for iline=1:length(Field.ListGlobalAttribute) … … 145 145 end 146 146 case {'video','mmreader'} 147 A=read( ObjectName,num);147 A=read(ParamIn,num); 148 148 case 'vol' 149 A=imread( ObjectName);149 A=imread(FileName); 150 150 Npz=size(A,1)/ParamIn.Npy; 151 151 A=reshape(A',ParamIn.Npx,ParamIn.Npy,Npz); … … 153 153 case 'multimage' 154 154 warning 'off' 155 A=imread( ObjectName,num);155 A=imread(FileName,num); 156 156 case 'image' 157 A=imread( ObjectName);157 A=imread(FileName); 158 158 end 159 159 catch ME
Note: See TracChangeset
for help on using the changeset viewer.