0001 function I = MapTrimmer(I,ArrowX,ArrowY,Cntrs,Allx4Arrow,Ally4Arrow,LineStrength,ColSpec)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 for i1 = 1:numel(ArrowX)
0021 if isempty(ArrowX{i1})
0022 continue
0023 end
0024 Xin = ArrowX{i1}; Yin = ArrowY{i1}; Cents = Cntrs{i1};
0025 pixx = Allx4Arrow{i1};
0026 pixy = Ally4Arrow{i1};
0027 if ~std(pixx)
0028 pixx1 = pixx + LineStrength/2;
0029 pixx = pixx - LineStrength/2;
0030 pixy1 = pixy;
0031 elseif ~std(pixy)
0032 pixy1 = pixy + LineStrength/2;
0033 pixy = pixy - LineStrength/2;
0034 pixx1 = pixx;
0035 else
0036 pixx1 = pixx + LineStrength/2;
0037 pixx = pixx - LineStrength/2;
0038 pixy1 = pixy + LineStrength/2;
0039 pixy = pixy - LineStrength/2;
0040 end
0041
0042 for cnt = 1:size(Xin,1)
0043 X = Xin(cnt,:); Y = Yin(cnt,:); Cent = Cents(cnt,:);
0044 DistToCpd = hypot( Allx4Arrow{i1} - Cent(1), Ally4Arrow{i1} - Cent(2));
0045 CpdDistToPoint1 = hypot( X(1) - Cent(1), Y(1) - Cent(2));
0046
0047 Ind = find(DistToCpd < 0.8*CpdDistToPoint1);
0048 pixx1T = pixx1(Ind); pixxT = pixx(Ind);
0049 pixy1T = pixy1(Ind); pixyT = pixy(Ind);
0050 pixx1T = round(pixx1T); pixxT = round(pixxT);
0051 pixy1T = round(pixy1T); pixyT = round(pixyT);
0052 for i5 = 1:numel(pixxT)
0053 I(pixyT(i5):pixy1T(i5),pixxT(i5),1) = ColSpec(1);
0054 I(pixyT(i5),pixxT(i5):pixx1T(i5),1) = ColSpec(1);
0055 I(pixyT(i5):pixy1T(i5),pixxT(i5),2) = ColSpec(2);
0056 I(pixyT(i5),pixxT(i5):pixx1T(i5),2) = ColSpec(2);
0057 I(pixyT(i5):pixy1T(i5),pixxT(i5),3) = ColSpec(3);
0058 I(pixyT(i5),pixxT(i5):pixx1T(i5),3) = ColSpec(3);
0059 end
0060 end
0061 end