Changeset 1122 for trunk/src/transform_field
- Timestamp:
- Apr 21, 2023, 11:01:06 AM (22 months ago)
- Location:
- trunk/src/transform_field
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/transform_field/ima_filter.m
r1119 r1122 1 % 'ima_filter': example of image transform with input parameters: low-pass filter of an image 1 % 'ima_filter': low-pass filter of an image or other 2D fields defined on a regular grid 2 % the size of the filtering window in x and y is interactivement defined 2 3 3 4 %------------------------------------------------------------------------ 4 5 %%%% Use the general syntax for transform fields with a single input and parameters %%%% 5 % OUTPUT: 6 % DataOut: output field structure 6 % OUTPUT: 7 % DataOut: output field structure 7 8 % 8 9 %INPUT: 9 10 % DataIn: input field structure 11 % 10 12 % Param: matlab structure whose field Param.TransformInput contains the filter parameters 13 % DataIn_1: variables possibly introduced as a second input field 11 14 %----------------------------------- 12 15 … … 78 81 if exist('DataIn_1','var') 79 82 [CellInfo,NbDim,errormsg]=find_field_cells(DataIn_1); 80 for icell=1:numel(CellInfo) 81 if isfield(CellInfo{icell},'CoordType')&& strcmp(CellInfo{icell}.CoordType,'grid') 82 for ivar=1:numel(CellInfo{icell}.VarIndex) 83 VarName=DataIn_1.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 84 Atype=class(DataIn_1.(VarName));% detect integer 8 or 16 bits 85 if numel(size(DataIn_1.(VarName)))==3 86 DataOut.(VarName)=filter2(Mfiltre,sum(DataIn_1.(VarName),3));%filter the input image, after summation on the color component (for color images) 87 DataOut.(VarName)=uint16(DataOut.(VarName)); %transform to 16 bit images 88 else 89 DataOut.(VarName)=filter2(Mfiltre,DataIn_1.(VarName)); 90 DataOut.(VarName)=feval(Atype,DataOut.(VarName));%transform to the initial image format 83 for icell=1:numel(CellInfo) 84 if isfield(CellInfo{icell},'CoordType')&& strcmp(CellInfo{icell}.CoordType,'grid') 85 for ivar=1:numel(CellInfo{icell}.VarIndex) 86 VarName=DataIn_1.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 87 Atype=class(DataIn_1.(VarName));% detect integer 8 or 16 bits 88 if numel(size(DataIn_1.(VarName)))==3 89 DataOut.(VarName)=filter2(Mfiltre,sum(DataIn_1.(VarName),3));%filter the input image, after summation on the color component (for color images) 90 DataOut.(VarName)=uint16(DataOut.(VarName)); %transform to 16 bit images 91 else 92 DataOut.(VarName)=filter2(Mfiltre,DataIn_1.(VarName)); 93 DataOut.(VarName)=feval(Atype,DataOut.(VarName));%transform to the initial image format 94 end 91 95 end 92 96 end 93 97 end 94 98 end 95 end96 99 97 100
Note: See TracChangeset
for help on using the changeset viewer.