Esempio n. 1
0
    def __init__(
            self,
            graphic_type: Union[GraphicTypeValues3D, str],
            graphic_data: np.ndarray,
            frame_of_reference_uid: str,
            source_images: Optional[
                Sequence[SourceImageForSegmentation]] = None,
            source_series: Optional[SourceSeriesForSegmentation] = None
    ) -> None:
        """
        Parameters
        ----------
        graphic_type: Union[highdicom.sr.enum.GraphicTypeValues3D, str]
            name of the graphic type
        graphic_data: Sequence[Sequence[int]]
            ordered set of (row, column, frame) coordinate pairs
        frame_of_reference_uid: str
            unique identifier of the frame of reference within which the
            coordinates are defined
        source_images: Sequence[highdicom.sr.content.SourceImageForSegmentation], optional
            source images for segmentation
        source_series: highdicom.sr.content.SourceSeriesForSegmentation, optional
            source series for segmentation

        Note
        ----
        Either one or more source images or one source series must be provided.

        """  # noqa
        graphic_type = GraphicTypeValues3D(graphic_type)
        if graphic_type != GraphicTypeValues3D.ELLIPSOID:
            raise ValueError(
                'Graphic type for volume surface must be "ELLIPSOID".')
        super().__init__(name=CodedConcept(value='121231',
                                           meaning='Volume Surface',
                                           scheme_designator='DCM'),
                         frame_of_reference_uid=frame_of_reference_uid,
                         graphic_type=graphic_type,
                         graphic_data=graphic_data,
                         relationship_type=RelationshipTypeValues.CONTAINS)
        self.ContentSequence = ContentSequence()
        if source_images is not None:
            for image in source_images:
                if not isinstance(image, SourceImageForSegmentation):
                    raise TypeError(
                        'Items of argument "source_image" must have type '
                        'SourceImageForSegmentation.')
                self.ContentSequence.append(image)
        elif source_series is not None:
            if not isinstance(source_series, SourceSeriesForSegmentation):
                raise TypeError('Argument "source_series" must have type '
                                'SourceSeriesForSegmentation.')
            self.ContentSequence.append(source_series)
        else:
            raise ValueError(
                'One of the following two arguments must be provided: '
                '"source_images" or "source_series".')
class FindingSite(CodeContentItem):

    """Content item representing a coded finding site."""

    def __init__(
        self,
        anatomic_location: Union[CodedConcept, Code],
        laterality: Optional[Union[CodedConcept, Code]] = None,
        topographical_modifier: Optional[Union[CodedConcept, Code]] = None
    ) -> None:
        """
        Parameters
        ----------
        anatomic_location: Union[highdicom.sr.CodedConcept, pydicom.sr.coding.Code]
            coded anatomic location (region or structure)
        laterality: Union[highdicom.sr.CodedConcept, pydicom.sr.coding.Code], optional
            coded laterality (see :dcm:`CID 244 <part16/sect_CID_244.html>`
            "Laterality" for options)
        topographical_modifier: Union[highdicom.sr.CodedConcept, pydicom.sr.coding.Code], optional
            coded modifier of anatomic location

        """  # noqa
        super().__init__(
            name=CodedConcept(
                value='363698007',
                meaning='Finding Site',
                scheme_designator='SCT'
            ),
            value=anatomic_location,
            relationship_type=RelationshipTypeValues.HAS_CONCEPT_MOD
        )
        if laterality is not None or topographical_modifier is not None:
            self.ContentSequence = ContentSequence()
            if laterality is not None:
                laterality_item = CodeContentItem(
                    name=CodedConcept(
                        value='272741003',
                        meaning='Laterality',
                        scheme_designator='SCT'
                    ),
                    value=laterality,
                    relationship_type=RelationshipTypeValues.HAS_CONCEPT_MOD
                )
                self.ContentSequence.append(laterality_item)
            if topographical_modifier is not None:
                modifier_item = CodeContentItem(
                    name=CodedConcept(
                        value='106233006',
                        meaning='Topographical Modifier',
                        scheme_designator='SCT'
                    ),
                    value=topographical_modifier,
                    relationship_type=RelationshipTypeValues.HAS_CONCEPT_MOD
                )
                self.ContentSequence.append(modifier_item)
Esempio n. 3
0
    def __init__(
            self,
            value: Optional[Union[int, float]],
            unit: Optional[Union[CodedConcept, Code]] = None,
            event_type: Optional[Union[CodedConcept, Code]] = None) -> None:
        """
        Parameters
        ----------
        value: Union[int, float], optional
            offset in time from a particular event of significance
        unit: Union[highdicom.sr.coding.CodedConcept, pydicom.sr.coding.Code], optional
            unit of time, e.g., "Days" or "Seconds"
        event_type: Union[highdicom.sr.coding.CodedConcept, pydicom.sr.coding.Code], optional
            type of event to which offset is relative,
            e.g., "Baseline" or "Enrollment"

        """  # noqa
        super().__init__(
            name=CodedConcept(
                value='128740',
                meaning='Longitudinal Temporal Offset from Event',
                scheme_designator='DCM'),
            value=value,
            unit=unit,
            relationship_type=RelationshipTypeValues.HAS_OBS_CONTEXT)
        event_type_item = CodeContentItem(
            name=CodedConcept(value='128741',
                              meaning='Longitudinal Temporal Event Type',
                              scheme_designator='DCM'),
            value=event_type,
            relationship_type=RelationshipTypeValues.HAS_CONCEPT_MOD)
        self.ContentSequence = ContentSequence([event_type_item])