diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-07-20 14:07:21 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-07-23 11:57:18 +0200 |
commit | d91b51f6d58003de84a9d6dd8189fceba0e81a5a (patch) | |
tree | 215492c645ee57fb1cd65bab1c8f7bd0aabd058e /samples/python/s018_plugin.py | |
parent | 37abc22cf8d26fa3f7e282a1ee50a2a129d5a295 (diff) | |
download | astra-d91b51f6d58003de84a9d6dd8189fceba0e81a5a.tar.gz astra-d91b51f6d58003de84a9d6dd8189fceba0e81a5a.tar.bz2 astra-d91b51f6d58003de84a9d6dd8189fceba0e81a5a.tar.xz astra-d91b51f6d58003de84a9d6dd8189fceba0e81a5a.zip |
Allow registering plugins without explicit name, and fix exception handling when running in Matlab
Diffstat (limited to 'samples/python/s018_plugin.py')
-rw-r--r-- | samples/python/s018_plugin.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/samples/python/s018_plugin.py b/samples/python/s018_plugin.py index 90e09ac..31cca95 100644 --- a/samples/python/s018_plugin.py +++ b/samples/python/s018_plugin.py @@ -38,6 +38,10 @@ class SIRTPlugin(astra.plugin.base): 'rel_factor': relaxation factor (optional) """ + # The astra_name variable defines the name to use to + # call the plugin from ASTRA + astra_name = "SIRT-PLUGIN" + def initialize(self,cfg, rel_factor = 1): self.W = astra.OpTomo(cfg['ProjectorId']) self.vid = cfg['ReconstructionDataId'] @@ -68,18 +72,13 @@ if __name__=='__main__': sinogram = sinogram.reshape([180, 384]) # Register the plugin with ASTRA - # A default set of plugins to load can be defined in: - # - /etc/astra-toolbox/plugins.txt - # - [ASTRA_INSTALL_PATH]/python/astra/plugins.txt - # - [USER_HOME_PATH]/.astra-toolbox/plugins.txt - # - [ASTRA_PLUGIN_PATH environment variable]/plugins.txt - # In these files, create a separate line for each plugin with: - # [PLUGIN_ASTRA_NAME] [FULL_PLUGIN_CLASS] - # - # So in this case, it would be a line: - # SIRT-PLUGIN s018_plugin.SIRTPlugin - # - astra.plugin.register('SIRT-PLUGIN','s018_plugin.SIRTPlugin') + # First we import the package that contains the plugin + import s018_plugin + # Then, we register the plugin class with ASTRA + astra.plugin.register(s018_plugin.SIRTPlugin) + + # Get a list of registered plugins + six.print_(astra.plugin.get_registered()) # To get help on a registered plugin, use get_help six.print_(astra.plugin.get_help('SIRT-PLUGIN')) |