Description of MapTrimmerF

Home > BiKEGG > MapTrimmerF.m

# MapTrimmerF

## PURPOSE

MapTrimmerF

## SYNOPSIS

function I = MapTrimmerF(I,ArrowX,ArrowY,Cntrs,Allx4Arrow,Ally4Arrow,DoubleIds,Idx,LineStrength,ColSpec)

## DESCRIPTION

     MapTrimmerF
     is a subfunction of NetDraw with a similar structure to
     MapTrimmer with few extra arguments for processing overlapping reactions.

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- NetDraw NetDraw
- NetPoster NetPoster

## SOURCE CODE

    0001 function I = MapTrimmerF(I,ArrowX,ArrowY,Cntrs,Allx4Arrow,Ally4Arrow,...
    0002     DoubleIds,Idx,LineStrength,ColSpec)
    0003 % MapTrimmerF
    0004 % is a subfunction of NetDraw with a similar structure to
    0005 % MapTrimmer with few extra arguments for processing overlapping reactions.
    0006
    0007 % O. Jamialahmadi
    0008 % TMU, Chem. Eng. Dept., Biotech. Group
    0009 % July 2016
    0010
    0011 Ids = DoubleIds.Id; ArrowXhelp = ({}); ArrowYhelp = ArrowXhelp; CntrHelp = ArrowXhelp;
    0012 AllX = ArrowXhelp; AllY = ArrowXhelp;
    0013 for i1 = 1:numel(Ids)
    0014     C = ismember(Idx,Ids{i1});
    0015     ArrowXhelp{i1} = ArrowX{C};
    0016     ArrowYhelp{i1} = ArrowY{C};
    0017     CntrHelp{i1} = Cntrs{C};
    0018     AllX{i1} = Allx4Arrow{C};
    0019     AllY{i1} = Ally4Arrow{C};
    0020 end
    0021 ArrowX = ArrowXhelp; Cntrs = CntrHelp; Ally4Arrow = AllY;
    0022 ArrowY = ArrowYhelp; Allx4Arrow = AllX;
    0023 for i1 = 1:numel(ArrowX)
    0024     if isempty(ArrowX{i1})
    0025         continue
    0026     end
    0027     Xin = ArrowX{i1}; Yin = ArrowY{i1}; Cents = Cntrs{i1};
    0028     pixx = Allx4Arrow{i1};
    0029     pixy = Ally4Arrow{i1};
    0030     if ~std(pixx)
    0031         pixx1 = pixx + LineStrength/2;
    0032         pixx = pixx - LineStrength/2;
    0033         pixy1 = pixy;
    0034     elseif ~std(pixy)
    0035         pixy1 = pixy + LineStrength/2;
    0036         pixy = pixy - LineStrength/2;
    0037         pixx1 = pixx;
    0038     else
    0039         pixx1 = pixx + LineStrength/2;
    0040         pixx = pixx - LineStrength/2;
    0041         pixy1 = pixy + LineStrength/2;
    0042         pixy = pixy - LineStrength/2;
    0043     end
    0044
    0045     for cnt = 1:size(Xin,1)
    0046         X = Xin(cnt,:); Y = Yin(cnt,:); Cent = Cents(cnt,:);
    0047         DistToCpd = hypot( Allx4Arrow{i1} - Cent(1), Ally4Arrow{i1} - Cent(2));
    0048         CpdDistToPoint1 = hypot( X(1) - Cent(1), Y(1) - Cent(2));
    0049 %         CpdDistToPoint2 = hypot( X(2) - Cent(1), Y(2) - Cent(2));
    0050         Ind = find(DistToCpd < 0.8*CpdDistToPoint1);% & DistToCpd>CpdDistToPoint2);
    0051         pixx1T = pixx1(Ind); pixxT = pixx(Ind);
    0052         pixy1T = pixy1(Ind); pixyT = pixy(Ind);
    0053         pixx1T = round(pixx1T); pixxT = round(pixxT);
    0054         pixy1T = round(pixy1T); pixyT = round(pixyT);
    0055         for i5 = 1:numel(pixxT)
    0056             I(pixyT(i5):pixy1T(i5),pixxT(i5),1) = ColSpec(1);
    0057             I(pixyT(i5),pixxT(i5):pixx1T(i5),1) = ColSpec(1);
    0058             I(pixyT(i5):pixy1T(i5),pixxT(i5),2) = ColSpec(2);
    0059             I(pixyT(i5),pixxT(i5):pixx1T(i5),2) = ColSpec(2);
    0060             I(pixyT(i5):pixy1T(i5),pixxT(i5),3) = ColSpec(3);
    0061             I(pixyT(i5),pixxT(i5):pixx1T(i5),3) = ColSpec(3);
    0062         end
    0063     end
    0064 end