Ejemplo n.º 1
0
    def __init__(
        self,
        value_type: Union[str, ValueTypeValues],
        name: Union[Code, CodedConcept],
        relationship_type: Optional[Union[str, RelationshipTypeValues]] = None
    ) -> None:
        """
        Parameters
        ----------
        value_type: Union[str, highdicom.sr.enum.ValueTypeValues]
            type of value encoded in a content item
        name: Union[highdicom.sr.coding.CodedConcept, pydicom.sr.coding.Code]
            coded name or an enumerated item representing a coded name
        relationship_type: Union[str, highdicom.sr.enum.RelationshipTypeValues], optional
            type of relationship with parent content item

        """  # noqa
        super(ContentItem, self).__init__()
        value_type = ValueTypeValues(value_type)
        self.ValueType = value_type.value
        if not isinstance(name, (
                CodedConcept,
                Code,
        )):
            raise TypeError(
                'Argument "name" must have type CodedConcept or Code.')
        if isinstance(name, Code):
            name = CodedConcept(*name)
        self.ConceptNameCodeSequence = [name]
        if relationship_type is not None:
            relationship_type = RelationshipTypeValues(relationship_type)
            self.RelationshipType = relationship_type.value
Ejemplo n.º 2
0
 def has_value_type(
         item: ContentItem, value_type: Optional[Union[ValueTypeValues,
                                                       str]]) -> bool:
     if value_type is None:
         return True
     value_type = ValueTypeValues(value_type)
     return item.value_type == value_type.value
    def value_type(self) -> ValueTypeValues:
        """ValueTypeValues: type of the content item
        (see `highdicom.sr.ValueTypeValues`)

        """
        return ValueTypeValues(self.ValueType)