Radon Transform Calculator for 2D Line Integrals

Introduction to Radon transform line integrals

The Radon transform converts a two-dimensional function into values indexed by lines through the plane. This calculator evaluates one projection numerically: enter a function f(x, y), choose the normal angle θ and signed offset s, and the calculator estimates the integral along the corresponding finite line segment.

In computed tomography, geophysics, microscopy, and integral geometry, many projections from different directions can reveal the internal structure of an object or field. This page has a narrower purpose. It lets you inspect one line integral at a time, making it useful for checking coursework, exploring projection geometry, or comparing how a field responds when a line is rotated or translated.

The distinction between a line and its normal is central to using the calculator correctly. The angle θ identifies the direction perpendicular to the integration line. The signed offset s moves the line along that normal. Together they select the points satisfying x cos θ + y sin θ = s.

What line projection does this Radon transform calculator compute?

This Radon transform calculator accumulates f(x, y) along a line whose unit normal is (cos θ, sin θ). At t = 0, the sampled point is the closest point on the line to the origin. As t increases, the sample position moves in the perpendicular direction (−sin θ, cos θ). Some textbooks describe the direction of the line itself rather than its normal, so checking the convention prevents a 90° interpretation error.

The script integrates only the portion parameterized by t from −5 to 5. The reported result therefore describes a segment of length 10 in the coordinate units used by the expression. It is not automatically the formal infinite-line Radon transform. For a function concentrated near the origin, the finite window may capture nearly all of the contribution. A broad, shifted, or slowly decaying field may extend beyond it.

How to use the Radon transform inputs

To use this Radon transform estimate, first describe the field with an expression in x and y, then choose the line geometry. A reliable exploration changes one geometric input at a time so that the reason for each change in the projection remains clear.

  1. Enter f(x, y) using x and y as coordinate variables. The default exp(-(x^2+y^2)) describes a smooth, centered Gaussian field.
  2. Enter Theta (degrees). This is the angle of the normal vector, not the direction in which the integration path runs.
  3. Enter Offset s, the signed perpendicular distance from the origin to the line.
  4. Select Compute Transform to evaluate the line with 400 Simpson subintervals.
  5. Record the expression, θ, s, and finite bounds whenever you compare or cite the result.

A positive and a negative offset place parallel lines on opposite sides of the origin relative to the selected normal. If the geometry seems surprising, sketch the normal vector, mark the point s(cos θ, sin θ), and draw the integration line through that point at a right angle to the normal.

Choosing the function, normal angle, and signed offset

The projection depends on both the values of the field and the path through it. The expression and offset must therefore use a consistent coordinate scale. An offset of 2 means two units in the same coordinate system used by x and y in the function.

  • Function expression: use arithmetic and familiar functions such as exp, sqrt, sin, cos, log, and abs. The expression must produce finite real values at all sampled points.
  • Normal angle θ: rotating θ rotates the normal and the integration line around the origin when s remains fixed. Angles differing by 180° represent the same geometric family with the offset sign reversed.
  • Signed offset s: changing s translates the line parallel to itself. Large magnitudes may move the segment outside the important part of a localized field.
  • Coordinate scale: the fixed t interval has width 10. Rescaling a function without considering this interval changes how much of the field lies inside the sampled segment.
  • Symmetry: a centered radial function should give the same result at every angle for a fixed absolute offset, apart from numerical rounding.

For a first check, keep s at zero and rotate θ. Next hold θ fixed and move s outward in small increments. This sequence separates orientation effects from translation effects and often reveals an input convention mistake immediately.

The formula for this finite Radon transform

The calculator parameterizes the selected Radon line with t and integrates the submitted field along it. Although θ is entered in degrees, the script converts it to radians before evaluating the trigonometric functions in the following formula.

Rf (θ,s) = 55 f( scosθtsinθ, ssinθ+tcosθ )dt

The implementation applies composite Simpson's rule rather than symbolic integration. It divides the interval of width 10 into 400 equal subintervals, giving a step size of 0.025. Endpoint values receive weight 1, interior odd-indexed samples receive weight 4, and interior even-indexed samples receive weight 2. The weighted sum is multiplied by one third of the step size.

Simpson's rule is generally effective for smooth functions, but fixed sampling cannot resolve every possible expression. A very narrow peak might fall between sample points, while a rapidly oscillating function may be under-sampled. A singularity can also create an undefined or non-finite value.

Worked example: a centered Gaussian Radon slice

This worked example uses the default field exp(-(x^2+y^2)), θ = 45°, and s = 0. Because the Gaussian is centered and radially symmetric, every line through the origin encounters the same profile. Changing θ from 45° to 0°, 90°, or another angle should leave the estimated integral essentially unchanged.

For an infinite line, the centered slice has the familiar value √π, approximately 1.772454. The calculator integrates only from t = −5 to 5, but the Gaussian is already extremely small at those endpoints, so the finite estimate is expected to agree with that benchmark to the displayed precision. Selecting Compute Transform with the defaults should therefore produce a value close to 1.772454.

