Generate Measurements from Synthetic Data
Overview
Use this skill when you have a 3D ground-truth (GT) volume and want to simulate what the microscope/system would measure, using precomputed system matrices (the forward operator $A$).
This is typically a prerequisite for solver development and benchmarking:
- GT volume ($x$):
reconstruction.pt(or similar) - system matrices ($A$):
Interp_Vol_ID_*.ptfiles in a directory - output measurements ($b = Ax$): saved as
.tifimages
Instructions
- Prepare the ground-truth volume.
- Ensure the GT volume is a
.ptfile (for examplereconstruction.pt). - If your GT is stored in H5 format, convert it using
scripts/convert_h5_to_pt.py.
- Locate the forward model (A matrices).
- Identify the directory containing
Interp_Vol_ID_*.pt. - Confirm this directory corresponds to the same optical/system setup you want to simulate.
- Pick/verify the crop (if needed).
- If the A volume extent is larger than your GT volume (or mismatched), set
--crop-box-A. - Format is
x0 y0 z0 x1 y1 z1 - User would give the crop, or check crop in most related config/*.yaml. If you do not know how to crop, stop and ask user for help.
- (Optional) Decide on noise injection.
- Use
--noise-indexto add noise to a specific measurement index. - Use
--noise-index -1for clean measurement without noise.
- Generate the measurements.
Run scripts/generate_bunny_measurements.py with:
--gt-vol-path: path to GT.pt--raw-A-dir: path to the system matrices--output-dir: output folder for.tifmeasurements
What success looks like
You should consider this skill successful when:
- the script finishes without error, and
output_dircontains one or more.tifmeasurement images, and- (recommended) the images look plausible (non-empty, not all zeros/NaNs) when opened or visualized.
Examples
Example: generate noise-free measurements with A-cropping
Generate measurements from a GT volume using a specified system-matrix directory, and crop A to match the GT:
bash1python scripts/generate_bunny_measurements.py \ 2 --gt-vol-path data/synthetic/balls/case_1/reconstruction.pt \ 3 --raw-A-dir data/raw/lightsheet_vol_6.9 \ 4 --output-dir data/synthetic/balls/case_1/measurements \ 5 --crop-box-A 5 268 18 69 332 82 \ 6 --noise-index -1