Example Datasets (pydicom.examples
)¶
The examples
module contains the following DICOM datasets:
Module Attribute |
File |
SOP Class |
---|---|---|
|
|
CT Image |
|
|
MR Image |
|
|
RT Plan |
|
|
RT Dose |
|
|
RT Structure Set |
|
|
MR Image |
|
|
12 Lead ECG |
|
|
US Image |
|
|
US Image |
|
|
US Multi-frame Image |
|
|
US Image |
|
|
Media Storage |
As well as the utility function:
|
Return the path to the example dataset with the attribute name name as |
Usage¶
The module attributes are all normal FileDataset
instances:
>>> from pydicom import examples
>>> type(examples.ct)
<class 'pydicom.dataset.FileDataset'>
>>> examples.ct.PatientName
'CompressedSamples^CT1'
Each time the module attribute is accessed a new
FileDataset
instance of the dataset will be returned:
>>> examples.ct is examples.ct
False
>>> examples.ct == examples.ct
True
Because of this, best practice is to assign the returned dataset to a local variable:
>>> ds = examples.ct
The get_path()
function can be used to return the path
to an example dataset as a pathlib.Path
instance:
>>> examples.get_path("ct")
PosixPath('/home/user/pydicom/src/pydicom/data/test_files/CT_small.dcm')