Last active
March 20, 2018 16:37
-
-
Save g7uvw/1f5524b396d3b0c88c398af30f471235 to your computer and use it in GitHub Desktop.
Not quite working tomo recon from images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from skimage.io import imread | |
from skimage.transform import radon, iradon | |
from scipy.ndimage import zoom | |
basename = "projection_" | |
extention = ".jpeg" | |
plt.figure(figsize=(15, 15.5)) | |
plt.subplot(221) | |
projections = 0 | |
cs_array = [[]] | |
for x in range(0, 50): | |
name = basename + str(x).zfill(4) + extention | |
print name | |
image = imread(name, as_grey=True) | |
image_data = np.asarray(image) | |
cs_array[x] = image_data[120] | |
#plt.plot(projections); | |
cs = Image.fromarray(cs_array) | |
plt.imshow(cs, cmap=plt.cm.Greys_r) | |
# gives this error | |
# File "tomo.py", line 30, in <module> | |
# cs_array[x] = image_data[120] | |
#IndexError: list assignment index out of range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe print x at line 22? Maybe adjust the loop for one image only and read the image data into another type of variable to see if it’s a problem with passing to the array?