function crossed_nbrhood=cosmo_cross_neighborhood(ds, nbrhoods, varargin)
% cross neighborhoods along dataset dimensions
%
% crossed_nbrhood=cosmo_cross_neighborhood(ds,nbrhoods,...)
%
% Inputs:
% ds dataset struct
% nbrhoods 1xK cell with neighborhood structs. Each element can be
% the output from cosmo_spherical_neighborhood,
% cosmo_meeg_chan_neighborhood,
% cosmo_surficial_neighborhood, or
% cosmo_interval_neighborhood.
% 'progress',p if p is true, then progress is shown
%
% Returns:
% crossed_nbrhood neighborhood struct with fields .[f]a and .neighbors,
% constructed by intersecting the neighborhoods from the
% input.
%
% Example:
% % Illustrate neighborhood by crossing freq and time, with freq
% % 5 bins wide and time 3 bins wide. Each neighborhood contains all
% % the channels, repeated up to 5*3=15 times (fewer at the border)
% ds=cosmo_synthetic_dataset('type','timefreq','size','big');
% freq_nbrhood=cosmo_interval_neighborhood(ds,'freq','radius',3);
% time_nbrhood=cosmo_interval_neighborhood(ds,'time','radius',5);
% nbrhood=cosmo_cross_neighborhood(ds, {freq_nbrhood, time_nbrhood},...
% 'progress',false);
% cosmo_disp(nbrhood.a.fdim)
% %|| .values
% %|| { [ 2 4 6 ... 10 12 14 ]@1x7
% %|| [ -0.2 -0.15 -0.1 -0.05 0 ] }
% %|| .labels
% %|| { 'freq'
% %|| 'time' }
% cosmo_disp(nbrhood.fa)
% %|| .freq
% %|| [ 1 2 3 ... 5 6 7 ]@1x35
% %|| .time
% %|| [ 1 1 1 ... 5 5 5 ]@1x35
% cosmo_disp(nbrhood.neighbors)
% %|| { [ 1 2 3 ... 9.79e+03 9.79e+03 9.79e+03 ]@1x6120
% %|| [ 1 2 3 ... 1.01e+04 1.01e+04 1.01e+04 ]@1x7650
% %|| [ 1 2 3 ... 1.04e+04 1.04e+04 1.04e+04 ]@1x9180
% %|| :
% %|| [ 307 308 309 ... 1.07e+04 1.07e+04 1.07e+04 ]@1x9180
% %|| [ 613 614 615 ... 1.07e+04 1.07e+04 1.07e+04 ]@1x7650
% %|| [ 919 920 921 ... 1.07e+04 1.07e+04 1.07e+04 ]@1x6120 }@35x1
%
% See also: cosmo_spherical_neighborhood, cosmo_meeg_chan_neighborhood,
% cosmo_interval_neighborhood
%
% # For CoSMoMVPA's copyright information and license terms, #
% # see the COPYING file distributed with CoSMoMVPA. #