Turning one or two X-ray images into a 3D bone model is a guessing problem. Each pixel records the total density along a line through the body, and many different 3D shapes produce the same image. Networks trained on healthy bones guess by falling back on what a typical bone looks like. On a fractured spine or a hip with a metal plate, that fallback quietly erases the fracture or the hardware, even though both are plainly visible in the radiograph. We propose a reconstruction network whose internal ordering of 3D cells follows the X-ray beams themselves. The predicted volume is stored in "beam coordinates": the detector pixel, plus the depth along that pixel's ray. It is read by a sequence model as a single 1D sequence, in which each ray's depth samples sit next to each other and neighbouring rays sit next to each other along a Hilbert curve laid over the detector. A Hilbert curve is a fractal path that visits every cell of a grid while keeping cells that are close in space close in the sequence.
With this ordering, simulating the X-ray of the predicted volume reduces to summing each contiguous run of tokens. The model can therefore be forced, cheaply and exactly, to reproduce every line integral in its input, both during training and as a refinement step at test time. A model held to that constraint cannot delete a fracture line or an implant shadow. It can only misplace it in depth, and the sequence model's memory of neighbouring rays is what we use to place it correctly. The question is whether this beam-aligned ordering narrows the known performance gap between healthy and pathological anatomy in 2D-to-3D bone reconstruction. It also has to make tilted views less damaging, and it has to beat a strong convolutional network given the same consistency constraint.
Core Claim
Our claim is that a large part of the pathological generalization gap in X-ray-to-3D lifting comes from decoders that are free to ignore the evidence in the projection. Pairing an exact, per-ray projection constraint with a beam-ordered linear sequence model should close more of that gap than either piece alone. The xrayto3D benchmark (Benchmarking Encoder-Decoder Architectures for Biplanar X-ray to 3D Bone Shape Reconstruction) motivates the claim. It trained eight encoder-decoders on clean anatomy and found a "massive performance drop" on fractured cervical spines and on pelves with metal implants. It also showed high-Dice models missing clinical landmarks, and a 10° tilt of the lateral view cutting rib Dice by up to 30%. The ingredient that is new here is the serialization. Existing curve-based 3D sequence models order cells along world axes:
- PointMamba uses Hilbert-ordered point patches.
- Voxel Mamba uses Hilbert-ordered voxels for detection.
- DRBD-Mamba uses a Morton-ordered sequencer for brain tumour MRI.
All three take a volume whose depth is already known as input. None of them lifts a projection or ties the order to the imaging geometry.
The closest neighbour on the X-ray side is SAX-NeRF. It showed that attention within line segments along rays captures internal structure, but each segment is processed in isolation, and the method fits each scene separately from sparse multi-view input. We keep its insight that rays are the natural unit. We add cross-ray context through the detector-plane Hilbert path, train a single feed-forward model across patients, and target one or two views.
On the pose side, StructMamPose diagnosed "internal state update confusion" from naive flattening, along with depth confusion in monocular lifting. It fixes depth by rotating features into a virtual side view, and it reports that this rotation breaks on out-of-distribution poses. Our design constrains depth through measured line integrals rather than an imagined view. The constraint does not depend on the initial estimate being anatomically plausible.
The ordering also removes a known limitation of 3D Hilbert curves: they require a power-of-two cube, which forces heavy padding. Here the curve runs only over the detector, which is already a power-of-two grid, and depth is a plain contiguous run.
Research Program
The model encodes the input radiograph with a 2D convolutional encoder. It then initializes a grid of tokens of size $U \times V \times T$, covering detector rows, detector columns and depth samples along each ray, and lifts each pixel's feature to all $T$ tokens on its ray. The tokens are serialized ray by ray, with rays visited in 2D Hilbert order, and processed by bidirectional Mamba blocks. Mamba is a state space model: a recurrent layer with linear cost in sequence length.
A head predicts a nonnegative density $\mu$ for each token and a bone-occupancy probability. The simulated projection at detector pixel $r$ is
$$\hat{p}(r) = \sum_{t=1}^{T} \mu(r,t)\,\Delta_t ,$$
where $\Delta_t$ is the length of depth step $t$ along the ray. This is the log-domain Beer-Lambert line integral, computed as a segmented sum over contiguous tokens. Training minimizes occupancy loss against the CT label plus $\lambda \sum_r |\hat{p}(r) - p(r)|$, where $p$ is the measured log-attenuation.
At test time, a few gradient steps on the same consistency term refine the predicted densities. This is the same kind of test-time fitting MedNeRF uses, but applied to a feed-forward prediction instead of a latent code. The beam-coordinate volume is finally resampled to world coordinates for evaluation.
For biplanar input we serialize in the anteroposterior beam frame. The lateral view enters in two ways: as cross-attention features, and as a second consistency term computed with a differentiable resampling projector. That second term is more expensive, which is exactly what the single-view case avoids.
The analysis has three parts. First, we measure what fraction of the healthy-to-pathological drop each ingredient removes. Second, we locate where errors on pathological cases sit: are anomalies erased, or present but placed at the wrong depth? We test this by comparing reconstruction error in a band around fracture or implant regions with error elsewhere. Third, we check whether beam-frame ordering changes sensitivity to view tilt. This matters because a tilted acquisition changes only the resampling into world coordinates, not the statistics of the sequence the model sees.
Baselines
The naive reference point is a matched-capacity 3D convolutional encoder-decoder trained with occupancy loss only. It is evaluated on held-out healthy cases, then on fractured and implant cases, which shows the raw size of the gap in our own pipeline. Since the file gives no numeric drop for CTPelvic1k or RSNACervicalFracture, we must measure the gap ourselves.
The strongest existing method is AttentionUNet as configured in the xrayto3D benchmark. That paper reports 93.66% femur Dice on TotalSegmentator-derived biplanar data with 1.5M parameters, essentially tied with SwinUNETR at 93.64% with 62.2M parameters. It is the strongest competitor because it matches the transformer at a fraction of the size, and our model must earn any extra complexity against it. We run it with the benchmark's data splits, digitally reconstructed radiographs (DRRs, simulated X-rays computed from CT) and preprocessing. Hyperparameter search gets the same GPU-hour budget as ours.
Beating it means two things together. First, staying within about one Dice point of 93.66% on healthy femurs. Second, a statistically significant reduction in the healthy-to-pathological Dice drop and in landmark error, meaning neck-shaft angle and vertebra canal length, on the CTPelvic1k clinic and clinic-metal subsets and on RSNACervicalFracture.
The key ablations are variants of our own model in which only the token order changes, with the projection constraint and test-time refinement held fixed:
- world-axis Morton order in the style of DRBD-Mamba;
- world-axis 3D Hilbert order in the style of Voxel Mamba;
- raster order over the beam-frame grid;
- ray-major order with rays visited in raster rather than Hilbert order.
A further ablation drops the consistency term entirely.
For single-view lifting, the file reports MedNeRF single-view PSNR of 28.54 dB on chest DRRs and 30.17 dB on knee DRRs. These numbers are on different data and target projection quality rather than bone shape, so we report them only as context, not as a head-to-head result. We found no reported single-view result on Lacuna for xrayto3D anatomies.
Why not just…?
Why not just add a reprojection loss to AttentionUNet? This is the most serious threat. Our core argument is that consistency with the measured projection matters, and a differentiable projector can be attached to any network. We therefore run exactly this baseline, with identical loss weight and test-time refinement. Projection consistency constrains only line integrals, so it cannot decide where along a ray a fragment sits. Our hypothesis is that the remaining depth errors are reduced by recurrent context passed between neighbouring rays, which a convolutional network sees only locally. If AttentionUNet with reprojection matches our model on pathological cases, the honest conclusion is that consistency closes the gap and the serialization does not. We would report that as the main finding.
Why not just augment training with synthetic fractures and implants? Inserting metal and cutting bones in CT before generating DRRs is cheap and might close the gap on the specific pathologies simulated. We train every model, ours included, with and without this augmentation. We then test on real clinical fractures and implants that the augmentation did not model. If augmentation alone matches us on that held-out pathology, the architectural claim fails.
Why not just scan along three axes, or use a 3D Hilbert curve on world coordinates? DRBD-Mamba found a single Morton pass faster and more accurate than tri-directional scanning on MRI, but with depth already known. Our ordering ablations test whether aligning the order with rays specifically matters once the input is a projection. The ablations hold the parameter count fixed, as well as the consistency term, which the world-axis variants compute through a resampling projector.
Proposed Experiments
All experiments use xrayto3D anatomies (hip, vertebra, femur, rib) built from TotalSegmentator, CTPelvic1k, VerSe2019 and RSNACervicalFracture. Training uses healthy cases only. We test on held-out healthy cases, the CTPelvic1k clinic and clinic-metal subsets, and RSNACervicalFracture. Both biplanar and anteroposterior-only single-view settings are evaluated.
Metrics are Dice, average surface distance, the benchmark's clinical landmark errors, the error in a band around the pathology, and the projection residual. The pathology band needs a mask of the fracture or implant region; where the datasets give no annotation of it, we derive one from CT, for example by thresholding metal intensity. We repeat the 10° lateral-tilt perturbation from the xrayto3D benchmark on ribs and vertebrae.
The first decisive check is the ordering ablation on the pathological subsets. If beam-ordered Hilbert serialization does not beat world-axis Morton and Hilbert orders under an identical constraint, the serialization claim is wrong.
The second decisive check is the comparison with AttentionUNet plus reprojection, run with and without synthetic-pathology augmentation.
The third check asks whether the pathology-band error shifts from "erased" to "misplaced in depth" once the constraint is present. This tests the mechanism, not just the score. We would treat a win on healthy Dice alone as a failure of the proposal.
All results are on simulated radiographs. That limits the conclusions: metal scatter and soft-tissue noise in real clinical X-rays are not modelled. We would state this explicitly rather than claim clinical robustness.
References
- Benchmarking Encoder-Decoder Architectures for Biplanar X-ray to 3D Bone Shape Reconstruction
- PointMamba: A Simple State Space Model for Point Cloud Analysis
- Voxel Mamba: Group-Free State Space Models for Point Cloud based 3D Object Detection
- DRBD-Mamba for Robust and Efficient Brain Tumor Segmentation with Analytical Insights
- Structure-Aware Sparse-View X-ray 3D Reconstruction
- StructMamPose: From Sequential Perception to Structural Reasoning for 3D Human Pose Estimation
- MedNeRF: Medical Neural Radiance Fields for Reconstructing 3D-aware CT-Projections from a Single X-ray