Closed shaghayegh1376 closed 1 year ago
Thanks for the issue. Coudl you please show the code you have in the jupyter notebook?
On Tue, Aug 16, 2022 at 5:13 PM Biguri @.***> wrote:
Thanks for the issue. Coudl you please show the code you have in the jupyter notebook?
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1216360748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYD4MB3OYGGYHMR47JFPXO3VZNLTVANCNFSM56U5VVDQ . You are receiving this because you authored the thread.Message ID: @.***>
#
get_ipython().run_line_magic('matplotlib', 'notebook') import matplotlib.pyplot as pl import matplotlib import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import scipy import scipy.sparse.linalg from tigre.utilities.Ax import Ax from tigre.utilities import sample_loader from tigre.utilities import sl3d
geo = tigre.geometry_default(high_resolution=False)
angles = np.linspace(0, 2 * np.pi, 50)
from IPython.display import Image head = sample_loader.load_head_phantom(geo.nVoxel)
head
projections = tigre.Ax(head, geo, angles)
#
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))
tigre.plotproj( projections, angles)
tigre.plotproj(projections - noise_projections)
#
get_ipython().run_line_magic('matplotlib', 'notebook') import matplotlib import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import tigre.algorithms as algs
geo = tigre.geometry_default(high_resolution=False)
angles = np.linspace(0, 2 * np.pi, 100)
head = sample_loader.load_head_phantom(geo.nVoxel) head
projections = tigre.Ax(head, geo, angles)
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))
imgFDK = algs.fdk(noise_projections, geo, angles) niter = 50 imgOSSART = algs.ossart(noise_projections, geo, angles, 50)
#
#
step = 2
colormap = "viridis" colormap = "plasma" colormap = "gray"
clims = [0, 200]
giffilename = "demo5projections.gif"
slice = 5
tigre.plotproj( noise_projections, angles, step=step, colormap=colormap, clims=clims, savegif=giffilename ) # not using 'Step'
noise = np.abs(noise_projections - projections) # abs is what we are interested in plotting tigre.plotproj( noise, angles, clims=[0, 2] )
#
# dimension = "Z"
step = 2
colormap = "plasma" colormap = "magma" colormap = "gray" colormap = "viridis"
clims = [0, 1]
giffilename = "demo5image.gif"
slice = 64
tigre.plotimg(imgFDK, dim=dimension, step=step, clims=clims, colormap=colormap, savegif=giffilename)
tigre.plotimg(np.concatenate([head, imgFDK, imgOSSART], axis=1), dim="z")
tigre.plotImg(np.concatenate([np.abs(head - imgFDK), np.abs(head - imgOSSART)]), dim="z")
projections
# #
get_ipython().run_line_magic('matplotlib', 'notebook') import matplotlib import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import tigre.algorithms as algs
geo = tigre.geometry_default(high_resolution=False)
angles = np.linspace(0, 2 * np.pi, 100)
head = sample_loader.load_head_phantom(geo.nVoxel) head
projections = tigre.Ax(head, geo, angles)
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))
imgFDK = algs.fdk(noise_projections, geo, angles)
niter = 50 imgOSSART = algs.ossart(noise_projections, geo, angles, niter)
tigre.plotimg( np.concatenate([imgFDK, imgOSSART], axis=1), dim="z" )
import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import tigre.algorithms as algs from matplotlib import pyplot as plt from tigre.utilities.im3Dnorm import im3DNORM
geo = tigre.geometry_default(high_resolution=False)
angles = np.linspace(0, 2 * np.pi, 100)
head = sample_loader.load_head_phantom(geo.nVoxel)
projections = tigre.Ax(head, geo, angles)
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))
imgOSSART = algs.ossart(noise_projections, geo, angles, 10)
#
#
#
epsilon = ( im3DNORM(tigre.Ax(algs.fdk(noise_projections, geo, angles), geo, angles) - noise_projections, 2)
alpha = 0.002
ng = 25
#
# lmbda = 1 lambdared = 0.9999 # you generally want 1
alpha_red = 0.95
ratio = 0.94
verb = True
imgASDPOCS = algs.asd_pocs( noise_projections, geo, angles, 10, # these are very important tviter=ng, maxl2err=epsilon, alpha=alpha, # less important. lmbda=lmbda, lmbda_red=lambdared, rmax=ratio, verbose=verb, )
#
#
imgOSASDPOCS = algs.os_asd_pocs( noise_projections, geo, angles, 10, # these are very important tviter=ng, maxl2err=epsilon, alpha=alpha, # less important. lmbda=lmbda, lmbda_red=lambdared, rmax=ratio, verbose=verb,
blocksize=10,
)
#
imgAWASDPOCS = algs.awasd_pocs( noise_projections, geo, angles, 10, # these are very important tviter=ng, maxl2err=epsilon, alpha=alpha, # less important. lmbda=lmbda, lmbda_red=lambdared, rmax=ratio, verbose=verb, # AwASD_POCS params delta=np.array([-0.005]), )
tigre.plotimg( np.concatenate([imgAWASDPOCS, imgOSASDPOCS, imgASDPOCS, imgOSSART], axis=1), dim="z", step=2 )
@shaghayegh1376 please can you shorten this to the minimal example that reproduces the case? Reduce the code as much as possible
yes its the simplest example :
On Tue, Aug 16, 2022 at 5:19 PM Biguri @.***> wrote:
@shaghayegh1376 https://github.com/shaghayegh1376 please can you shorten this to the minimal example that reproduces the case? Reduce the code as much as possible
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1216374136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYD4MB5FYQXYMYL3BCUWGI3VZNMKDANCNFSM56U5VVDQ . You are receiving this because you were mentioned.Message ID: @.***>
#
get_ipython().run_line_magic('matplotlib', 'notebook') import matplotlib.pyplot as pl import matplotlib import tigre import numpy as np from tigre.utilities import sample_loader from tigre.utilities import CTnoise import scipy import scipy.sparse.linalg from tigre.utilities.Ax import Ax from tigre.utilities import sample_loader from tigre.utilities import sl3d
geo = tigre.geometry_default(high_resolution=False)
angles = np.linspace(0, 2 * np.pi, 50)
from IPython.display import Image head = sample_loader.load_head_phantom(geo.nVoxel)
head
projections = tigre.Ax(head, geo, angles)
#
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))
tigre.plotproj( projections, angles)
tigre.plotproj(projections - noise_projections)
I will have a look, but meanwhile I suggest trying it in a normal python enviroment and not in jupyter if you want the plots.
I myself dont have it installed and its not officially supported, so I will try to test this but can't promise anything.
Thank you for your response And i will try it with normal python environment
On Tue, Aug 16, 2022 at 17:24 Biguri @.***> wrote:
I will have a look, but meanwhile I suggest trying it in a normal python enviroment and not in jupyter if you want the plots.
I myself dont have it installed and its not officially supported, so I will try to test this but can't promise anything.
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1216385145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYD4MB3GJDLBP4KWZ4NRT4LVZNM35ANCNFSM56U5VVDQ . You are receiving this because you were mentioned.Message ID: @.***>
Dear mr Biguri
I have problem with implementing of tigre toolbox in environment except jupyter notebook. How can i write code in other environment for example visual studio code
On Tue, Aug 16, 2022 at 17:29 Shaghayegh Afshari < @.***> wrote:
Thank you for your response And i will try it with normal python environment
On Tue, Aug 16, 2022 at 17:24 Biguri @.***> wrote:
I will have a look, but meanwhile I suggest trying it in a normal python enviroment and not in jupyter if you want the plots.
I myself dont have it installed and its not officially supported, so I will try to test this but can't promise anything.
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1216385145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYD4MB3GJDLBP4KWZ4NRT4LVZNM35ANCNFSM56U5VVDQ . You are receiving this because you were mentioned.Message ID: @.***>
@shaghayegh1376 you will need to be more specific. There are tutorials in the installation page for python envoroments, have you looked at that? what are the problems you are having?
You don't need to "write code" to make TIGRE work in VSC (note that VSC is not an "enviroment").
Dear Mr. Biguri as you said before to use originally python environment instead of anaconda ( jupyter notebook and spyder) I followed the step as it said in the tigre installment and ran steps in cmd and it installed successfully. but when i run demo 3 , it would be the result : [image: image.png]
On Mon, Aug 29, 2022 at 7:27 PM Biguri @.***> wrote:
@shaghayegh1376 https://github.com/shaghayegh1376 you will need to be more specific. There are tutorials in the installation page for python envoroments, have you looked at that? what are the problems you are having?
You don't need to "write code" to make TIGRE work in VSC (note that VSC is not an "enviroment").
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1230157212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYD4MB64CBCGPGQQPWDN77LV3SNCTANCNFSM56U5VVDQ . You are receiving this because you were mentioned.Message ID: @.***>
@shaghayegh1376 I can't see the image, please post it in the github issue.
@shaghayegh1376 please next time share text as text, not as an image, it is quite unhelpful as an image!
I would suggest trying an older version of python, perhaps 3.7 or so. I had similar issues in the past with 3.9, but I thought we solved this (are you running a recent version of TIGRE??). If you try python 3.7 and it works, let me know.
it was with python 3.10 , let me check the 3.7 version
Traceback (most recent call last):
File "C:/Users/shaghayegh/Desktop/test.py", line 1, in
this was the result with python 3.7
Thats just that you installed it wrong in python 3.7.
but i follow the steps like tutorial.
Sorry, you will need to be more specific. Unfortunately as it currently stands I have no information to help you, I only know it doesn't work for you.
On Thu, 1 Sept 2022, 07:13 shaghayegh1376, @.***> wrote:
but i follow the steps like tutorial.
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1233791026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2OENBG54SL6H6SAFHLNELV4BCRTANCNFSM56U5VVDQ . You are receiving this because you commented.Message ID: @.***>
ok, another question is that: can we replace this function: tigre.plotimg(np.concatenate([imgFDK, imgOSSART], axis=1), dim="z") with other library like plt.show() or .imshow() and how i mean , what alternative to tigre.plotting can i use to display the result.
Absolutely. As you can see, Tigre uses np.arrays to store the data. Therefore you can use any plotting technique to plot np.arrays. In fact that is what tigre.plotimg does, just uses plt.imshow in a nice way. You are more than welcome to use your own functions!
Ander
On Fri, 2 Sept 2022, 03:45 shaghayegh1376, @.***> wrote:
ok, another question is that: can we replace this function: tigre.plotimg(np.concatenate([imgFDK, imgOSSART], axis=1), dim="z") with other library like plt.show() or .imshow() and how i mean , what alternative to tigre.plotting can i use to display the result.
— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/issues/393#issuecomment-1235007399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2OENENZNFTJOOIKWYYPMTV4FS4VANCNFSM56U5VVDQ . You are receiving this because you commented.Message ID: @.***>
@shaghayegh1376 please next time share text as text, not as an image, it is quite unhelpful as an image!
I would suggest trying an older version of python, perhaps 3.7 or so. I had similar issues in the past with 3.9, but I thought we solved this (are you running a recent version of TIGRE??). If you try python 3.7 and it works, let me know.
This importing error is already fixed by #387 Judging by the line number in the error message, this fix is not applied to the version you're using. Try with the latest version of TIGRE. It should work on python 3.10.
hello when i rewrite demos in jupyter notebook , in some demos like number 3/4/7/... , in plotting part , code run without error but for result it just show the blank , but in other demo number 5 it shows the result as image or gif.
i use python 3.8 anaconda 3 cuda 11.7 nvidia getforce rtx 3050