function endp=get_endp_tracts(SL,sr)
%
% function endp=get_endp_tracts(SL,sr)
%
% It extract the end points of fiber bundles. Shorter tracts with less than
% 10 control points are considered as noisy and removed.
%
% SL: list of tract coordinates in cell array format
% sr: sampling rate
%
% (C) Moo K. Chung 2009
% mkchung@wisc.edu


endp=[];%%zeros(number,2,3);
j=1;
for i=1:sr:10000 % subsampling at every 30 tracts
    tract = SL{i};
    if size(tract,1)> 10 %removes short tract with less than 10 points
        endp(j,1,:)=tract(1,:);  % one end
        endp(j,2,:)=tract(end,:);% the other end
        j=j+1;
    end;
end;