ITK Pre-Processing Algorithm Wrappers in Python/SourceCode
From FarsightWiki
Source code for Python interface for running ITK Pre-processing algorithms.
A brief description of various files for the Python interface for ITK pre-processing algorithms is given below.
Running the algorithms:
- 1. ListOfItems.py – contains a class ListOfItems for describing a general purpose list. Methods allow display of a list (passed as argument).
- 2. ListOfAlgorithmsWithURL.py – contains class ListOfAlgorithmsWithURL derived from ListOfItems, and display a list along with specific URLs for help.
- 3. basic.py – contains some commonly used general-purpose methods.
- 4. ExecuteAlgorithm.py – this file contains all execution phase of all the algorithms. Most algorithms have a common / similar execution style, and is implemented in the method ExecuteCommands.py. Resample filter and vesselness measure filter (that is not yet implemented) have different execution steps and hence we have defined separate functions for them.
- 5. FilterObject.py' – contains base class FilterObject for describing the methods and members of a filter. This only contains essential objects like name, label, key and the parameters.
- 6. FilterAlgorithm.py – contains class FilterAlgorithm for describing the algorithm to be run. It is derived from FilterObject. It stores the filter name of the input/output files and other details of the algorithm such as help and advanced help URLs.
- 7. FilterObjectGUIwx.py – contains class FilterObjectGUIwx for the GUI required for entering details of objects in class FilterObject. This contains methods for declaring and defining widgets. The GUI module used is wxPython.
- 8. FilterAlgorithmGUIwx.py – contains class FilterAlgorithmGUIwx for the GUI for entering details of algorithm in class FilterAlgorithm. It is derived from FilterObjectGUIwx.
- 9. FilterObjectXML.py – contains two classes. Class ObjectXML defines some basic methods for interfacing an XML document. The other class FilterObjectXML deals with writing and reading parameters (defined by the user) into XML files. The name “FilterObjectXML” does not relate to the class FilterObject. This is a small inconsistency (in nomenclature) and needs to be changed.
- 10. smooth.py – this is the main script that is to be run. There a multiple ways of implementing the algorithm. If we don’t pass any algorithm type to the function, a GUI is initiated and the user is asked to enter the algorithm detail. The algorithm details are read from an XML file (currently named as SmoothingAlgorithms.xml), and then displayed in the the GUI (FilterAlgorithmGUIwx object).
Entering new algorithm:
- 1. EnterAlgorithm.py – This contains the class EnterAlgorithmGUIwx that helps creating the GUI for entering a new algorithm. To display an existing algorithm, type the correct key and press “Display existing”. Otherwise, all the algorithm details need to be entered. In order to enter the correct number of parameters, you need to first type the number of parameters and press Enter. Then the parameters can be entered.
- 2. AlgorithmXML.py – this class (AlgorithmXML) stores a list of algorithms, along with necessary details such as name, key, label of the algorithm and other parameters of the algorithm. Other methods are present that can be used to retrieve this information.