data

Load DICOM datasets as numpy arrays with voxel dimensions

CT scans in DiffDRR are stored using the torchio.Subject dataclass. torchio provides a convenient and consistent mechanism for reading volumes from a variety of formats and orientations. We canonicalize all volumes to the RAS+ coordinate space. In addition to reading an input volume, you can also pass the following to diffdrr.data.read when loading a subject: - labelmap : a 3D segmentation of the input volume - labels : a subset of structures from the labelmap that you want to render - orientation : a frame-of-reference change for the C-arm (currently, “AP” and “PA” are supported) - bone_attenuation_multiplier : a constant multiplier to the estimated density of bone voxels - fiducials : a tensor of 3D fiducial marks in world coordinates - **kwargs : any additional kwargs can be passed to the torchio.Subject and accessed as a dictionary


source

load_example_ct

 load_example_ct (labels=None, orientation='AP',
                  bone_attenuation_multiplier=1.0, **kwargs)

Load an example chest CT for demonstration purposes.


source

read

 read (volume:str|pathlib.Path|torchio.data.image.ScalarImage,
       labelmap:str|pathlib.Path|torchio.data.image.LabelMap=None,
       labels:int|list=None, orientation:str|None='AP',
       bone_attenuation_multiplier:float=1.0, fiducials:torch.Tensor=None,
       transform:diffdrr.pose.RigidTransform=None,
       center_volume:bool=True, **kwargs)

Read an image volume from a variety of formats, and optionally, any given labelmap for the volume. Converts volume to a RAS+ coordinate system and moves the volume isocenter to the world origin.

Type Default Details
volume str | pathlib.Path | torchio.data.image.ScalarImage CT volume
labelmap str | pathlib.Path | torchio.data.image.LabelMap None Labelmap for the CT volume
labels int | list None Labels from the mask of structures to render
orientation str | None AP Frame-of-reference change
bone_attenuation_multiplier float 1.0 Scalar multiplier on density of high attenuation voxels
fiducials Tensor None 3D fiducials in world coordinates
transform RigidTransform None RigidTransform to apply to the volume’s affine
center_volume bool True Move the volume’s isocenter to the world origin
kwargs
Returns Subject Any additional information to be stored in the torchio.Subject