odl icon indicating copy to clipboard operation
odl copied to clipboard

Dose ConeBeamGeometry support helical geometry with cylindrical detector?

Open wangwei-cmd opened this issue 3 years ago • 10 comments

I want to create a helical geometry with cylindrical detector. Here is my code:

reco_space = odl.uniform_discr(min_pt=[-63.5, -63.5, 0], max_pt=[63.5, 63.5, 14], shape=[128, 128, 15], dtype='float32') angle_partition = odl.uniform_partition(0, 2 * 360 * np.pi/180, 721) detector_partition = odl.uniform_partition([-0.4796, -6], [0.4796, 6], [219, 13]) geometry = odl.tomo.ConeBeamGeometry(angle_partition, detector_partition, src_radius=200, det_radius=200, det_curvature_radius=(400, None), pitch=2 * 2 * np.pi) ray_trafo = odl.tomo.RayTransform(reco_space, geometry, impl='astra_cuda')

But pycharm raises an error: NotImplementedError: unknown ASTRA geometry type ConeBeamGeometry( uniform_partition(0.0, 12.57, 721), uniform_partition([-0.4796, -6. ], [ 0.4796, 6. ], (219, 13)), src_radius=200.0, det_radius=200.0, pitch=12.566371 )

wangwei-cmd avatar Apr 23 '21 03:04 wangwei-cmd

Hi @wangwei-cmd Which version of odl do you have installed?

The latest release is rather old, and many features are therefore not available in it. You can install it directly from git instead; see the documentation for instructions on who to do it.

aringh avatar Apr 23 '21 04:04 aringh

Hello, @aringh I install odl from git.

wangwei-cmd avatar Apr 23 '21 05:04 wangwei-cmd

Ok. I ran the code you posted and did not get an error. As a reference, I just pulled the latest commits from the odl repository, and I am using astra-toolbox version 1.8.3.

Do you have multiple python environments? If so, could you run odl.__version__ to double-check that it is indeed running the correct version.

aringh avatar Apr 23 '21 05:04 aringh

Thank you. @aringh. My odl.version is '1.0.0.dev0'. After careful checking, I found that I didn't provide the codes causing the error. I'm sorry for this mistake. The following is my complete codes:

import numpy as np import odl

reco_space = odl.uniform_discr(min_pt=[-63.5, -63.5, 0], max_pt=[63.5, 63.5, 14], shape=[128, 128, 15], dtype='float32') angle_partition = odl.uniform_partition(0, 2 * 360 * np.pi / 180, 721) detector_partition = odl.uniform_partition([-0.4796, -6], [0.4796, 6], [219, 13]) geometry = odl.tomo.ConeBeamGeometry(angle_partition, detector_partition, src_radius=200, det_radius=200, det_curvature_radius=(400, None), pitch=2 * 2 * np.pi) ray_trafo = odl.tomo.RayTransform(reco_space, geometry, impl='astra_cuda') phantom = odl.phantom.shepp_logan(reco_space, modified=True) proj_data = ray_trafo(phantom)

The last command 'proj_data = ray_trafo(phantom)' causes the error : NotImplementedError: unknown ASTRA geometry type ConeBeamGeometry( uniform_partition(0.0, 12.57, 721), uniform_partition([-0.4796, -6. ], [ 0.4796, 6. ], (219, 13)), src_radius=200.0, det_radius=200.0, pitch=12.566371 )

wangwei-cmd avatar Apr 23 '21 06:04 wangwei-cmd

Indeed, checking the code it seems like only flat detectors are implemented for cone beam with Astra. However, it was a long time ago since I worked with this. Could @kohr-h, @adler-j, @JevgenijaAksjonova, or @ozanoktem just confirm if this is correct?

aringh avatar Apr 23 '21 07:04 aringh

Support in ODL for representing data acquired on curved detectors was added with the approval of pull request #1478. There is however currently no freely available back-end that can perform projection/backprojection natively in such a configuration. Some of our projects use proprietary back-ends provided by industrial partners for this purpose.

One option is to define a data-to-data mapping that performs interpolation in order to transform tomographic data acquired on curved detectors to corresponding data on flat detectors, see issue #1560 and pull request #1578.

In a collaboration with developers of ASTRA at CWI and University of Cambridge, we are planning preparing for adding native support in ASTRA for tomographic cone-beam data with curved detectors. But that will most likely not deliver any usable solution before late spring 2021.

ozanoktem avatar Apr 23 '21 07:04 ozanoktem

I am interested to know if you have any updates on this matter? I still get similar errors which I guess the detectors with curvature are not supported yet, am I right?

Mojzaar avatar Jan 25 '22 21:01 Mojzaar

ODL offers data structures to represent tomographic data collected using cylindrical and spherical detectors. However, if you want to avoid interpolation in data space, working with such data requires a back-end that can handle curved detectors. Now, the back-end is not part of ODL itself, so your queries about support for curved detectors are better directed to the developers of the back-end.

The current status is that there are proprietary back-end for tomographic forward and back-projection that supports curved detectors, but none that is open source. As already indicated, there is ongoing work in implementing support for cylindrical detectors in ASTRA. I expect that this will be in place this year.

ozanoktem avatar Jan 25 '22 21:01 ozanoktem

Thank you for responding so quickly. So, if I want to deal with curved detectors, I should use the ODL function to transfer data to data representation with the flat detector, and then utilize flat detectors for the rest of the implementations, am I correct?

If that's the case, could you please tell me the functions I may use to do so?

Mojzaar avatar Jan 25 '22 21:01 Mojzaar

Unless you get hold of a back-end that can handle curved detectors (there is currently none that is open source), you need to map tomographic data acquired on a curved detector to one on a flat detector by some interpolation scheme. I am not sure if there are examples of this in the "examples" directory, but I know that @JevgenijaAksjonova has done this.

ozanoktem avatar Jan 26 '22 12:01 ozanoktem