GithubHelp home page GithubHelp logo

cil-demos's People

Contributors

ccpi-admin avatar epapoutsellis avatar evelinaametova avatar gfardell avatar jakobsj avatar lauramurgatroyd avatar letizia97 avatar margaretduff avatar paskino avatar rasmiakulan avatar vais-ral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cil-demos's Issues

Update README

The content of the README is outdated.
The install script is both wrong (environment.yml is in the binder directory) and possibly installing an old version of CIL

SPDHG explicit demo probabilities

"spdhg_explicit = SPDHG(f = F, g = G, operator = K, max_iteration = 5 * 2 * n_subsets,\n",

In the explicit demo for SPDHG you explain the non-uniform sampling: half of the time, we update the dual variable corresponding to TV, so that $p_{n+1}=1/2$, and half of the time we update one of the dual variable corresponding to one subset, so that $p_i=1/(2n)$ for $1\leq i \leq n$.

You also define it in line

"prob = [1 / (2 * n_subsets)] * n_subsets + [1 / 2]\n",
but then don't use it in either line
"spdhg_explicit = SPDHG(f = F, g = G, operator = K, max_iteration = 5 * 2 * n_subsets,\n",
or line
"spdhg_explicit = SPDHG(f = F, g = G, operator = K, max_iteration = 5 * 2 * n_subsets,\n",
.

Just needs a quick fix to add "prob=prob" to the calls to SPDHG.

Notebook 1 week 2 too hard check?

We use the following hard statement:

if myFISTATV.g.alpha == 0.02 and myFISTATV.iteration > 199:
   print("Good job, carry on!")
else:
    raise ValueError("Try again: run 200 iterations with alpha of 0.02")

which could be substituted with

import numpy as np
if np.testing.assert_almost_equal(myFISTATV.g.alpha, 0.02, decimal=2) and myFISTATV.iteration > 199:
    print("Good job, carry on!")
else:
    raise ValueError("Try again: run 200 iterations with alpha of 0.02")

installation problem

when I want to install CIL toolbox with this code (conda create --name cil -c conda-forge -c intel -c ccpi cil=23.0.1 astra-toolbox tigre ccpi-regulariser tomophantom "ipywidgets<8")
this gives this error ( A directory already exists at the target location 'C:\Users\LENOVO\anaconda3\envs\cil'
but it is not a conda environment.)
would you please help me to solve this problem.

How to run own CT data in the demo 01_intro_walnut_conebeam.ipynb?

The Cil module is really good to use. Now I want to reconstruct my own data. I used 01_intro_walnut_conebeam.ipynb in the demo to reconstruct it. It has been successfully reconstructed. Now I want to reconstruct my own data. I copied my own data to the imported walnut data data.array, and then modified the pixel_num_v and pixel_num_h attributes of data.geometry. My projection number is only 360, and the angle is from 0 to 359 degrees. I assigned it to data.geometry.angles I am not allowed to modify, and I am not allowed to modify data.geometry.num_projections. How can I solve it, or how can I create my own geometry, thank you!

Filepaths to data could all be listed in a single file

E.g. we could have a utils/file_paths.py file
This could contain the paths to all the datasets, making use of a base path variable
This would mean when running on different machines the base path could just be changed in one place rather than having to go through every notebook

In exercise 03_where_is_my_reader the data type written in the text is incorrect

https://github.com/TomographicImaging/CIL-Demos/blob/main/demos/1_Introduction/exercises/03_where_is_my_reader.ipynb

In Exercise A it says

he background peak is not at 1. When the data was saved as a tiff it was pre-scaled by 60000 by the scanner and stored as unsigned char which have integer values 0 - 65535. We can see the white level of 60000 in the xtek2dct file so we use this to normalise the data.

This should say "unsigned short" instead of "unsigned char"

GColab conda install

Atm, there is an error

numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

coming from the CCPi regularisation toolkit (related to numpy=1.22) using the following cmd

!mamba install -c conda-forge -c intel -c astra-toolbox -c ccpi cil=22.0.0 astra-toolbox ccpi-regulariser tomophantom --quiet

