Here's a schematic of the process I've used to feed images as inputs
to NEURON simulations:

1.  Generate a stimulus image (sometimes by hand in GIMP or a similar
    image-manipulation program, sometimes by a Perl or C++ program).
    {in practice: some images I've generated by hand, and some are
    generated by build.C, which is the program primarily responsible
    for (2) and (3) below.}

2.  Calculate an array of LGN responses (firing rates).  Note that the
    existing system calculates stationary (non-time-varying) responses
    only.  I'm working on a more general system that can handle
    dynamic responses, but it's at least a few weeks from ready.

3.  Use a synapse map (.snm) file to determine which values from the
    LGN array will be used to make synapses on the target cell.  Write
    the input file: each line is for a single simulation, and contains
    the array of firing rates of the "virtual" presynaptic cells.
    (There's a way to use a second .snm file to set up inhibitory
    inputs as well as excitatory.  I strongly encourage you to try
    first with just excitatory input until you have that working.)

4.  (Finally some hoc code) Run the simulation; the set of dendrites
    onto which the input projects is determined at this time (by the
    contents of the SectionList input_list defined in geom.hoc, and
    usually redefined elsewhere -- e.g., post.hoc).

Some details:

I've put (hopefully) a sufficient subset of the full system on the
Web:  http://lnc.usc.edu/~karchie/synmap

You'll need to:
 * build a new NEURON executable with the files in mod/
 * build the C++ program "build" in src/ (you'll also need the FFT
   library FFTW, http://www.fftw.org; and the NETPBM library,
   available from a variety of sources) -- I haven't documented this
   program at all, but try "build -h" for command options
   etc. (although I don't guarantee that all of the options
   necessarily work -- esp. the random image generation).
 * Use "build" to generate synapse input files -- I've enclosed sample
   excitatory and inhibitory .snm synapse map files, so you can either
   use some of the "build" built-ins (mostly gratings) or start from
   a PGM image.
 * Build an input resistances file for the morphology you're using:
   use the Perl script get_inres_syn.pl (note that I use "nrnexec" as
   a symbolic link to the NEURON executable).  The R_in file is used
   to scale synaptic conductances based on position.
 * Run NEURON on the files in hoc/, using your brand new synapse
   input file as the activity file.  The NEURON command line for
   running the simulation will look something like:

   special geom.hoc run-gui.hoc -

Anyway, I have hopefully put all of the pieces that you need online.
There's very little documentation, and much of it is assembled in a
rather haphazard fashion, but most of the code is somewhat extensively
commented.  Let me know if you find anything missing.  Good luck!

Kevin Archie
karchie@lnc.usc.edu
last update: 11 August 2000