ENH: Add parallel_beam_geometry, closes #711#775
Conversation
kohr-h
left a comment
There was a problem hiding this comment.
Some minor points, and having a reference would be nice.
odl/tomo/geometry/parallel.py
Outdated
|
|
||
| Returns | ||
| ------- | ||
| geometry : ParallelGeometry |
odl/tomo/geometry/parallel.py
Outdated
| ------- | ||
| geometry : ParallelGeometry | ||
| If ``space`` is 2d, returns a ``Parallel2dGeometry``. | ||
| If ``space`` is 3d, returns a ``Parallel3dAxisGeometry``. |
odl/tomo/geometry/parallel.py
Outdated
| """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. |
There was a problem hiding this comment.
Kak A C and Slaney M 2001 Principles of Computerized Tomographic Imaging (Philadelphia, PA: SIAM)
There was a problem hiding this comment.
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.
odl/tomo/geometry/parallel.py
Outdated
| Parameters | ||
| ---------- | ||
| space : `DiscreteLp` | ||
| Space in which the image should live. Needs to be 2d or 3d. |
There was a problem hiding this comment.
Perhaps
Reconstruction or "image" space.
odl/tomo/geometry/parallel.py
Outdated
| 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. |
There was a problem hiding this comment.
"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.
|
Will fix comments and I agree a reference is a must. |
odl/tomo/geometry/parallel.py
Outdated
| 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. |
|
Fixed comments, updated doc, added tests. Next review! |
kohr-h
left a comment
There was a problem hiding this comment.
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. |
| 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. |
odl/tomo/geometry/parallel.py
Outdated
|
|
||
|
|
||
| def parallel_beam_geometry(space, angles=None, det_shape=None): | ||
| """Create default parallel beam geometry from space. |
odl/tomo/geometry/parallel.py
Outdated
| """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. |
There was a problem hiding this comment.
Nyquist
"criterion, which in general results in a very ..." (reason: too many "this")
odl/tomo/geometry/parallel.py
Outdated
| 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. |
odl/tomo/geometry/parallel.py
Outdated
|
|
||
| The geometry returned by this function satisfies these conditions exactly. | ||
|
|
||
| If the domain is 3 dimensional, the geometry is "separable", in that each |
| 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. |
odl/tomo/geometry/parallel.py
Outdated
| corners = space.domain.corners()[:, :2] | ||
| rho = np.max(np.linalg.norm(corners, axis=1)) | ||
|
|
||
| # Find default values according to nyquist criterion |
| rho = np.max(np.linalg.norm(corners, axis=1)) | ||
|
|
||
| # Find default values according to nyquist criterion | ||
| min_side = min(space.partition.cell_sides[:2]) |
| elif space.ndim == 3: | ||
| width = int(2 * rho * omega / np.pi) + 1 | ||
| height = space.shape[2] | ||
| det_shape = [width, height] |
There was a problem hiding this comment.
No natural place to check for ndim in (2, 3), but an else case at some place would be nice.
|
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_sideShouldn'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. |
kohr-h
left a comment
There was a problem hiding this comment.
One spelling thing left, merge after that. Good catch with the definition of the sampling, I didn't go and check the reference.
odl/tomo/geometry/parallel.py
Outdated
| 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 |
444e6e5 to
d605c64
Compare
|
Fixed comment, merge after CI. |
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".