Does anyone know what is the difference in Pydicom between the two methods FileDataset.get()
and FileDataset.get_item()
?
Thanks!
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Both of these are not used often in user code.
Dataset.get
is the equivalent of python's dict.get; it allows you to ask for an item in the dictionary, but return a default if that item does not exist in the Dataset. The more usual way to get an item from a Dataset is to use the dot notation, e.g.or to get the
DataElement
object via the tag number, e.g.Dataset.get_item
is a lower-level routine, primarily used when there is something wrong with some incoming data, and it needs to be corrected before the "raw data element" value is converted into python standard types (int, float, string types, etc).When used with a keyword,
Dataset.get()
returns a value, not aDataElement
instance.Dataset.get_item
always returns either aDataElement
instance, or aRawDataElement
instance.I imagine your answer is in the source for those two functions. Looks like
get()
handled strings as well as DataElements as input.