django_dicom.models.values package¶
Module contents¶
Definition of
DataElementValue
subclasses for every type of value representation (VR).
Hint
For more information about value representations see the official DICOM standard (part 05, section 6.2).
Submodules¶
django_dicom.models.values.age_string module¶
Definition of the AgeString
model.
-
class
django_dicom.models.values.age_string.
AgeString
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single AgeString data element value.-
value
¶ Overrides
value
to assign aFloatField
.
-
django_dicom.models.values.application_entity module¶
Definition of the ApplicationEntity
model.
-
class
django_dicom.models.values.application_entity.
ApplicationEntity
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single ApplicationEntity data element value.
django_dicom.models.values.code_string module¶
Definition of the CodeString
model.
django_dicom.models.values.csa_header module¶
Definition of the CsaHeader
model.
-
class
django_dicom.models.values.csa_header.
CsaHeader
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single Siemens’ CSA header value.Hint
For more information about CSA headers, see dicom_parser’s CSA headers documentation.
-
to_html
(verbose: bool = False, **kwargs) → str¶ Returns the HTML representation of this instance.
If the verbose keyword argument is passed as True, returns the entire header as JSON. Otherwise, returns an HTML link to this instance in the admin site.
Parameters: verbose (bool, optional) – Whether to return all of the header information or just a link, by default False Returns: HTML text containing either JSON encoded header information or a link to the admin site Return type: str
-
django_dicom.models.values.data_element_value module¶
Definition of the DataElementValue
model.
-
class
django_dicom.models.values.data_element_value.
DataElementValue
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
A parent
Model
representing a single value contained by someDataElement
instance. If the data element has value multiplicity greater than 1, it will have multiple instances of this model associated with it, each with its own index value.-
admin_link
¶ Creates an HTML tag to link to this instance within the admin site.
Returns: Link to this instance in the admin site Return type: str
-
agestring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
applicationentity
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
codestring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
csaheader
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
data_element_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
date
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
datetime
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
decimalstring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
floatingpointdouble
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
floatingpointsingle
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
get_raw_peek
(size: int = 100) → str¶ Returns a truncated string of the raw data element’s value (appended with “…” if changed).
Parameters: size (int, optional) – Maximal string length, by default 100 Returns: Truncated string Return type: str
-
index
¶ If the value is one of a number of values within a DataElement (a DataElement with a value multiplicity that is greater than 1), this field keeps the index of this value.
-
integerstring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
longstring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
longtext
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
objects
= <django_dicom.models.managers.data_element_value.DataElementValueManager object>¶
-
otherword
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
personname
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
raw
= None¶ Raw data element value (meant to be overridden by child models).
-
sequenceofitems
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
shortstring
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
shorttext
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
signedlong
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
signedshort
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
time
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
to_html
(**kwargs) → str¶ Returns the HTML representation of this instance. This method simlpy returns the value, child models should override to provide an appropriate representation.
Returns: HTML representation of this instance Return type: str
-
uniqueidentifier
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
unknown
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
unlimitedtext
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
unsignedlong
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
unsignedshort
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
value
= None¶ Interpreted data element value (meant to be overridden by child models).
-
warnings
¶ If any warnings were raised by dicom_parser, log them in the database.
-
django_dicom.models.values.datetime module¶
Definition of the DateTime
model.
-
class
django_dicom.models.values.datetime.
DateTime
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single DateTime data element value.-
get_next_by_value
(*, field=<django.db.models.fields.DateTimeField: value>, is_next=True, **kwargs)¶
-
get_previous_by_value
(*, field=<django.db.models.fields.DateTimeField: value>, is_next=False, **kwargs)¶
-
django_dicom.models.values.decimal_string module¶
Definition of the DecimalString
model.
-
class
django_dicom.models.values.decimal_string.
DecimalString
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single DecimalString data element value.-
value
¶ Overrides
value
to assign aFloatField
.
-
django_dicom.models.values.floating_point_double module¶
Definition of the FloatingPointDouble
model.
-
class
django_dicom.models.values.floating_point_double.
FloatingPointDouble
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single FloatingPointDouble data element value.-
value
¶ Overrides
value
to assign aFloatField
.
-
django_dicom.models.values.floating_point_single module¶
Definition of the FloatingPointSingle
model.
-
class
django_dicom.models.values.floating_point_single.
FloatingPointSingle
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single FloatingPointSingle data element value.-
value
¶ Overrides
value
to assign aFloatField
.
-
django_dicom.models.values.integer_string module¶
Definition of the IntegerString
model.
-
class
django_dicom.models.values.integer_string.
IntegerString
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single IntegerString data element value.-
value
¶ Overrides
value
to assign aIntegerField
.
-
-
django_dicom.models.values.integer_string.
MAX_VALUE
= 2147483647¶ Maximal IntegerString value.
-
django_dicom.models.values.integer_string.
MIN_VALUE
= -2147483648¶ Minimal IntegerString value.
django_dicom.models.values.long_string module¶
Definition of the LongString
model.
django_dicom.models.values.other_word module¶
Definition of the OtherWord
model.
-
class
django_dicom.models.values.other_word.
OtherWord
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single OtherWord data element value.-
raw
¶ Overrides
raw
to assign aBinaryField
.
-
value
¶ Overrides
value
to assign aIntegerField
.
-
django_dicom.models.values.person_name module¶
Definition of the PersonName
model.
-
class
django_dicom.models.values.person_name.
PersonName
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single PersonName data element value.-
raw
¶ Overrides
raw
to assign aBinaryField
.
-
django_dicom.models.values.sequence_of_items module¶
Definition of the SequenceOfItems
model.
-
class
django_dicom.models.values.sequence_of_items.
SequenceOfItems
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
django.db.models.Model
representing the value stored in a singleDataElement
with a value representation (VR) of SQ.Sequence of Items data elements are arrays of nested headers, and therefore this model does not override the
raw
andvalue
field definitions (and so they remain None).-
header_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django_dicom.models.managers.values.sequence_of_items.SequenceOfItemsManager object>¶
-
django_dicom.models.values.short_string module¶
Definition of the ShortString
model.
django_dicom.models.values.short_text module¶
Definition of the ShortString
model.
django_dicom.models.values.signed_long module¶
Definition of the SignedLong
model.
-
django_dicom.models.values.signed_long.
MAX_VALUE
= 2147483647¶ Maximal SignedLong value.
-
django_dicom.models.values.signed_long.
MIN_VALUE
= -2147483648¶ Minimal SignedLong value.
-
class
django_dicom.models.values.signed_long.
SignedLong
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single SignedLong data element value.-
raw
¶ Overrides
raw
to assign anIntegerField
.
-
value
¶ Overrides
value
to assign anIntegerField
.
-
django_dicom.models.values.signed_short module¶
Definition of the SignedShort
model.
-
django_dicom.models.values.signed_short.
MAX_VALUE
= 32767¶ Maximal SignedShort value.
-
django_dicom.models.values.signed_short.
MIN_VALUE
= -32768¶ Minimal SignedShort value.
-
class
django_dicom.models.values.signed_short.
SignedShort
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single SignedShort data element value.-
raw
¶ Overrides
raw
to assign anIntegerField
.
-
value
¶ Overrides
value
to assign anIntegerField
.
-
django_dicom.models.values.time module¶
Definition of the Time
model.
-
class
django_dicom.models.values.time.
Time
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single Time data element value.
django_dicom.models.values.unique_identifier module¶
Definition of the UniqueIdentifier
model.
-
class
django_dicom.models.values.unique_identifier.
UniqueIdentifier
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single UniqueIdentifier data element value.
django_dicom.models.values.unlimited_text module¶
Definition of the UnlimitedText
model.
django_dicom.models.values.unsigned_long module¶
Definition of the UnsignedLong
model.
-
django_dicom.models.values.unsigned_long.
MAX_VALUE
= 4294967296¶ Maximal UnsignedLong value.
-
class
django_dicom.models.values.unsigned_long.
UnsignedLong
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single UnsignedLong data element value.-
raw
¶ Overrides
raw
to assign aPositiveIntegerField
.
-
value
¶ Overrides
value
to assign aPositiveIntegerField
.
-
django_dicom.models.values.unsigned_short module¶
Definition of the UnsignedShort
model.
-
django_dicom.models.values.unsigned_short.
MAX_VALUE
= 65536¶ Maximal UnsignedShort value.
-
class
django_dicom.models.values.unsigned_short.
UnsignedShort
(*args, **kwargs)¶ Bases:
django_dicom.models.values.data_element_value.DataElementValue
A
Model
representing a single UnsignedShort data element value.-
raw
¶ Overrides
raw
to assign aPositiveIntegerField
.
-
value
¶ Overrides
value
to assign aPositiveIntegerField
.
-
django_dicom.models.values.vr_to_model module¶
A utility module used to get the appropriate
DataElementValue
subclass (“ValueModel”) for a given data element.
-
django_dicom.models.values.vr_to_model.
TAG_TO_MODEL
= {('0029', '1010'): 'CsaHeader', ('0029', '1020'): 'CsaHeader'}¶ Special cases might require a custom
DataElementValue
subclass based on the element’s tag rather than its VR.
-
django_dicom.models.values.vr_to_model.
VR_TO_MODEL
= {<ValueRepresentation.AE: 'Application Entity'>: 'ApplicationEntity', <ValueRepresentation.AS: 'Age String'>: 'AgeString', <ValueRepresentation.CS: 'Code String'>: 'CodeString', <ValueRepresentation.DA: 'Date'>: 'Date', <ValueRepresentation.DT: 'Date Time'>: 'DateTime', <ValueRepresentation.DS: 'Decimal String'>: 'DecimalString', <ValueRepresentation.FD: 'Floating Point Double'>: 'FloatingPointDouble', <ValueRepresentation.FL: 'Floating Point Single'>: 'FloatingPointSingle', <ValueRepresentation.IS: 'Integer String'>: 'IntegerString', <ValueRepresentation.LO: 'Long String'>: 'LongString', <ValueRepresentation.LT: 'Long Text'>: 'LongText', <ValueRepresentation.OW: 'Other Word'>: 'OtherWord', <ValueRepresentation.PN: 'Person Name'>: 'PersonName', <ValueRepresentation.SH: 'Short String'>: 'ShortString', <ValueRepresentation.SL: 'Signed Long'>: 'SignedLong', <ValueRepresentation.SQ: 'Sequence of Items'>: 'SequenceOfItems', <ValueRepresentation.SS: 'Signed Short'>: 'SignedShort', <ValueRepresentation.ST: 'Short Text'>: 'ShortText', <ValueRepresentation.TM: 'Time'>: 'Time', <ValueRepresentation.UI: 'Unique Identifer'>: 'UniqueIdentifier', <ValueRepresentation.UL: 'Unsigned Long'>: 'UnsignedLong', <ValueRepresentation.UN: 'Unknown'>: 'Unknown', <ValueRepresentation.US: 'Unsigned Short'>: 'UnsignedShort', <ValueRepresentation.UT: 'Unlimited Text'>: 'UnlimitedText'}¶ Dictionary with
ValueRepresentation
items as keys and strings representing the appropriateDataElementValue
subclass as values.
-
django_dicom.models.values.vr_to_model.
get_value_model
(data_element: dicom_parser.data_element.DataElement)¶ Returns the
DataElementValue
subclass matching the given data element.Parameters: data_element ( dicom_parser.data_element.DataElement
) – Object representing a single data element in memoryReturns: Value model Return type: DataElementValue
-
django_dicom.models.values.vr_to_model.
get_value_model_name
(data_element: dicom_parser.data_element.DataElement) → str¶ Returns the name of the
DataElementValue
subclass matching the given data element.Parameters: data_element ( dicom_parser.data_element.DataElement
) – Object representing a single data element in memoryReturns: Name of the appropriate “ValueModel” Return type: str