To fix it we need to force numpy=1.20.3 (see here

!mamba install -c conda-forge -c intel -c astra-toolbox -c ccpi cil=22.0.0 numpy==1.20.3 astra-toolbox ccpi-regulariser tomophantom --quiet

04_FBP_CGLS_SIRT contains unused variable

Cell [21] which adds noise contains a variable which is never used:

# Incident intensity: lower counts will increase the noise
background_counts = 20000 

# Convert the simulated absorption sinogram to transmission values using Lambert-Beer. 
# Use as mean for Poisson data generation.
# Convert back to absorption sinogram.
counts = background_counts * np.exp(-sino.as_array())
tmp = np.exp(-sino.as_array())
noisy_counts = np.random.poisson(counts)
nonzero = noisy_counts > 0
sino_out = np.zeros_like(sino.as_array())
sino_out[nonzero] = -np.log(noisy_counts[nonzero] / background_counts)

# allocate sino_noisy and fill with noisy data
sino_noisy = ag.allocate()
sino_noisy.fill(sino_out)

The tmp variable is never used

Broken link in documentation

The link in 03_where_is_my_reader Exercise C: Create the geometry is broken (leads to error 404 - File not found)
image

wget import error: examples/3_Multichannel/02_Dynamic_CT

wget import errror

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [2], in <module>
     17 from cil.utilities.display import show2D, show_geometry
     18 from cil.utilities.jupyter import islicer
---> 20 from utilities_dynamic_ct import read_frames, read_extra_frames
     22 from IPython.display import clear_output
     24 import numpy as np

File ~/CIL_DEMOS_new/training/2021_Fully3D/Week3/utilities_dynamic_ct.py:25, in <module>
     23 import numpy as np
     24 import os
---> 25 import wget
     28 # read all the 17 frames
     29 def read_frames(file_path, file_name):

ModuleNotFoundError: No module named 'wget'

@paskino maybe we need to rebuild it adding wget?

Not clear enough that distances need to be set on Y axis in 03_where_is_my_reader

The CIL convention is that distances are set along the Y axis.

In this notebook, for exercise C I tried:

geometry = AcquisitionGeometry.create_Cone2D(source_position=[0,0], detector_position=[source_to_detector_distance, 0], rotation_axis_position=[source_to_object_distance, 0])

This gives an error:

ZeroDivisionError: float division by zero

I don't think this is at all clear to the user what they have done wrong.

The solution is:

geometry = AcquisitionGeometry.create_Cone2D(source_position=[0,0],
                                             detector_position=[0,source_to_detector_distance],
                                             rotation_axis_position=[0,source_to_object_distance])

Which python version is good to test CIL library?

The CIL module is a very good module, please tell me, which version of python is used to test all the tests of this module library, I am currently using version 3.10, and found that there are many other dependent module libraries that do not support it, please Tell me what is the stable test python version, thank you very much for replying to me while helping.

Deprecation warning when running iterative algorithms

When running iterative algorithms we get a deprecation warning:

/tmp/ipykernel_23663/4232300540.py:7: DeprecationWarning: run()missingiterations``

We should update our notebooks code to prevent this warning

CIL version, latest master, testing just before v24.0.0 release

Week 3, 01 Colour Processing

  • Font type 'FreeSerifBold.ttf cannot be found from the system, use DejaVuSerif.ttf instead
  • Replace mask = ig.subset(channel=0).allocate(True,dtype=np.bool) by mask = ig.subset(channel=0).allocate()

SPDHG epochs

I think there is still some problems with the epochs and the plots.

Restructure repo

  • Tag for symposium and fully 3D (find original commits)
  • Remove 'Training' folder
  • Add 'colab' folder
  • Keep as 'examples' or rename to 'Demos' 'Notebooks' 'Training' ?

Too many prints in algorithm runs in examples/2_Iterative/01_optimisation_gd_fista.ipynb

When the algorithms are run, every single step is printed and there are hundreds of steps. Is this expected and is it necessary?

It means the notebook gets really full of all of the prints and it is hard to scroll up and compare different images.
image

Further down in the notebook it runs myPDHG.run(5000,verbose=2) and all 5000 steps are printed.

I wonder if less prints would speed it up a bit? It took me over 30 mins to run this notebook.

misc folder

Add 'misc' folder for quick scripts showing functionality.

This is for our reference as well as users, but it's not necessarily maintained.

PyData: Binder Total Generalised Variation Inpainting broken

UFuncTypeError                            Traceback (most recent call last)
/tmp/ipykernel_135/18491494.py in <module>
----> 1 noisy_data = MO.direct(noisy_data)

/srv/conda/envs/notebook/lib/python3.9/site-packages/cil/optimisation/operators/ChannelwiseOperator.py in direct(self, x, out)
     91             cury = self.op.range_geometry().allocate()
     92             for k in range(self.channels):
---> 93                 self.op.direct(x.subset(channel=k),cury)
     94                 output.fill(cury.as_array(),channel=k)
     95             return output

/srv/conda/envs/notebook/lib/python3.9/site-packages/cil/optimisation/operators/DiagonalOperator.py in direct(self, x, out)
     47             return self.diagonal * x
     48         else:
---> 49             self.diagonal.multiply(x,out=out)
     50 
     51     def adjoint(self,x, out=None):

/srv/conda/envs/notebook/lib/python3.9/site-packages/cil/framework/framework.py in multiply(self, other, *args, **kwargs)
   2465            self.__class__.__container_priority__ < other.__class__.__container_priority__:
   2466             return other.multiply(self, *args, **kwargs)
-> 2467         return self.pixel_wise_binary(numpy.multiply, other, *args, **kwargs)
   2468 
   2469     def divide(self, other, *args, **kwargs):

/srv/conda/envs/notebook/lib/python3.9/site-packages/cil/framework/framework.py in pixel_wise_binary(self, pwop, x2, *args, **kwargs)
   2419             if self.check_dimensions(out) and self.check_dimensions(x2):
   2420                 kwargs['out'] = out.as_array()
-> 2421                 pwop(self.as_array(), x2.as_array(), *args, **kwargs )
   2422                 #return type(self)(out.as_array(),
   2423                 #       deep_copy=False,

UFuncTypeError: Cannot cast ufunc 'multiply' output from dtype('float32') to dtype('bool') with casting rule 'same_kind'

Sandstone: CoR with image sharpness fails if user changes choice of slice

In the sandstone notebook the user is encouraged to try out different slice numbers
However, if they do this, the CoR later fails.

Slice selection is in cell [10]:
filename = "slice_0270_data.mat" # Slice numbers to choose from: 0270, 0540, 0810, 1080

Failure occurs in cell [37]:
'data5 = CentreOfRotationCorrector.image_sharpness(backend='astra', search_range=100, tolerance=0.1)(data4)'

We need to check all of these slice numbers and only keep the suggestions for ones that we know we can run with the ImageSharpness method

Update notebooks to showcase new features

  • Check notebooks work with CIL v23.0.0

Update notebooks to use new features of CIL:

  • CofR getters/setters
  • Partition for SPDHG
  • FBP filters
  • Circular mask for FBP reconstructions
  • iSlicer ROI
  • show1D
  • Binner/Slicer/Padder with show_geom

Finally:

  • tag CIL-Demos for v23.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.