tomographicimaging / cil-demos Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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
CIL-Demos/demos/2_Iterative/04_SPDHG.ipynb
Line 500 in affca76
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
You also define it in line
CIL-Demos/demos/2_Iterative/04_SPDHG.ipynb
Line 497 in affca76
CIL-Demos/demos/2_Iterative/04_SPDHG.ipynb
Line 500 in affca76
CIL-Demos/demos/2_Iterative/04_SPDHG.ipynb
Line 581 in affca76
Just needs a quick fix to add "prob=prob" to the calls to SPDHG.
It's not in the notebook nor in the additional info in the introduction week.
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")
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.
Hello, I want to know why CIL doesn't have ART and SART algorithem. Will the CIL have ART and SART algorithem in the future?
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!
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
What does the misc directory contain?
It is not clear and it should be clarified by a README.md
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"
A chance to list what we would like to write new notebooks on:
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
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
Also check
Notebooks working correctly with v24.0.x (master):
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
?
This repo is almost 100% manually tested.
Here an article describing a number of possible frameworks to test Jupyter notebooks.
https://www.kitware.com/how-to-raise-the-quality-of-scientific-jupyter-notebooks/
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])
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.
When running iterative algorithms we get a deprecation warning:
/tmp/ipykernel_23663/4232300540.py:7: DeprecationWarning:
run()missing
iterations``
We should update our notebooks code to prevent this warning
CIL version, latest master, testing just before v24.0.0 release
The description says that 160 angles are selected:
But when the acquisition geometry is printed, it shows there are 161 angles
In demos/3_Multichannel/01_Colour_Processing, the AxesGrid function is called with input parameter cbar_mode='None', which gives the error " 'None' is not a valid value for cbar_mode". It should be called with cbar_mode=None.
The readme suggests to install CIL version 22.2.0
I get an error on Binder when starting the notebooks.
The screenshot of the error is below
Use a conda command instead of the binder environment file
'FreeSerifBold.ttf
cannot be found from the system, use DejaVuSerif.ttf
insteadmask = ig.subset(channel=0).allocate(True,dtype=np.bool)
by mask = ig.subset(channel=0).allocate()
I think there is still some problems with the epochs and the plots.
The save to TIFF cell fails because data_name
is not defined. It's easy to spot during training but it's annoying.
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.
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.
Update sandstone + seeds to use these. Check other notebooks.
Add 'misc' folder for quick scripts showing functionality.
This is for our reference as well as users, but it's not necessarily maintained.
Check demos
Revert to boolean array #65
Default values of sigma, tau = 1/K.norm() and we need to update the text (markdown)
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'
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 use new features of CIL:
Finally:
also needs to close #54 because it's a bit out of date?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.