Limited-Angle CT Reconstruction With DPS
Domain: health_medicine — Clinical Diagnostics & Imaging

Summary: Reconstruct a 512x512 fan-beam CT attenuation image from a 90-degree limited-angle sinogram using Diffusion Posterior Sampling or a compatible diffusion-prior reconstruction method.

Task prompt:
You are working on a Linux VM.

## Task Directory
`base`

## Visible Inputs
- Limited-angle sinogram: `base/input/sinogram.npy`
- Geometry spec: `base/input/geometry.json`
- Diffusion model card: `base/input/model_card.md`
- Pretrained checkpoint: `base/input/ddpm_CT.pth`
- Detailed instructions: `base/input/task_instructions.md`
- Optional runtime manifest: `base/input/runtime_env/pyproject.toml` and `base/input/runtime_env/uv.lock`

## Helper Scripts
- Runtime bootstrap: `base/software/bootstrap_runtime.sh`
- Runtime Python entry point: `base/software/python_with_runtime.sh`

## Your Task
Reconstruct a 512x512 attenuation image from the staged limited-angle fan-beam CT sinogram using Diffusion Posterior Sampling (DPS) or a compatible DPS-style method.

The intended workflow is:
1. Read `base/input/task_instructions.md`, `model_card.md`, and `geometry.json`.
2. Build the task-local runtime once with `base/software/bootstrap_runtime.sh`.
3. Use `base/software/python_with_runtime.sh` for your Python runs after the bootstrap succeeds.
4. Load the limited-angle sinogram and configure the LEAP fan-beam geometry from `geometry.json`.
5. Load the DDPM checkpoint according to the architecture and scheduler in `model_card.md`.
6. Run a DPS-style reconstruction that combines the CT forward model with the diffusion prior.
7. Save only the final attenuation-domain reconstruction to:
   `base/output/reconstruction.npy`

## Output Contract
- The file must be NumPy `.npy` data readable by `numpy.load`.
- The array must have shape `(512, 512)`.
- The array must be numeric and correspond to attenuation values in the original image domain.

## Evaluation Contract
Your reconstruction is judged by central-crop image quality.
The binary pass condition is:
- `PSNR >= 32.0 dB`
- `SSIM >= 0.90`
- both computed with `data_range = 0.04`

## Constraints
- Do not modify files under `base/input`.
- Write your final answer only under `base/output`.
- Do not use the internet or any external model weights beyond the staged checkpoint.

## Visibility Note
The benchmark harness exposes only the staged `input/`, `software/`, and the designated writable output directory during solve time. Other evaluator-controlled staged assets may exist in the canonical admin package but are not part of the solve-time surface.

Required actions:
Inspect the limited-angle sinogram, fan-beam geometry, task instructions, and DDPM model card.
Build and use the task-local Python runtime through the staged `software/` wrappers.
Use the staged checkpoint and CT geometry to run DPS or a compatible diffusion-prior reconstruction.
Save a single numeric `(512, 512)` attenuation-domain NumPy array to `output/reconstruction.npy`.

Software: Python
NumPy
PyTorch
leaptorch
diffusers

Input files:
name: sinogram.npy
format: npy
description: Limited-angle fan-beam CT sinogram with shape `(720, 1024)`.
name: geometry.json
format: json
description: Fan-beam scanner geometry and scenario metadata; the task uses the `limited_angle` scenario.
name: model_card.md
format: md
description: DDPM architecture, normalization, scheduler, and checkpoint-loading contract.
name: ddpm_CT.pth
format: pth
description: Staged PyTorch DDPM checkpoint.
name: runtime_env
format: pyproject.toml + uv.lock
description: Pinned task-local runtime manifest for the agent-installed Python overlay.