Now keep θ at 45° and change s to 1. The line is translated one unit away from the peak. For this Gaussian, the full-line projection is √π multiplied by exp(−s²), so the expected value is about 0.652049. The finite bounds again omit only a negligible tail. This second calculation demonstrates that s controls displacement, while rotating a radial field does not change its projection.

The same benchmark should not be applied blindly to another function. For an elongated ridge, θ may have a strong effect. For a signed field, positive and negative regions can cancel. For a function that remains large near t = ±5, the finite result may differ substantially from an infinite-line formula.

How field geometry changes a Radon projection

A projection changes according to the field values encountered along the selected segment. If the entire function is multiplied by a constant while θ and s stay fixed, linearity means the integral is multiplied by the same constant. Changing only one localized feature affects the result only when the integration line passes through that feature.

Angle sensitivity reveals directional structure. A circular field has no preferred orientation, whereas an elongated object, edge, or stripe can create large differences as θ rotates. Offset sensitivity reveals location: translating the line toward a concentrated feature usually increases its contribution, while translating away decreases it.

A small result is not always evidence of an empty line. When f can be negative, contributions may cancel. Conversely, a large result can come from intense values over a short distance or moderate values spread across much of the segment. Interpretation should consider the sign, scale, support, and units of the submitted field.

Interpreting the numerical Radon transform result

The result area reports one Simpson-rule estimate for the submitted expression and geometry. It is not a reconstructed image, a sinogram, or a list of sample points. Its units are the units of f multiplied by the coordinate unit of t. If f represents density per square centimetre and x and y are measured in centimetres, for example, the line integral has the corresponding density-times-length interpretation.

For a nonnegative expression, a negative result suggests that the expression was not actually nonnegative over the sampled line or that an invalid numerical operation occurred. For a signed expression, positive and negative regions may legitimately offset each other. The displayed value is rounded to six decimal places, so very small differences may be hidden by formatting.

When comparing runs, retain the exact function, angle, signed offset, and finite integration bounds. Two projections are only directly comparable when their coordinate scale and numerical assumptions match.

Limitations of this finite-segment Radon calculation

The limitations of this Radon transform calculator arise from its finite interval, fixed sampling resolution, and expression evaluator. It is designed for exploration and numerical checking rather than full tomographic reconstruction.

  • Finite bounds: only t values from −5 to 5 contribute. Features beyond the endpoints are omitted.
  • Fixed sampling: 400 subintervals may be inadequate for narrow spikes, discontinuities, or fast oscillations.
  • Expression domain: every sampled point must produce a finite real value. Singularities, invalid logarithms, or division by zero can stop the calculation.
  • Angle convention: θ describes the normal. A source that defines θ along the integration line will appear rotated by 90° relative to this page.
  • No reconstruction: one projection cannot recover a two-dimensional field. Image reconstruction requires many angles, offsets, filtering, and an inversion method.
  • Displayed precision: the output is rounded to six decimal places even though the internal calculation uses JavaScript floating-point values.

For critical imaging, inverse-problem, or scientific work, verify the result with analytic integration where possible or with software that supports adaptive quadrature, configurable domains, error estimates, and complete projection sets.

Define the field and projection line

Use x and y as variables, for example exp(-(x^2+y^2)) or sin(x)+cos(y).

Enter a 2D function, angle, and offset to evaluate the Radon transform.

Enter a function in x and y, an angle for the line's normal in degrees, and a signed numeric offset.

Optional mini-game: Projection Pulse Lab

Practice the geometry behind θ and s by steering a scanning line through bright field nodes. Horizontal pointer position selects the normal angle, vertical position changes the signed offset, and a click or tap fires the projection. Crossing several bright nodes with one line earns a multi-projection bonus, but dark artifacts reduce the score.

Score 0
Time 75
Streak 0
Wave 0

Projection Pulse Mission

Aim the cyan line through bright field nodes and avoid dark red artifacts. Move horizontally for θ, vertically for s, then click, tap, or press Space to pulse.

Session: 75 seconds. The field becomes denser and the alignment tolerance tightens as time passes.

Pointer/touch: aim and pulse · Arrow keys: tune θ and s · Space: pulse

The game is separate from the calculator and does not alter its inputs or result. Its geometry uses the same line equation as the calculator: θ controls the normal direction and s translates the line along that normal.

Questions about finite Radon projections

What does the Radon transform measure?

It measures the accumulated value of a two-dimensional function along a selected line. Repeating the operation over many angles and offsets creates projection data that can be used in tomography and other inverse problems.

Why can two different lines have the same result?

Symmetry, equal total contribution, or cancellation can make distinct lines produce equal values. One scalar projection does not uniquely identify all of the field values along its path.

When does the finite segment approximate an infinite line?

The approximation is strongest when the function is negligible outside the sampled range. Inspecting the function near both endpoints is a practical way to judge whether omitted tails are likely to matter.

Embed this calculator

Copy and paste the HTML below to add the Radon Transform Calculator for Finite 2D Line Integrals to your website.