% DIPOLEDEMO compute and display monopole and dipole mapping of visual field
%
% DIPOLEDEMO builds a matrix of visual field positions in polar coordinates,
% assembles a triangular mesh using these positions as vertices, then computes
% transformations from the visual field to cortical coordinates via both the
% monopole and dipole mappings (see Ref.s [1-3]). DIPOLEDEMO also visualizes
% the two transformations by plotting the visual field mesh followed by the
% mesh under the monopole mapping and the mesh under the dipole mapping.
%
% DIPOLEDEMO(K, A, B) computes the monopole and dipole mappings using the
% global mapping parameters K, A, and B, rather than the default parameters of
% K=15, A=0.5, and B=80.
%
% DIPOLEDEMO(K, A, B, ECC, NECC, NPOL) constructs the triangular mesh used for
% the visual field, then monopole mapping, and the dipole mapping such that
% the extent of the visual field is ECC degrees, and such that the mesh
% vertices are laid out along NECC steps along eccentricity and NPOL steps
% along polar angle, rather than with the default parameters of ECC=90,
% NECC=20, and NPOL=22.
%
% [MESH, Z, W_MONOPOLE, W_DIPOLE] = DIPOLEDEMO(...) returns in MESH the matrix
% representation of the triangular mesh used in the visualization as the data
% structure produced by MATLAB's DELAUNAY function, i.e., MESH is a N-by-3
% matrix such that each row contains indices either into the (complex)
% coordinate vector Z for the visual field, W_MONOPOLE for the cortical
% coordinates under the monopole mapping, or W_DIPOLE for the cortical
% coordinates under the dipole mapping, where N is the number of triangles.
%
% (This code produces plots identical to those appearing in Figure 1(a-c)
% of Ref. [1].)
%
% See also DELAUNAY, TRIPLOT.
%
%
% References:
% ===========
%
% [1] Mukund Balasubramanian, Jonathan Polimeni, and Eric L. Schwartz. The
% V1-V2-V3 complex: quasiconformal dipole maps in primate striate and
% extra-striate cortex. Neural Networks, 15(10):1157-1163, 2002.
%
% [2] Eric L. Schwartz. Computational studies of the spatial architecture of
% primate visual cortex: Columns, maps, and protomaps. In Alan Peters and
% Kathleen Rockland, editors, Primary Visual Cortex in Primates, volume 10
% of Cerebral Cortex. Plenum Press, March 1994.
%
% [3] Eric L. Schwartz. Anatomical and physiological correlates of visual
% computation from striate to infero-temporal cortex. IEEE Transactions on
% Systems, Man and Cybernetics, 14(2):257-271, March-April 1984.