Skip to content

osirix.dicom

Classes that represent the core objects within the OsiriX database.

All attributes for these classes are immutable.

Example usage
import osirix
from osirix.dicom import DicomStudy, DicomSeries

database = osirix.current_browser()  # Get the current browser instance
studies, series = database.database_selection()  # Get the current selection by the user
for study in studies:
    print(f"This is a DicomStudy instance with name {obj.study_name}")
for serie in series:
    print(f"This is a DicomSeries instance with description {obj.series_description}")

DicomImage

Bases: OsirixBase

An instance representing a Dicom image within the OsiriX database.

complete_path: str property

The path of the source Dicom file.

date: datetime.datetime property

The date in which the Dicom image were acquired.

height: int property

The number of rows in the image

instance_number: int property

The instance number for the Dicom image.

modality: str property

The modality of the Dicom image.

number_of_frames: int property

The number of frames within the Dicom image.

series: DicomSeries property

The DicomSeries instance in which the image is contained.

slice_location: float property

The slice location of the image.

Note that this is never perfect; it can be better to read the source dicom instance and use the ImagePositionPatient parameter.

sop_instance_uid: str property

The SOP instance UID for the image.

width: int property

The number of columns in the image

DicomSeries

Bases: OsirixBase

An instance representing a Dicom series within the OsiriX database.

date: datetime.datetime property

The date in which the series was acquired.

images: List[DicomImage] property

The Dicom Image instances associated with the series.

modality: str property

The modality of the Dicom series.

next_series: DicomSeries property

The next Dicom Series in the OsiriX database.

number_of_images: int property

The number of images within the Dicom series.

paths: List[str] property

The Dicom file paths associated with the series.

Returns:

Type Description
List[str]

A list of absolute paths.

patient_name: str property

The patient name of the Dicom series

previous_series: DicomSeries property

The previous Dicom Series in the OsiriX database.

series_description: str property

The series description.

series_instance_uid: int property

The series instance UID.

This seems to generate some unexpected results. It is better to access directly by reading the dicom files (via DicomSeries.paths) using the pydicom library.

sop_class_uid: int property

The series SOP class UID.

study: DicomStudy property

The Dicom Study containing the series.

sorted_images()

Dicom image instances sorted by OsiriX user preferences.

These preferences are determined in OsiriX Preferences / Database / Sorting.

Returns:

Type Description
List[DicomImage]

A list of sorted DicomImage instances.

DicomStudy

Bases: OsirixBase

An instance representing a Dicom study within the OsiriX database.

date: datetime.datetime property

The date in which the Dicom data were acquired.

date_added: datetime.datetime property

The date in which the Dicom data were added to the OsiriX database.

date_of_birth: datetime.datetime property

The patient date of birth for the Dicom study.

images: List[DicomImage] property

The Dicom Image instances associated with the study.

institution_name: str property

The name of the institution where the Dicom study was performed.

modalities: str property

The modalities available within the Dicom study.

Modalities are seperated by a double backslash (e.g. "PT\CT")

no_files: int property

The number of files comprising the Dicom study.

number_of_images: int property

The number of images within the Dicom study.

paths: List[str] property

The Dicom file absolute paths associated with the study.

This will ignore any paths associated with the OsiriX ROI Dicom SRs.

patient_id: str property

The patient ID of the Dicom study.

patient_name: str property

The patient name of the Dicom study

patient_sex: str property

The patient sex of the Dicom study.

patient_uid: str property

The patient UID of the Dicom study.

performing_physician: str property

The performing physician name for the Dicom study.

raw_no_files: int property

The number of raw image files within the Dicom study.

Note that this will include the OsiriX ROI SR files if any exist. Using no_files provides the number of accessible images.

referring_physician: str property

The referring physician name for the Dicom study.

series: List[DicomSeries] property

The Dicom Series instances associated with the study.

This will ignore any series associated with the OsiriX ROI Dicom SRs.

study_instance_uid: str property

The study instance UID for the Dicom series.

study_name: str property

The study name for the Dicom series.