TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
97 stars 45 forks source link

getitem for DataContainer #1244

Open epapoutsellis opened 2 years ago

epapoutsellis commented 2 years ago

__getitem__ is another important property for our DataContainer class, https://numpy.org/doc/stable/reference/c-api/array.html

    import numpy as np
    xnp = np.random.randint(1,10,(3,4))
    a1 = xnp[0]
    a2 = xnp[0:2,3]

    xdc = DataContainer(xnp)
    # b1 = xdc[0] 
    # b2 = xnp[0:2,3] %%% ???

Having this method in our DataContainer class, we could accelerate our optimisation framework, e.g., Operators, Functions, Algorithms and perform parallel/distributed optimisation, i.e., (non-) overlapping domain decomposition methods. This can be achieved using dask or scikit-image API. In this talk a TV denoising comparison is presented using scikit-image and apply_parallel function of scikit image. apply_parallel function wraps the dask.map_overlap method.

Although, metadata is not important for our optimisation framework , we already have Slicer which has label information and will have the same effect as __getitem__.

See demo comparing FISTA-TV denoising (numpy API) with and without apply_parallel.

paskino commented 2 years ago

See also #926 and #1237