DEMO TO CREATE MPEG MOVIES FROM NEURON Alain Destexhe Department of Physiology, Laval University, Quebec G1K 7P4, Canada Present address: CNRS, UNIC (Bat-33), Avenue de la Terrasse, 91198 Gif-sur-Yvette, France Destexhe@iaf.cnrs-gif.fr http://cns.iaf.cnrs-gif.fr This package is running with the NEURON simulation program written by Michael Hines and available on internet at: http://www.neuro.duke.edu/neuron/home.html The package illustrates how to create mpeg movies from NEURON. The example taken generates an animation of the somato-dendritic profile of membrane potential in a model of thalamic reticular neuron, relative to the paper: Destexhe A, Contreras D, Steriade M, Sejnowski TJ and Huguenard JR. In vivo, in vitro and computational analysis of dendritic calcium currents in thalamic reticular neurons. Journal of Neuroscience 16: 169-185, 1996. (see http://cns.iaf.cnrs-gif.fr in "publications") THE EASY WAY ============ If you have a recent version of LINUX, for example SUSE LINUX 7.1, then all the necessary commands can be found in the distribution and creating mpeg movies in NEURON is straightforward. The necessary commands are: - pstopnm: converts postscript files to "ppm" format - ppmtoyuvsplit: converts "pnm" files to "YUV" format - mpeg: generate mpeg animations from YUV files It is also possible to use the program "ppmtompeg" (also called mpeg_encode - see below) to go directly from ppm to mpeg_movies, but this command is not available in all LINUX distributions The way to proceed is illustrated in the "re80mpg2.oc" demo file: (1) run the program by using the command special re80mpg2.oc - (2) in the program, select the "shape-plot" window and rescale it to about 500x500 pixels. Then select "Shape Style" in that window (right mouse click) and select "Show Diam" to display the cell with full 3D information. Then right-click again and select the item "Shape Plot" - the cell should appear in color. (3) run the simulation (click on "Init and Run"), after a while, the program will generate 250 YUV frames called "fram*" in the directory "frames" (4) exit the program, cd the directory where the frames are located and run the command: mpeg -a 0 -b 249 -PF -h 500 -v 500 fram -s movie.mpg THE DETAILED WAY ================ This section contains all details necessary to create mpeg movies from NEURON on any UNIX machine. SYSTEM REQUIREMENTS To generate mpeg movies from NEURON, three packages must be installed besides those already present in NEURON: 1. ghostscript Ghostscript is a public-domain postscript interpreter available at many sites deserving gnu licenses. See for example: http://www.cs.wisc.edu/~ghost ftp://prep.ai.mit.edu/pub/gnu/ 2. pstopnm the script pstopnm is part of the Netpbm package (freely available). pstopnm uses ghostscript to transform postscript files into ppm format. For more details on pstopnm, see: http://www-bioeng.ucsd.edu/~fvetter/misc/postscript-faq.txt http://www.cs.ucsb.edu/Facilities/Software/netpbm.html http://toons.cs.ucsb.edu:4080/man?pstopnm The Netpbm package can be obtained at: ftp://ftp.cs.ubc.ca/ftp/archive/netpbm/ A copy of the pstopnm script can also be downloaded at: http://cns.iaf.cnrs-gif.fr/files/pstopnm 3. mpeg_encode This publically-available package generates mpeg movie files from a set of frames in various possible formats, including ppm. mpeg_encode is freely available at: http://www-plateau.cs.berkeley.edu/mpeg/ ftp://mm-ftp.CS.Berkeley.EDU/pub/multimedia (note that this command is sometimes called "ppmtompeg" on some UNIX/LINUX distributions) PROCEDURE Creating an mpeg movie from NEURON simulations can be done in the following steps: (a) save NEURON plots as postscript; (b) convert postscript images into ppm; (c) encode the mpeg stream from ppm frames. Steps (a) and (b) can be done in NEURON if the command "pstopnm" is available. This is what shows the demo called "re80mpg.oc". The demo creates a series of successive ppm frames from a NEURON simulation and name them: 0000.ppm, 0001.ppm, 0002.ppm, ... To run this demo, do the following: - enter the command "special re80mpg.oc -" - set "Shape Style" to "Show Diam" in the shapeplot (the "v" can be moved outside the plot using "move text" if needed) - set the shapeplot in "Shape Plot" mode - click on "run" The program will create a bunch of frames in a directory called "frames". Warning: the frames may need a lot of temporary disk space, depending on the size of the window. In the example here creates 250 color frames totaling about 180 megabytes. Generating the mpeg movie from the frames (step c) can be done using the "mpeg_encode" program; enter the command: mpeg_encode dendritRE.param The program will create an mpeg file called "dendritRE.mpg" of the NEURON simulation. This movie file can be viewed at: http://cns.iaf.cnrs-gif.fr/files/dendritRE.mpg Changes of resolution can be obtained by changing the parameters in dendritRE.param (see documentation of mpeg_encode for details) At the end, destroy the ppm frames which are not needed anymore MOVIES USING THE WINDOW MANAGER More sophisticate animations can be done using the print-window-manager (PWM). In this case, uncomment the appropriate commands in the oc file (replace the "g[sh].printfile..." by "print_session..." command). Then start the program and select/arrange windows as desired on the paper icon of the PWM. Then run the program as above, the difference is that each frame will contain the complete set of windows as arranged by the user. (this allows for instance to generate movies where both shape plot and time plots appear - see examples in http://cns.iaf.cnrs-gif.fr) CONDITIONS AND TROUBLESHOOTING This demo is provided "as is" and is of free access - if you experience problems installing ghostscript, pstopnm and mpeg_encode, please refer directly to the authors of these programs. If these commands are properly installed, the demo should work straight. If you notice platform-specific problems, please send me a note, so that I can maintain a list of installation instructions if needed. Alain Destexhe CNRS, UNIC (Bat-33), Avenue de la Terrasse, 91198 Gif-sur-Yvette, France email: Destexhe@iaf.cnrs-gif.fr http://cns.iaf.cnrs-gif.fr