llnl / llnl/LEAP

How to set angle for Sparse-view Fanbeam CT simulation

Open
#149 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cuda
Stars
249
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Hello, Kyle,
I am simulating a sparse-view fan-beam CT image. Given an clear CT image, I first do forward to get the sinogram and then use FBP to get its reconstructed image. Here is the code:

```
import sys
import os
import time
import numpy as np
from leapctype import *
import matplotlib.pyplot as plt
leapct = tomographicModels()
leapct.about()

numCols = 821
numAngles = 150 # 984 views for 360 degree, 150 views for 55 degree
print(numAngles)
start_angle = 0
end_angle = start_angle + 360
angles = np.linspace(start_angle, end_angle, numAngles, dtype=np.float32)

pixelSizex = 1.09
pixelSizey = 0.8224 * 1097 / 821

numZ = 1
numY = 256
numX = 256

numRows = 1
numCols, pixelSize, pixelSize, 0.5*(numRows-1), 0.5*(numCols-1), leapct.setAngleArray(numAngles, 360.0), 1100, 1400)
leapct.set_fanbeam(numAngles, numRows, numCols, pixelSizex, pixelSizey, 0.5*(numRows-1), 0.5*(numCols-1), angles, 625.61, 1097)
leapct.set_default_volume()

leapct.set_volume(numX, numY, numZ, voxelWidth=None, voxelHeight=None, offsetX=None, offsetY=None, offsetZ=None)
leapct.print_parameters()

g = leapct.allocateProjections() # shape is numAngles, numRows, numCols
f = leapct.allocateVolume()

img = np.load('xcat_test.npy')
f = 255*img[None,:,:].astype(np.float32)

startTime = time.time()
leapct.project(g,f)
print('Forward Projection Elapsed Time: ' + str(time.time()-startTime))

plt
plt.imshow(np.squeeze(g), cmap='gray')
plt.savefig('sinogram')

f[:] = 0.0
startTime = time.time()
leapct.FBP(g,f)
print('Reconstruction Elapsed Time: ' + str(time.time()-startTime))

plt.imshow(np.squeeze(f[f.shape[0]//2,:,:]), cmap='gray')

f.shape
```

The total number of projections is 984 and I want to set the angle start 0 to 360 degree. But the fbp.png is much clearer than what I expected.
I feel confused about why I did not see a parameter that I should set the total number of projections
Looking forward to your reply.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Python setup around numAngles, the angles array, setAngleArray, and set_fanbeam in the issue's example. Check the project's documentation or examples for how the total number of views is specified and reproduce the 150-view versus 984-view reconstruction. Done means the angle range and projection count are clearly documented or the example uses the intended configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.