LTUsegmentMap - segment map using a network of linear threshold units. [resultMap,segMaps] = LTUsegmentMap(map,seedPoint) Segment the map around the seedPoint using a network of linear threshold units. Returns a binary map in resultMap and the intermediate maps at each time step in segMaps. This function is A LOT slower than fastSegmentMap! (But it works with model neurons.) See section 3 of this paper for details: Walther, D., and Koch, C. (2006). Modeling attention to salient proto-objects. Neural Networks 19, pp. 1395-1407. [resultMap,segMaps] = LTUsegmentMap(map,seedPoint,thresh) Use threshold thresh for segmentation (default: 0.1). This threshold is relative to the map activity at the seedPoint, i.e. the actual threshold is thresh * map(seedPoint). See also makeLTUsegmentNetwork, LTUsimulate, fastSegmentMap, estimateShape, dataStructures.
0001 % LTUsegmentMap - segment map using a network of linear threshold units. 0002 % 0003 % [resultMap,segMaps] = LTUsegmentMap(map,seedPoint) 0004 % Segment the map around the seedPoint using a network of linear 0005 % threshold units. Returns a binary map in resultMap and the 0006 % intermediate maps at each time step in segMaps. 0007 % This function is A LOT slower than fastSegmentMap! 0008 % (But it works with model neurons.) 0009 % See section 3 of this paper for details: 0010 % Walther, D., and Koch, C. (2006). Modeling attention to salient 0011 % proto-objects. Neural Networks 19, pp. 1395-1407. 0012 % 0013 % [resultMap,segMaps] = LTUsegmentMap(map,seedPoint,thresh) 0014 % Use threshold thresh for segmentation (default: 0.1). 0015 % This threshold is relative to the map activity at 0016 % the seedPoint, i.e. the actual threshold is thresh * map(seedPoint). 0017 % 0018 % See also makeLTUsegmentNetwork, LTUsimulate, fastSegmentMap, estimateShape, dataStructures. 0019 0020 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0021 % by Dirk B. Walther and the California Institute of Technology. 0022 % See the enclosed LICENSE.TXT document for the license agreement. 0023 % More information about this project is available at: 0024 % http://www.saliencytoolbox.net 0025 0026 function [resultMap,segMaps] = LTUsegmentMap(map,seedPoint,varargin) 0027 0028 if isempty(varargin) thresh = 0.1; 0029 else thresh = varargin{1}; end 0030 0031 numIter = -1; 0032 eps = 0.001; 0033 0034 % prepare data structures for the result 0035 imSize = size(map.data); 0036 lab = map.label; 0037 seedVal = map.data(seedPoint(1),seedPoint(2)); 0038 if (seedVal < eps) 0039 resultMap.origImage = map.origImage; 0040 resultMap.label = ['seg-0: ' lab]; 0041 resultMap.data = zeros(imSize); 0042 resultMap.date = timeString; 0043 resultMap.parameters = map.parameters; 0044 segMaps = []; 0045 return; 0046 end 0047 0048 % create the segmentation network 0049 LTUnetwork = makeLTUsegmentNetwork(imSize,thresh); 0050 select = zeros(imSize); 0051 select(seedPoint(1),seedPoint(2)) = 1; 0052 input = [map.data(:)/seedVal;select(:)]; 0053 states = zeros(1,LTUnetwork.numCells); 0054 0055 keepgoing = 1; 0056 iter = 0; 0057 while (keepgoing) 0058 iter = iter + 1; 0059 [output,states] = LTUsimulate(LTUnetwork,states,input,2); 0060 segMaps(iter).origImage = map.origImage; 0061 segMaps(iter).label = sprintf('seg-%d: %s',iter,lab); 0062 segMaps(iter).data = reshape(output,imSize); 0063 segMaps(iter).date = timeString; 0064 segMaps(iter).parameters = map.parameters; 0065 if (numIter > 0) 0066 keepgoing = (iter <= numIter); 0067 else 0068 if (iter == 1) 0069 keepgoing = 1; 0070 else 0071 keepgoing = ~isequal(output,old_output); 0072 end 0073 old_output = output; 0074 end 0075 end 0076 0077 resultMap = segMaps(end);