odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/
Mozilla Public License 2.0
375 stars 105 forks source link

odl/contrib/datasets/ct/examples/mayo_reconstruct.py reports errors #1564

Closed Hznnn closed 4 years ago

Hznnn commented 4 years ago

mayo_reconstruct.py data_folder = mayo_dir + '/Training Cases/L067/full_DICOM-CT-PD' geometry, proj_data = mayo.load_projections(data_folder, indices=slice(20000, 28000))

mayo.py spc = odl.uniform_discr([-1] 3, [1] 3, [32] * 3) ray_trafo = odl.tomo.RayTransform(spc, geometry, interp='linear')

it first throws skimage backend only supports 2d parallel, then, I installed astra but got wrong fbp result. image

if anyone has dealt with the same issue, please help asap.

Much appreciated!

adler-j commented 4 years ago

I'll need some more details to figure this out.

Hznnn commented 4 years ago

The geonmetry information is ConeFlatGeometry( nonuniform_partition( [ -3.54553619, -3.54280604, -3.54008203, ..., 18.2629014 , 18.26562538, 18.26835546] ), uniform_partition([-474.7996, -35.0311], [ 471.5781, 35.0311], (736, 64)), src_radius=597.72502, det_radius=490.59998, pitch=22.956473, offset_along_axis=260.80286 ) the projection data comes from mayo dataset.

image with no clim.

the entire code is in odl/odl/contrib/datasets/ct/examples/mayo_reconstruct.py, with no other modifications except for the data path.

By the way, whether ODL library has single slice recombination method of spiral cone beam CT

ozanoktem commented 4 years ago

By the way, whether ODL library has single slice recombination method of spiral cone beam CT

I guess @Hznnn refers to re-binning here, which in ODL would be a data-to-data mapping. Currently there is no specific re-binning operator in ODL from 3D helical to circular scanning, see related discussion in #1560

Hznnn commented 4 years ago

@ozanoktem , this idea mainly comes from “Noo F, Defrise M, Clackdoyle R and Kudo H; Phys. Med. Biol. 44:561-70, 1999,Single-slice rebinning for helical cone-beam CT." I think it can be defined as a corresponding explicit operation for data processing.

ozanoktem commented 4 years ago

@Hznnn , agree that it can be implemented in ODL as a data-to-data mapping (i.e., operation for data processing). This is merely a careful interpolation in data space (sinograms) but it is just not done because the need for this hasn't risen yet. You are most welcome to implement it in ODL and make it available to the community.

kohr-h commented 4 years ago

Regarding clim, in the latest ASTRA pre-release there was a change in how FP and BP are scaled. Perhaps FBP needs to be adapted, although the scaling should be handled automatically.

kohr-h commented 4 years ago

@Hznnn What ASTRA version are you using?

Hznnn commented 4 years ago

The version of astra-toobox I use is 1.9.9. How should I adjust FBP to get the proper value? Can you give me some suggestions?

kohr-h commented 4 years ago

The version of astra-toobox I use is 1.9.9. How should I adjust FBP to get the proper value? Can you give me some suggestions?

Thanks. No, you shouldn't have to do anything. We may need to internally adapt our FBP code. Let me check.

Hznnn commented 4 years ago

@ozanoktem When I implement it in ODL, I will be happy to provide it to the community.

Hznnn commented 4 years ago

@kohr-h OK, I will wait for your message.

kohr-h commented 4 years ago

I don't have a GPU at the moment, so I can only test 2D examples. The FBP examples in our core library seem to have the correct scaling, at least the 2D ones. Could you run the 3D cone beam example(s) @Hznnn? If those have the right scaling, too, then we need to look at the Mayo specific code. Right scaling would mean "about the same as the phantom".

kohr-h commented 4 years ago

What is the range of values in the reference reconstruction? Is it in the window around 1 as used in the Mayo example?

Hznnn commented 4 years ago

It is 3D. The reference reconstruction : (-0.024, 3.34) The fbp reconstruction: (-1.02577e+07,4.46533e+07)

adler-j commented 4 years ago

I don't have a GPU at the moment, so I can only test 2D examples

You can use colab to get a GPU: https://github.com/odlgroup/odl/issues/1489

Edit: Helical example here https://colab.research.google.com/drive/1wsHNyuK0GAM8sh9kBTzwh8t6Kuivj1KW?usp=sharing

Hznnn commented 4 years ago

@kohr-h When I run a 2D instance, there is still a large deviation in the value range. Such as odl/examples/tomo/filtered_backprojection_cone_2d_short_scan.py image And the odl.tomo.FanBeamGeometry in the example does not exist, is it replaced by odl.tomo.geometry.conebeam.FanFlatGeometry

adler-j commented 4 years ago

Could you try installing the dev version of astra conda install -c astra-toolbox/label/dev astra-toolbox? It seems to work nicely in colab for me.

aringh commented 4 years ago

Hi @Hznnn! Which version of odl are you using? Did you install a relase or did you install the development version directly from github?

@adler-j and @kohr-h: are there changes in astra that breaks with the lastest relase (0.7) of odl?

Hznnn commented 4 years ago

@aringh The version of odl is odl (0.7.0). I use pip for installation.

adler-j commented 4 years ago

Could you run pip install https://github.com/odlgroup/odl/archive/master.zip to get the latest version?

@aringh I'm quite sure there are such changes, we really need a new pip release.

Hznnn commented 4 years ago

I solved my problem by installing odl1.1.0. I tried to install through pip install https://github.com/odlgroup/odl/archive/master.zip, but failed, and I completed the installation by running the following code

aringh commented 4 years ago

Good that it solved the problem. Then I will close this issue.

It was actually the missing FanBeamGeometry that made me suspect that this might be the case. And yes, we should try to get a new release out - we also discussed it in relation to removing python 2 support #1555.