Walkthrough: Simulated Fluoroscopy - rg2/jhmr-v2 GitHub Wiki

Simulation of Fluoroscopy Images During Hip Surgery

The xreg-pao-create-synth-fluoro tool creates synthetic fluoroscopy images using geometries typically associated with hip surgery. The tool will create a series of three-view collections, where each collection has an approximate AP view and two additional views at orbital rotations. Nominal parameters for a Siemens CIOS Fusion C-arm with 30 cm detector are used. Randomness is introduced by sampling the movement of the C-arm, the pose of the volume, and the detected X-ray intensities (Poisson sampling). Although a single volume is used as input, extensions are possible that would enable multiple volumes and analytic objects.

A comprehensive listing of the program's usage may be obtained by passing -h or --help.

Example 1

This example uses the volume (pao_vol_with_kwire.nii.gz) created during example 1 of the screw and K-wire volumetric modeling for periacetabular osteotomy (PAO).

Default Parameters

Run the following command to create five three-view collections using the default parameters:

xreg-pao-create-synth-fluoro -v pao_vol_with_kwire.nii.gz pelvis_app_lands.fcsv left 5 example1_1_pd example1_1_pose

The fourth collection, example1_1_pd_003.h5, may be viewed using the xreg-remap-tile-proj-data tool with the following command:

xreg-remap-tile-proj-data example1_1_pd_003.h5 example1_1_pd_003.png -d 0.25 -b 1

An image similar to this should be produced:

Example 1 Remap

The geometry of the fourth collection may also be viewed using the xreg-draw-xray-scene tool and the following command:

xreg-draw-xray-scene example1_1_pd_003.h5

This should start an interactive visualization tool with views similar to the following:

Example 1 X-ray Scene Basic 1 Example 1 X-ray Scene Basic 2 Example 1 X-ray Scene Basic 3

Screenshots may be saved into the current working directory by pressing the s key. The green squares represent the detector plane of the C-arm, the green spheres represent the X-ray source, and the green lines indicate the lines connecting the X-ray source to the principal point on the detector. Axes may be toggled by pressing the a key.

Each fluoroscopic image may be superimposed on the detector by passing the -i flag:

xreg-draw-xray-scene -i example1_1_pd_003.h5

This should produce a visualization with views similar to the following:

Example 1 X-ray Scene Image Overlay 1 Example 1 X-ray Scene Image Overlay 2

The X-ray scene visualization tool can also include surfaces and point clouds. In order to include a rendering of the volume with respect to the C-arm geometries, a surface must first be created using the xreg-create-mesh tool and the following command:

xreg-create-mesh -i --lower 300 pao_vol_with_kwire.nii.gz pao_w_kwire_mesh.h5

The surface, pao_w_kwire_mesh.h5, and corresponding pose, example1_1_pose_003.h5, are then passed to the scene visualizer:

xreg-draw-xray-scene -i example1_1_pd_003.h5 pao_w_kwire_mesh.h5 example1_1_pose_003.h5

This should produce a visualization with views similar to the following:

Example 1 X-ray Scene Surface 1 Example 1 X-ray Scene Surface 2

Larger Orbital Rotations

The following command demonstrates how larger orbital rotations may be sampled:

xreg-pao-create-synth-fluoro -v pao_vol_with_kwire.nii.gz pelvis_app_lands.fcsv left 5 example1_2_pd example1_2_pose --mean-orbit-rot-1 -30 --mean-orbit-rot-2 35

The larger rotations of the C-arm along its orbit may be verified using the X-ray scene visualizer (using the fourth collection, example1_2_pd_003.h5 and example1_2_pose_003.h5):

xreg-draw-xray-scene -i example1_2_pd_003.h5 pao_w_kwire_mesh.h5 example1_2_pose_003.h5

This should produce a visualization with views similar to the following:

Example 1 Larger Orbital Rotation X-ray Scene 1 Example 1 Larger Orbital Rotation X-ray Scene 2

The image intensities may also be remapped for quick display:

xreg-remap-tile-proj-data example1_2_pd_003.h5 example1_2_pd_003.png -d 0.25 -b 1

Example 1 Larger Orbital Rotation Remap

Lower Photon Count

The following command illustrates how to lower the photon count and increase the amount of noise present in the fluoroscopy images:

xreg-pao-create-synth-fluoro -v pao_vol_with_kwire.nii.gz pelvis_app_lands.fcsv left 5 example1_3_pd example1_3_pose --num-photons 100

The noise may be verified by inspecting the images from the first collection, example1_3_pd_000.h5:

xreg-remap-tile-proj-data example1_3_pd_000.h5 example1_3_pd_000.png -d 0.25 -b 1

Example 1 Lower Photon Count Remap

Example 2

Due to the cropping applied to the volume used in the previous example, the some aspects of the simulated fluoroscopy are particularly unrealistic, specifically the areas concerning each femur. In order to demonstrate a more realistic appearance, this example simulates fluoroscopy prior to any cropping. The Pelvic-Ref-007_00.nii.gz volume created from Example 3 of the DICOM resampling portion of the walkthrough is used.

An example of annotated APP landmarks for this volume are provided here.

The following command creates 1 collection of simulated fluoroscopy focused on the right side of the subject:

xreg-pao-create-synth-fluoro -v Pelvic-Ref-007_00.nii.gz Pelvic-Ref-007_00_app_lands.fcsv right 1 example2_pd example2_pose

The appearance of the projection data, example2_pd_000.h5, may be inspected using the remap tool:

xreg-remap-tile-proj-data example2_pd_000.h5 example2_pd_000.png -d 0.25 -b 1

Example 2 Simulated Fluoroscopy

In this example there are no unrealistic effects due to cropping. In order to further improve the realism of the simulations, some processing should be performed to remove any structures of the CT scanner which are visible in the volume.