pydicom.dataset.FileMetaDataset

class pydicom.dataset.FileMetaDataset(*args, **kwargs)

Contains a collection (dictionary) of group 2 DICOM Data Elements.

New in version 2.0.

Derived from Dataset, but only allows Group 2 (File Meta Information) data elements

__init__(*args, **kwargs)

Initialize a FileMetaDataset

Parameters are as per Dataset; this overrides the super class only to check that all are group 2 data elements

Raises
  • ValueError – If any data elements are not group 2.

  • TypeError – If the passed argument is not a dict or Dataset

Methods

__init__(*args, **kwargs)

Initialize a FileMetaDataset

add(data_element)

Add an element to the Dataset.

add_new(tag, VR, value)

Create a new element and add it to the Dataset.

clear()

Delete all the elements from the Dataset.

convert_pixel_data([handler_name])

Convert pixel data to a numpy.ndarray internally.

copy()

data_element(name)

Return the element corresponding to the element keyword name.

decode()

Apply character set decoding to the elements in the Dataset.

decompress([handler_name])

Decompresses Pixel Data and modifies the Dataset in-place.

dir(*filters)

Return an alphabetical list of element keywords in the Dataset.

elements()

Yield the top-level elements of the Dataset.

ensure_file_meta()

Create an empty Dataset.file_meta if none exists.

fix_meta_info([enforce_standard])

Ensure the file meta info exists and has the correct values for transfer syntax and media storage UIDs.

formatted_lines([element_format, ...])

Iterate through the Dataset yielding formatted str for each element.

from_json(json_dataset[, bulk_data_uri_handler])

Add elements to the Dataset from DICOM JSON format.

fromkeys([value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Simulate dict.get() to handle element tags and keywords.

get_item(key)

Return the raw data element if possible.

get_private_item(group, element_offset, ...)

Return the data element for the given private tag group.

group_dataset(group)

Return a Dataset containing only elements of a certain group.

items()

Return the Dataset items to simulate dict.items().

iterall()

Iterate through the Dataset, yielding all the elements.

keys()

Return the Dataset keys to simulate dict.keys().

overlay_array(group)

Return the Overlay Data in group as a numpy.ndarray.

pop(key, *args)

Emulate dict.pop() with support for tags and keywords.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

private_block(group, private_creator[, create])

Return the block for the given tag group and private_creator.

private_creators(group)

Return a list of private creator names in the given group.

remove_private_tags()

Remove all private elements from the Dataset.

save_as(filename[, write_like_original])

Write the Dataset to filename.

set_original_encoding(is_implicit_vr, ...)

Set the values for the original transfer syntax and encoding.

setdefault(key[, default])

Emulate dict.setdefault() with support for tags and keywords.

to_json([bulk_data_threshold, ...])

Return a JSON representation of the Dataset.

to_json_dict([bulk_data_threshold, ...])

Return a dictionary representation of the Dataset conforming to the DICOM JSON Model as described in the DICOM Standard, Part 18, Annex F.

top()

Return a str representation of the top level elements.

trait_names()

Return a list of valid names for auto-completion code.

update(dictionary)

Extend dict.update() to handle DICOM tags and keywords.

validate(init_value)

Raise errors if initialization value is not acceptable for file_meta

values()

Return the Dataset values to simulate dict.values().

walk(callback[, recursive])

Iterate through the Dataset's elements and run callback on each.

Attributes

default_element_format

default_sequence_element_format

indent_chars

is_original_encoding

Return True if the encoding to be used for writing is set and is the same as that used to originally encode the Dataset.

pixel_array

Return the pixel data as a numpy.ndarray.

static validate(init_value)

Raise errors if initialization value is not acceptable for file_meta

Parameters

init_value (dict or Dataset) – The tag:data element pairs to initialize a file meta dataset

Raises
  • TypeError – If the passed argument is not a dict or Dataset

  • ValueError – If any data elements passed are not group 2.