0001 function [I,ArX,ArY,ArrowChek,DoubleData] = OverlapChecker(I,ArX,ArY,OverlapData,...
0002 flx,McmCollect,field_intsect_overlay,LineStrength)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 [~,Idx1,~] = unique(OverlapData);
0027 Chck1 = setdiff(1:size(OverlapData,1),Idx1);
0028 ArrowChek = []; ct = 1; RxnId = ({}); RxnX = ({}); RxnY = ({});
0029 RxnX1 = RxnX; RxnY1 = RxnY;
0030 for m1 = 1:numel(Chck1)
0031 WhrC = find(ismember(OverlapData,OverlapData{Chck1(m1)}));
0032 if std(flx(WhrC))<1e-4
0033 continue
0034 end
0035 pixx = ArX{WhrC(1)}; pixy = ArY{WhrC(1)};
0036 ColSpec = McmCollect(WhrC,:);
0037
0038 if ~std(pixx)
0039 pixx = pixx - LineStrength*numel(WhrC)/2;
0040 elseif ~std(pixy)
0041 pixy = pixy - LineStrength*numel(WhrC)/2;
0042 else
0043 pixx = pixx - LineStrength*numel(WhrC)/2;
0044 pixy = pixy - LineStrength*numel(WhrC)/2;
0045 end
0046
0047
0048 LineSegments = [];
0049 LineSegments(1) = 0; LineSegments(2) = LineStrength;
0050 for i1 = 3:numel(WhrC)*2
0051 if mod(i1,2)
0052 LineSegments(i1) = LineSegments(i1-1) + 1;
0053 else
0054 LineSegments(i1) = LineSegments(i1-1) + LineStrength;
0055 end
0056 end
0057
0058 for m2 = 1:numel(WhrC)
0059 if ~std(pixx)
0060 pixx1 = pixx + LineSegments(2*m2-1);
0061 pixx1A = pixx1 + LineStrength/2;
0062 pixx2 = pixx + LineSegments(2*m2);
0063 pixy1 = pixy;
0064 pixy1A = pixy;
0065 pixy2 = pixy;
0066 elseif ~std(pixy)
0067 pixy1 = pixy + LineSegments(2*m2-1);
0068 pixy1A = pixy1 + LineStrength/2;
0069 pixy2 = pixy + LineSegments(2*m2);
0070 pixx1 = pixx;
0071 pixx1A = pixx;
0072 pixx2 = pixx;
0073 else
0074 pixx1 = pixx + LineSegments(2*m2-1);
0075 pixx1A = pixx1 + LineStrength/2;
0076 pixx2 = pixx + LineSegments(2*m2);
0077 pixy1 = pixy + LineSegments(2*m2-1);
0078 pixy1A = pixy1 + LineStrength/2;
0079 pixy2 = pixy + LineSegments(2*m2);
0080 end
0081 pixx1 = round(pixx1); pixx2 = round(pixx2);
0082 pixy1 = round(pixy1); pixy2 = round(pixy2);
0083 ArX{WhrC(m2)} = []; ArX{WhrC(m2)} = pixx1A; RxnId{ct} = field_intsect_overlay{WhrC(m2)};
0084 ArY{WhrC(m2)} = []; ArY{WhrC(m2)} = pixy1A;
0085 RxnX{ct} = pixx1; RxnY{ct} = pixy1; RxnX1{ct} = pixx2;RxnY1{ct} = pixy2;
0086 ArrowChek(ct,1) = WhrC(m2); ArrowChek(ct,2) = numel(WhrC);
0087 ct = ct + 1;
0088 for i5 = 1:numel(pixx)
0089 I(pixy1(i5):pixy2(i5),pixx1(i5),1) = ColSpec(m2,1);
0090 I(pixy1(i5),pixx1(i5):pixx2(i5),1) = ColSpec(m2,1);
0091 I(pixy1(i5):pixy2(i5),pixx1(i5),2) = ColSpec(m2,2);
0092 I(pixy1(i5),pixx1(i5):pixx2(i5),2) = ColSpec(m2,2);
0093 I(pixy1(i5):pixy2(i5),pixx1(i5),3) = ColSpec(m2,3);
0094 I(pixy1(i5),pixx1(i5):pixx2(i5),3) = ColSpec(m2,3);
0095 end
0096 end
0097 end
0098 DoubleData.X = RxnX; DoubleData.Y = RxnY; DoubleData.Id = RxnId;
0099 DoubleData.X1 = RxnX1; DoubleData.Y1 = RxnY1;