== Overview of modular functions in EMAN2 == EMAN2's modular function interface is one of its most powerful features, permitting a wide range of different algorithms to be selected through a single common interface. It also means new algorithms can be added to the system without making any changes to the end-user programs. For example, if you have an idea for a new alignment algorithm, (and you know a little C++), you can easily inset the algorithm in EMAN2's core library, and it will immediately become available as an option in any program that uses alignment algorithms, including the graphical interface ! === From the command-line === Many of the command-line programs accept modular functions as options. For example, you will find '--process' in many different programs, including ''e2proc2d.py'' and ''e2proc3d.py''. Similarly, '--align' and '--cmp' or '--aligncmp' are found many places. '--process' requires the name of a 'processor' and its parameters. '--align' takes the name of an 'aligner' and its parameters, etc. To find documentation for all currently available modular classes: {{{ $ e2help.py Help is available on the following topics: processors, cmps, aligners, averagers, projectors, reconstructors, analyzers, symmetries, orientgens }}} These are the available categories of functions. To get a list of all of the functions in a category, for example: {{{ $ e2help.py cmps Available comparitors: ccc : mask(EMDATA) negative(INT) ccc.tomo : ccf(EMDATA) norm(BOOL) normalize(EMDATA) searchx(INT) searchy(INT) searchz(INT) dot : mask(EMDATA) negative(INT) normalize(INT) frc : ampweight(INT) maxres(FLOAT) minres(FLOAT) nweight(INT) snrweight(INT) sweight(INT) zeromask(INT) lod : mask(EMDATA) negative(INT) normalize(INT) optvariance : debug(INT) invert(INT) keepzero(INT) matchamp(INT) matchfilt(INT) radweight(INT) phase : ampweight(INT) maxres(FLOAT) minres(FLOAT) snrfn(INT) snrweight(INT) zeromask(INT) quadmindot : negative(INT) normalize(INT) sqeuclidean : mask(EMDATA) normto(INT) zeromask(INT) }}} Which lists the name, parameters, and the type of each parameter for each function. For even more details: {{{ $ e2help.py processors -v 2 }}} Using modular functions from the command-line is very simple. The basic specification is: {{{ --process=:=:=... for example --process=filter.lowpass.gauss:cutoff_abs=.1 --cmp=ccc --aligncmp=frc:ampweight=1:snrweight=1 }}} === In the GUI === That said, there are a LOT of algorithms, particularly in the 'processor' category. For that reason, we also provide a graphical tool called [[EMAN2/Programs/e2filtertool|e2filtertool.py]]. That program will allow you to construct chains of processors through a graphical interface then see the command-line that would be required to produce that exact effect. The workflow interface also provides graphical mechanisms for specifying the required modular functions. Generally this is done via a pop-up menu for the function name, followed by a text box where parameters in the =:= can be specified. === From Python === For python users, the modular functions are used very similarly to the command-line. The function name is passed as a string, and the parameters are passed as a dictionary. For example: {{{ image=test_image() image2=test_image() image.process("filter.lowpass.gauss",{"cutoff_abs":.1}) sim=image.cmp("ccc",image2) sim=image.cmp("phase",image2,{"maxres":10,"apix":2}) }}}