CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logic failure when disabling Wang weights

twhitbread opened this issue · comments

Expected Behavior

In TIGRE\Python\tigre\algorithms\single_pass_algorithms.py, code was recently added (f0e9100) to disable Wang weights if there is no detector offset. This should be able to handle fixed offsets and per-frame offsets.

Actual Behavior

For per-frame offsets (i.e. geo.offDetector is a 2xn array), it throws an error:

The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I would recommend using np.any(geo.offDetector) or geo.offDetector.any()

Code to reproduce the problem (If applicable)

import numpy as np
import tigre
from tigre.utilities.Ax import Ax
from tigre.utilities.sample_loader import load_head_phantom

geo = tigre.geometry(mode='cone', default=True)

head = load_head_phantom(geo.nVoxel)
tigre.plotimg(head, slice=128)

angles = np.linspace(0, 2*np.pi, dtype=np.float32)
projections = Ax(head, geo, angles, 'interpolated')

imgFDK = tigre.algorithms.single_pass_algorithms.FDK(projections, geo, angles)

Specifications

  • Python version: 3.8
  • OS: Windows: Windows 10

Thanks @twhitbread , indeed a bug that I intreoduced by a too quick update. I'll fix :) missed the np.!