+
Skip to content

Object oriented interface #223

@sjkisner

Description

@sjkisner

I pushed a branch oo_interface that includes a definition of a new callable class Recon that wraps svmbir.recon(). What it currently does is very simple. Instances of Recon have the attribute .params which is a dictionary of all the arguments to svmbir.recon(). An instance of Recon is callable, and can be used with the same syntax as svmbir.recon(). So,

img = svmbir.recon(sino,angles,**kwargs)

Can be achieved equivalently with,

rec_op = svmbir.Recon(**kwargs)
img = rec_op(sino,angles)    # can also add keyword arguments here

Additionally it defines the following methods:

__init__(self, **kwargs)      # defines/sets initial 'params' attribute
__call__(self, sino, angles, **kwargs)    # calls svmbir.recon()
set_defaults()             # resets params attribute to defaults
set_params(**kwargs)       # sets params entries by keyword
save_params(filename)      # save params dict to numpy/pickle file
load_params(filename)      # load params dict from numpy/pickle file
backproject(sino, angles, **kwargs)    # backprojector

I added a file demo/demo_oo.py that illustrates further.

We can use this thread to discuss this and further development of an OO interface for svmbir.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载