class documentation

Importer for DICOM datasets datasets stored on disk.

See :ref:`this page <DICOMDataset-import>` for format details.

Parameters
dataset_dirthe dataset directory. If omitted, dicom_path must be provided
dicom_path

an optional parameter that enables explicit control over the location of the DICOM files. Can be any of the following:

  • a glob pattern like "*.dcm" specifying the location of the DICOM files in dataset_dir
  • the name of a DICOMDIR file in dataset_dir
  • an absolute glob pattern of DICOM files or the absolute path to a DICOMDIR file. In this case, dataset_dir has no effect

If None, the parameter will default to *.dcm

images_dirthe directory in which the images will be written. If not provided, the images will be unpacked into dataset_dir
keywordsan optional keyword or list of keywords from pydicom:pydicom.dataset.Dataset.dir to load from the DICOM files. By default, all available fields are loaded
parsersan optional dict mapping keywords to functions that parse the values generated by pydicom:pydicom.dataset.Dataset.get for certain fields. By default, all fields are converted to primitive values, if possible
image_formatthe image format to use to write the images to disk. By default, fiftyone.config.default_image_ext is used
shufflewhether to randomly shuffle the order in which the samples are imported
seeda random seed to use when shuffling
max_samplesa maximum number of samples to import. By default, all samples are imported
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ The total number of samples that will be imported.
Method __next__ Returns information about the next sample in the dataset.
Method close Performs any necessary actions after the last sample has been imported.
Method setup Performs any necessary setup before importing the first sample in the dataset.
Instance Variable dicom_path Undocumented
Instance Variable image_format Undocumented
Instance Variable images_dir Undocumented
Instance Variable keywords Undocumented
Instance Variable parsers Undocumented
Property has_dataset_info Whether this importer produces a dataset info dictionary.
Property has_image_metadata Whether this importer produces fiftyone.core.metadata.ImageMetadata instances for each image.
Property label_cls The fiftyone.core.labels.Label class(es) returned by this importer.
Instance Variable _dataset_ingestor Undocumented
Instance Variable _iter_dataset_ingestor Undocumented
Instance Variable _num_samples Undocumented
Instance Variable _sample_parser Undocumented

Inherited from DatasetImporter (via LabeledImageDatasetImporter):

Method __enter__ Undocumented
Method __exit__ Undocumented
Method get_dataset_info Returns the dataset info for the dataset.
Method _preprocess_list Internal utility that preprocesses the given list---which is presumed to be a list defining the samples that should be imported---by applying the values of the shuffle, seed, and max_samples parameters of the importer.

Inherited from ImportPathsMixin (via LabeledImageDatasetImporter, DatasetImporter):

Static Method _load_data_map Helper function that parses either a data directory or a data manifest file into a UUID -> filepath map.
Static Method _parse_data_path Helper function that computes default values for the data_path parameter supported by many importers.
Static Method _parse_labels_path Helper function that computes default values for the labels_path parameter supported by many importers.
def __init__(self, dataset_dir=None, dicom_path=None, images_dir=None, keywords=None, parsers=None, image_format=None, shuffle=False, seed=None, max_samples=None): (source)
def __len__(self): (source)

The total number of samples that will be imported.

Raises
TypeErrorif the total number is not known
def __next__(self): (source)

Returns information about the next sample in the dataset.

Returns
an(image_path, image_metadata, label)
tuple
, where
Raises
StopIterationif there are no more samples to import
def close(self, *args): (source)

Performs any necessary actions after the last sample has been imported.

This method is called when the importer's context manager interface is exited, DatasetImporter.__exit__.

Parameters
*argsthe arguments to DatasetImporter.__exit__
def setup(self): (source)

Performs any necessary setup before importing the first sample in the dataset.

This method is called when the importer's context manager interface is entered, DatasetImporter.__enter__.

dicom_path: None = (source)

Undocumented

image_format: None = (source)

Undocumented

images_dir: None = (source)

Undocumented

keywords: None = (source)

Undocumented

Undocumented

@property
has_dataset_info = (source)

Whether this importer produces a dataset info dictionary.

The fiftyone.core.labels.Label class(es) returned by this importer.

This can be any of the following:

  • a fiftyone.core.labels.Label class. In this case, the importer is guaranteed to return labels of this type
  • a list or tuple of fiftyone.core.labels.Label classes. In this case, the importer can produce a single label field of any of these types
  • a dict mapping keys to fiftyone.core.labels.Label classes. In this case, the importer will return label dictionaries with keys and value-types specified by this dictionary. Not all keys need be present in the imported labels
  • None. In this case, the importer makes no guarantees about the labels that it may return
_dataset_ingestor = (source)

Undocumented

_iter_dataset_ingestor = (source)

Undocumented

_num_samples = (source)

Undocumented

_sample_parser = (source)

Undocumented