data-exchange / dxchange

data exchange supporting tomopy
http://dxchange.readthedocs.io
Other
34 stars 42 forks source link

Alignment module not working #67

Closed tr0033 closed 5 years ago

tr0033 commented 6 years ago

I am having trouble setting up the alignment module. (tomopy.prep.alignment)

This is my code data= tomopy.prep.alignment.align_seq(data, theta, fdir='.', iters=10, pad=(0, 0), blur=True, save=False, debug=True)

The error I'm getting is: AttributeError Traceback (most recent call last)

in () ----> 1 data= tomopy.prep.alignment.align_seq(data, theta, fdir='.', iters=10, pad=(0, 0), blur=True, save=False, debug=True) AttributeError: 'module' object has no attribute 'alignment' I updated the tomopy version to the latest and it gave me the same error. Thoughts/ Suggestions?
dgursoy commented 6 years ago

Have you updated through conda or through Github/master?

tr0033 commented 6 years ago

I updated it through conda, I ran this -> conda update -c conda-forge tomopy through the linux terminal.

decarlof commented 6 years ago

My mistake I am updating this:

the current help(tomopy.prep) on the conda forge install v 1.1.2 reports:

PACKAGE CONTENTS alignment normalize phase stripe

and the tomopy.prep.alignment.align_seq works. Please check the version of tomopy that you are using with

$ conda list | grep tomopy

tr0033 commented 6 years ago

Thank you I think I got the alignment module to work when I did a git clone repository. However, I notice that the module takes incredibly a long time to run. Do you have any suggestions that could mitigate this issue. I'm doing the alignment procedure right before the center finding approach in the reconstruction of nano-scale tomographic data.

dgursoy commented 6 years ago

It uses an iterative routine and is normally slow for large data sizes. It is also not optimized for speed. I would try downsampling the projection images and run the algorithm to improve compute times. You can then translate the original projection data afterwards using these alignment values.

tr0033 commented 6 years ago

Thanks you!

jdgelb commented 5 years ago

Apologies in advance for commenting on a closed post, but in case anybody else is looking for speed:

If you have a GPU in your workstation, you can "hack" the align_seq module to use the ASTRA reconstructor, where you can run SIRT on the GPU. To do this, comment out the line that says: rec = recon(prj, ang, center=center, algorithm=algorithm) and replace it with the equivalent call to astra:

options = {'proj_type':'cuda', 'method':'SIRT_CUDA', 'num_iter':100}
rec = recon(prj, ang, center=center, algorithm=tomopy.astra, options=options, ncore=1)

(make sure to import astra before the start of the loop, since it isn't already referenced... and of course, make sure you have astra-toolbox in the first place, available via conda) I have found that many datasets need quite a lot of iterations of SIRT to get a "good enough" reprojection, so CUDA is pretty handy in this case. Now, on to my wish list: anybody want to try their hand at hacking the projector to use CUDA too? :-D