Skip to content

ENH: Add parallel_beam_geometry, closes #711#775

Merged
adler-j merged 5 commits intomasterfrom
issue-711__default_parallel_geometry
Jan 3, 2017
Merged

ENH: Add parallel_beam_geometry, closes #711#775
adler-j merged 5 commits intomasterfrom
issue-711__default_parallel_geometry

Conversation

@adler-j
Copy link
Member

@adler-j adler-j commented Dec 20, 2016

Adds a simple utility to create parallel beam geometries. Useful for testing and such cases where you don't really care about what the geometry is but simply "want it to work".

Copy link
Member

@kohr-h kohr-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor points, and having a reference would be nice.


Returns
-------
geometry : ParallelGeometry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`ParallelGeometry`

-------
geometry : ParallelGeometry
If ``space`` is 2d, returns a ``Parallel2dGeometry``.
If ``space`` is 3d, returns a ``Parallel3dAxisGeometry``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single ticks on classes

"""Create default parallel beam geometry from space.

This default geometry gives a fully sampled sinogram according to the
nyquist criterium. In general this gives a very large number of samples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nyquist
criterium criterion

Do we have a reference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kak A C and Slaney M 2001 Principles of Computerized Tomographic Imaging (Philadelphia, PA: SIAM)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the reference @chongchenmath!

Copy link
Contributor

@ozanoktem ozanoktem Dec 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kak A C and Slaney M 2001 Principles of Computerized Tomographic Imaging (Philadelphia, PA: SIAM)

In general it is not a good idea to give an entire book as a reference for a specific result. The sampling theory based on the Nyquist criteria, as outlined in section 4.2and pp. 73-78 in "Mathematical Methods in Image Reconstruction" by F. Natterer and F. Wübbeling, SIAM, 2001 is only developed for the 2D case. Of course, 3D parallel beam geometry reduces to a sequence of 2D problems, so it also makes sense in that setting.

Parameters
----------
space : `DiscreteLp`
Space in which the image should live. Needs to be 2d or 3d.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps
Reconstruction or "image" space.

space : `DiscreteLp`
Space in which the image should live. Needs to be 2d or 3d.
angles : int, optional
Number of angles. Default: Enough to fully sample the data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"fully sample the data" - I get what you mean, but it could be clearer. Why not refer to the Nyquist criterion as you did before and perhaps include a link to a source above? Like this one.

@adler-j
Copy link
Member Author

adler-j commented Dec 20, 2016

Will fix comments and I agree a reference is a must.

nyquist criterium. In general this gives a very large number of samples.

This is intended for simple test cases where users do not need the full
flexibility of the geometries, but simply wants a geomoetry that works.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want

@adler-j
Copy link
Member Author

adler-j commented Dec 25, 2016

Fixed comments, updated doc, added tests. Next review!

Copy link
Member

@kohr-h kohr-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more remarks, fix them and merge.

"""
Example using a filtered back-projection in 2d using the ray transform and a
Example creating a filtered back-projection in 2d using the ray transform and a
ramp filter. The ramp filter is implemented in fourier space.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fourier

Also note that ODL has a utility function, `fbp_op` that can be used to perform
filtered back-projection.
filtered back-projection, and that this example is intended to show how this
could be implemented in ODL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps "by hand using ODL"



def parallel_beam_geometry(space, angles=None, det_shape=None):
"""Create default parallel beam geometry from space.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``space``

"""Create default parallel beam geometry from space.

This default geometry gives a fully sampled sinogram according to the
nyquist criterion. In general this gives a very large number of samples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nyquist
"criterion, which in general results in a very ..." (reason: too many "this")

nyquist criterion. In general this gives a very large number of samples.

This is intended for simple test cases where users do not need the full
flexibility of the geometries, but simply want a geomoetry that works.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "geomoetry"


The geometry returned by this function satisfies these conditions exactly.

If the domain is 3 dimensional, the geometry is "separable", in that each
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3-dimensional

The geometry returned by this function satisfies these conditions exactly.

If the domain is 3 dimensional, the geometry is "separable", in that each
slice along the z-dimension of the data is treated as independed 2d data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good description!

corners = space.domain.corners()[:, :2]
rho = np.max(np.linalg.norm(corners, axis=1))

# Find default values according to nyquist criterion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nyquist

rho = np.max(np.linalg.norm(corners, axis=1))

# Find default values according to nyquist criterion
min_side = min(space.partition.cell_sides[:2])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.partition

elif space.ndim == 3:
width = int(2 * rho * omega / np.pi) + 1
height = space.shape[2]
det_shape = [width, height]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No natural place to check for ndim in (2, 3), but an else case at some place would be nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added afterwards

@adler-j
Copy link
Member Author

adler-j commented Jan 2, 2017

Fixed the comments but realized that I may have an error in the computations. At one point I compute:

min_side = min(space.partition.cell_sides[:2])
omega = 2 * np.pi / min_side

Shouldn't this be

min_side = min(space.partition.cell_sides[:2])
omega = np.pi / min_side

?

Edit: I just checked with what Fourier transform gives, and it supports this idea. Anyway this would be great since then we'd only need 1/4 of the samples.

Edit2: With this change, the total number of samples also becomes about 4 times the samples in the input, which makes perfect sense given the Nyqvist criterion.

Edit3: Fixed this in a commit.

Copy link
Member

@kohr-h kohr-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One spelling thing left, merge after that. Good catch with the definition of the sampling, I didn't go and check the reference.

flexibility of the geometries, but simply want a geometry that works.

This default geometry gives a fully sampled sinogram according to the
nyquist criterion, which in general results in a very large number of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nyquist

@adler-j adler-j force-pushed the issue-711__default_parallel_geometry branch from 444e6e5 to d605c64 Compare January 3, 2017 10:07
@adler-j
Copy link
Member Author

adler-j commented Jan 3, 2017

Fixed comment, merge after CI.

@adler-j adler-j merged commit 9cc183d into master Jan 3, 2017
@adler-j adler-j deleted the issue-711__default_parallel_geometry branch January 3, 2017 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants