Skip to content

Commit

Permalink
Merge pull request tomopy#305 from decarlof/master
Browse files Browse the repository at this point in the history
added filter choice in write_center
  • Loading branch information
dgursoy committed Dec 8, 2017
2 parents 058e5ce + 8e28b3d commit 4b1c34d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 4 deletions.
3 changes: 2 additions & 1 deletion test/test_recon/test_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def test_write_center(self):
write_center(
read_file('proj.npy'),
read_file('angle.npy'),
dpath, cen_range=cen_range)
dpath, cen_range=cen_range,
algorithm='gridrec', filter_name='shepp')
for m in range(cen.size):
assert_equals(
os.path.isfile(
Expand Down
66 changes: 63 additions & 3 deletions tomopy/recon/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def _find_center_cost(
center = np.array(center, dtype='float32')
rec = recon(
tomo_ind, theta, center,
sinogram_order=sinogram_order, algorithm='gridrec')
sinogram_order=sinogram_order,
algorithm='gridrec')

if mask is True:
rec = circ_mask(rec, axis=0)
Expand Down Expand Up @@ -386,7 +387,7 @@ def find_center_pc(proj1, proj2, tol=0.5):

def write_center(
tomo, theta, dpath='tmp/center', cen_range=None, ind=None,
mask=False, ratio=1., sinogram_order=False):
mask=False, ratio=1., sinogram_order=False, algorithm='gridrec', filter_name='parzen'):
"""
Save images reconstructed with a range of rotation centers.
Expand Down Expand Up @@ -416,6 +417,64 @@ def write_center(
sinogram_order: bool, optional
Determins whether data is a stack of sinograms (True, y-axis first axis)
or a stack of radiographs (False, theta first axis).
algorithm : {str, function}
One of the following string values.
'art'
Algebraic reconstruction technique :cite:`Kak:98`.
'bart'
Block algebraic reconstruction technique.
'fbp'
Filtered back-projection algorithm.
'gridrec'
Fourier grid reconstruction algorithm :cite:`Dowd:99`,
:cite:`Rivers:06`.
'mlem'
Maximum-likelihood expectation maximization algorithm
:cite:`Dempster:77`.
'osem'
Ordered-subset expectation maximization algorithm
:cite:`Hudson:94`.
'ospml_hybrid'
Ordered-subset penalized maximum likelihood algorithm with
weighted linear and quadratic penalties.
'ospml_quad'
Ordered-subset penalized maximum likelihood algorithm with
quadratic penalties.
'pml_hybrid'
Penalized maximum likelihood algorithm with weighted linear
and quadratic penalties :cite:`Chang:04`.
'pml_quad'
Penalized maximum likelihood algorithm with quadratic penalty.
'sirt'
Simultaneous algebraic reconstruction technique.
filter_name : str, optional
Name of the filter for analytic reconstruction.
'none'
No filter.
'shepp'
Shepp-Logan filter (default).
'cosine'
Cosine filter.
'hann'
Cosine filter.
'hamming'
Hamming filter.
'ramlak'
Ram-Lak filter.
'parzen'
Parzen filter.
'butterworth'
Butterworth filter.
'custom'
A numpy array of size `next_power_of_2(num_detector_columns)/2`
specifying a custom filter in Fourier domain. The first element
of the filter should be the zero-frequency component.
'custom2d'
A numpy array of size `num_projections*next_power_of_2(num_detector_columns)/2`
specifying a custom angle-dependent filter in Fourier domain. The first element
of each filter should be the zero-frequency component.
"""
tomo = dtype.as_float32(tomo)
theta = dtype.as_float32(theta)
Expand Down Expand Up @@ -444,7 +503,8 @@ def write_center(
theta,
center=center,
sinogram_order=True,
algorithm='gridrec',
algorithm=algorithm,
filter_name=filter_name,
nchunk=1)

# Apply circular mask.
Expand Down

0 comments on commit 4b1c34d

Please sign in to comment.