dkazanc / TomoPhantom

Software to generate 2D/3D/4D analytical phantoms and their Radon transforms (parallel beam) for image processing
https://dkazanc.github.io/TomoPhantom/
Apache License 2.0
116 stars 53 forks source link

can't create cylinder objects #96

Closed oachk closed 3 years ago

oachk commented 3 years ago

Hi! I'm trying to make a phantom with several cylinders, but somehow they just don't show up, even though I don't get an error message. I've also noticed that the name in the Objects3D class is apparently not elliptical_cylinder (as suggested in the model examples) but rather ELLIPCYLINDER?

Here's a snippet of my code:

`import sys import os sys.path.append(os.path.dirname(os.path.realpath(file))+"\Functions") import helpers_data import numpy as np import matplotlib.pyplot as plt from tomophantom import TomoP3D from tomophantom.TomoP3D import Objects3D import tomophantom

N3D_size = 128*5 obj3D_1 = {'Obj': Objects3D.ELLIPCYLINDER, 'C0' : 1, 'x0' : 0, 'y0' : 0, 'z0' : 0, 'a' : 0.5, 'b' : 0.5, 'c' : 1, 'phi1' : 0}

Object3D = TomoP3D.Object(N3D_size, obj3D_1)

print ("Building 3D object using TomoPhantom software")

sliceSel = int(0.5*N3D_size)

plt.figure() plt.subplot(131) plt.imshow(Object3D[sliceSel,:,:],vmin=0, vmax=1) plt.title('3D Object, axial view')

plt.subplot(132) plt.imshow(Object3D[:,sliceSel,:],vmin=0, vmax=1) plt.title('3D Object, coronal view')

plt.subplot(133) plt.imshow(Object3D[:,:,sliceSel],vmin=0, vmax=1) plt.title('3D Object, sagittal view') plt.show()`

dkazanc commented 3 years ago

many thanks for reporting this @oachk since it is a bug. It has been fixed now and you can get the fixed version with conda install -c ccpi/label/dev tomophantom or install it from the source.

Philipstj commented 3 years ago

Hello,

Forgot to mention that we have an additional problem, namely that we are running on the latest 1.4 windows version, meaning that updating does not work. I have been trying to access the source code in the site-packages to try and manually change the bug. However, I do not know how to manage the file type "TomoP3D.cp36-win_amd64.pyd" assuming that this the correct file.

I would therefore like to ask, if it would be possible to get the windows version updated with this bug fix as well, or how one would go about it to solve the problem manually.

Best regards, Philip

dkazanc commented 3 years ago

@Philipstj can you tell me which version of Python and numpy you're using? We're currently having some issues with Windows builds but I can build it for you.

Philipstj commented 3 years ago

Yes, no problem the Python version is 3.6.12 and 1.14.6 for NumPy.

dkazanc commented 3 years ago

Install the latest Windows version using this conda install -c dkazanc tomophantom In fact you might want to use that in future since it gets updated more frequently for Windows. We might add this info in the Readme.

Philipstj commented 3 years ago

Many thanks for the help, and sorry for the inconvenience caused.

dkazanc commented 3 years ago

@Philipstj no worries at all, thanks for using the package ;)