Skip to content

Commit

Permalink
Fixed reconstruction initialization issue for CUDA
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewHerzing committed Jun 28, 2024
1 parent 49a5e3a commit 2a411a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tomotools/recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def run(stack, method, niterations=20, constrain=None, thresh=0, cuda=None, thic

for i in tqdm.tqdm(range(0, nx), disable=not (show_progressbar)):
astra.data2d.store(sino_id, stack.data[:, :, i])
astra.data2d.store(rec_id, np.zeros([thickness, ny]))
astra.algorithm.run(alg, niterations)
rec[i, :, :] = astra.data2d.get(rec_id)
elif method.lower() == "sirt":
Expand All @@ -231,8 +232,10 @@ def run(stack, method, niterations=20, constrain=None, thresh=0, cuda=None, thic

for i in tqdm.tqdm(range(0, nx), disable=not (show_progressbar)):
astra.data2d.store(sino_id, stack.data[:, :, i])
astra.data2d.store(rec_id, np.zeros([thickness, ny]))
astra.algorithm.run(alg, niterations)
rec[i, :, :] = astra.data2d.get(rec_id)

elif method.lower() == "sart":
logger.info(
"Reconstructing with CUDA-accelerated SART algorithm (%s iterations)"
Expand All @@ -249,8 +252,10 @@ def run(stack, method, niterations=20, constrain=None, thresh=0, cuda=None, thic

for i in tqdm.tqdm(range(0, nx), disable=not (show_progressbar)):
astra.data2d.store(sino_id, stack.data[:, :, i])
astra.data2d.store(rec_id, np.zeros([thickness, ny]))
astra.algorithm.run(alg, niterations)
rec[i, :, :] = astra.data2d.get(rec_id)

elif method.lower() == "dart":
thresholds = [(gray_levels[i] + gray_levels[i + 1]) // 2 for i in range(len(gray_levels) - 1)]
mask = np.ones([thickness, ny])
Expand Down

0 comments on commit 2a411a1

Please sign in to comment.