trackOptiNeighbors : finds the neighbors for region ii INPUT : data : region (cell) data structure from file ii : region id OUTPUT : ind : indices of neighboring regions Copyright (C) 2016 Wiggins Lab Written by Stella Stylianidou & Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SuperSegger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function ind = trackOptiNeighbors(data,ii) 0002 % trackOptiNeighbors : finds the neighbors for region ii 0003 % 0004 % INPUT : 0005 % data : region (cell) data structure from file 0006 % ii : region id 0007 % OUTPUT : 0008 % ind : indices of neighboring regions 0009 % 0010 % Copyright (C) 2016 Wiggins Lab 0011 % Written by Stella Stylianidou & Paul Wiggins. 0012 % University of Washington, 2016 0013 % This file is part of SuperSegger. 0014 % 0015 % SuperSegger is free software: you can redistribute it and/or modify 0016 % it under the terms of the GNU General Public License as published by 0017 % the Free Software Foundation, either version 3 of the License, or 0018 % (at your option) any later version. 0019 % 0020 % SuperSegger is distributed in the hope that it will be useful, 0021 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0023 % GNU General Public License for more details. 0024 % 0025 % You should have received a copy of the GNU General Public License 0026 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0027 0028 0029 persistent sdisk; 0030 0031 if isempty( sdisk ) 0032 sdisk = strel( 'disk', 5 ); 0033 end 0034 0035 ss = size( data.regs.regs_label ); 0036 num_regs = data.regs.num_regs; 0037 [xx,yy] = getBBpad( data.regs.props(ii).BoundingBox, ss, 6); 0038 tmp_label = data.regs.regs_label(yy,xx); 0039 mask = logical(imdilate( tmp_label==ii, sdisk)); 0040 ind = unique( tmp_label(mask )); 0041 ind = ind(ind~=ii); 0042 ind = ind(logical(ind)); 0043 0044 end 0045 0046 0047 0048 0049 0050