Other than that, there are no limitations to the plug-in.
A very simple preprocess (which replaces "superman" with "batman") is
shown below:
public class MyPreprocess extends COM.hugin.HGUI.PreProcess{
public String process(String value){
if(value.equals("superman"))
return "batman";
else
return value;
}
// No we do not provide an interface. If we did, we
// should also implement the getInterface function.
public boolean providesInterface(){
return false;
}
public String getDescription(){
return "Replacing superman with batman";
}
}
If the providesInterface function returns true, the getInterface function must be implemented as well as
the storeValues function. The first is used by the system to show a graphical interface to the user, and
the latter is used to store the values that the user entered into the interface.
That is, when
the user presses the "ok"-button, storeValues is called.
As the process function will be called once for
each case, it is important to write this function to run as efficiently as possible.
To add your own data preprocess, you should simply add the compiled class to the "plugins"
subdirectory under the Hugin installation directory. Hugin will then automatically add the process to
the list of available processes. These are grouped under the "External Plug-Ins"
section of the preprocesses (see Figure 1). The user-defined preprocesses will
then appear in the pull-down menu.
![]() |
| Figure 1: External data preprocess plug-ins are available via a pull-down menu. |
Hugin comes with two sample preprocess plug-ins: CapitalizeProcess and ConvertToBoolean. The source code to these are available in the "plugins" directory along with the class files, and they demonstrate all aspects of the data preprocessing plug-ins feature.