1

I want to create an array of columns for 360 different images for a 256x256 images. From each of those columns, I want to create sinograms in order to stack them up and create a back projection. I am currently stuck at this part:

imagestack = [image for image in os.listdir() if image.startswith("image")]
images = [plt.imread(image) for image in imagestack] #reading in the images in group1 using plt.imread

newf = []
for i in range(len(images)):
    imagenew = np.zeros(len(images))
    imagenew = ((images[i][:,0:1]))
    newf.append(imagenew)
        
plt.figure()
plt.imshow(newf, cmap='Greys')
plt.show()

#rotation= []
#for i in range(len(images)):
    #degrees = np.linspace(0,359,359)
    #rotated_img = np.zeros(len(images))
    #rotated_img = ndimage.rotate(newf[i:i+1],i)
    #rotation.append(rotated_img)
    
#plt.figure()
#plt.imshow(rotation)
#plt.show()

This is all I have so far, and the parts that are hashtagged just do not seem to work at all. I want to perform the newf list ode above not just for the 0:1 column, but for every i:i+1 column until 256. Unfortunately, I do not know how I would do this.

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • Your current code (also commented one) does not create a sinogram. Is that what you are strugging with? there is a lot of open source libraries out there that make singorams for you. If you are doing just parallel beam toy experiments, then your code is almost correct, except you are not integrating the image after each rotation. – Ander Biguri Jan 26 '23 at 15:35

0 Answers0