Command Line Interface

MIEN can be used from a command prompt in several ways. The most common way is to run the mien command in a terminal. This command can be used to launch GUI applications, but can also be used to launch a command line interface, to convert files from one type to another, and to run batch computations. The capabilities of the mien command are detailed below.

MIEN's component packages can also be imported into and interactive Python interpreter session, and used from the Python command prompt in the same ways that they might be used in a Python program.

Finally, custom scripts that use MIEN modules, or that use the mien command, can be written in Python, bash, or any other language that can make system calls, and these scripts can be deployed from the command line. The core MIEN package, and several of the CCB extension modules provide custom commands of this sort.

The mien command

The mien command works like many other Unix commands, in that it is called from a command prompt by typing mien optionally followed by some switches and arguments. A Switch is an instruction that changes the behavior of the command. The program knows something is a switch because it begins with - (for one-character switches) or -- (for long switches). In the command mien --version, the string "--version" is a switch, which changes the behavior of the command (The default behavior is to launch the XML Editor GUI. but this command will print version information). If you are familiar with reading man pages for Unix commands, you can use mien -h to get documentation on all the supported switches and arguments.

Some commonly used switches include:

-t (Text) Open the interactive text-based (command line) ui -a app (Application) Open a particular component application. legitimate values for "app" are: "cell" - the display GUI for anatomical data (CellViewer) "data" - the display GUI for time series data (DataViewer) "dsp" - the Dsp toolchain generator (Dsp) "update" - the Update Manager -v (view) Try to open the "right" appication gui to view the indicated files. -s depth (Scan) Prints a scan of the file to the indicated depth and exits. Use depth<0 to scan to unlimited depth. -r method (Run) Find and run a method of one of the objects in the first specified data file -b fname (batch): Run abstract models in batch mode -c type (Convert) Convert the input files to the specified type -i (Interact) Prompt for selection of sub-components while loading files. -f format (Format) Force mien to assume the specified format for the input files. Legal arguments for "format" may be format names or file extensions (without the leading "."). For example: "-f jpg" or '-f "Mien Data". You can get a list of format names with "mien -f list" or a list of the extensions associated to each file type with "mien -f listext" -h help. --version Version information for mien and the python modules it uses. --update Updates mien and the installed blocks using a web repository

Any string that doesn't start with a - is an argument. Arguments can be associated to the preceding switch, or to the mien command. The switches -a -s -r -b -c above expect arguments, so the first argument listed after one of these switches will be associated to the switch. Any remaining arguments will be associated to the mien command itself. The mien command assumes that arguments are the names, or urls, of data files to open. If there is more than one such data file, the data read from every file will be concatenated into a single MIEN document and opened (the specified input files themselves will never be modified).

For example, the command mien -a cell *.asc will load anatomical data from all neuroleucida files with extension .asc that are in the current directory, build a MIEN document containing all these data sets, and open that document with the CellViewer application. In this command, "-a" is a switch, "cell" is an argument of the "-a" switch, and "*.asc" is a shell glob, which is expanded by the command shell into a list of all the local files with names ending in ".asc". Each of these file names becomes an argument to the mien command.

When the mien command is called with no switches or with the switches "-a" or "-v", the result is to open a GUI application. The GUI that is launched will continue to use the terminal in order to display status messages, will use the terminals current working directory to save certain files (notably screen shot images), and will use this terminal for input, if you subsequently launch a Python command prompt from the GUI's "Python" menu. I don't recommend launching MIEN GUIs as background processes (e.g. with a command like mien -a cell &. This is possible, but the MIEN GUI will continuously print messages to the terminal, which can be rather distracting if you are trying to use that terminal to run other commands.

MIEN CLI (mien -t)

Using the command mien -t will launch an interactive Python interpreter. If the iPython module is available, MIEN will use the iPython enhanced interactive interpreter. Otherwise, it will launch the same interpreter you would get by using the python command. The difference between mien -t and python (or ipython) is that mien -t will load any data files specified as arguments into a document which is bound to the name doc, and mien -t will automatically import some helpful interface functions and some MIEN modules and methods.

 

Last edit: 05/29/09

Index