retuve.hip_us.classes.enums

Enums relating to Hip Ultrasound.

 1# Copyright 2024 Adam McArthur
 2#
 3# Licensed under the Apache License, Version 2.0 (the "License");
 4# you may not use this file except in compliance with the License.
 5# You may obtain a copy of the License at
 6#
 7#     http://www.apache.org/licenses/LICENSE-2.0
 8#
 9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""
16Enums relating to Hip Ultrasound.
17
18"""
19
20from enum import Enum
21from typing import List
22
23
24class Side(Enum):
25    """
26    For defining how far through a 3D Ultrasound volume the image is taken.
27    """
28
29    ANT = 0
30    POST = 1
31    GRAF = 2
32
33    @classmethod
34    def ALL(cls) -> List["Side"]:
35        """
36        Return all the sides
37        """
38        return [Side.POST, Side.ANT, Side.GRAF]
39
40    @classmethod
41    def get_name(cls, side: "Side") -> str:
42        """
43        Return the full name of the side from the abbreviation.
44        """
45        if side == Side.ANT:
46            return "Anterior"
47        elif side == Side.POST:
48            return "Posterior"
49        elif side == Side.GRAF:
50            return "Central"
51        else:
52            return "Unknown"
53
54
55class HipLabelsUS(Enum):
56    """
57    Segmentation labels for Hip Ultrasound.
58    """
59
60    IlliumAndAcetabulum = 0
61    FemoralHead = 1
62    OsIchium = 2
63
64    @classmethod
65    def get_name(cls, label: "HipLabelsUS") -> str:
66        """
67        Return the full name of the label from the abbreviation.
68        """
69
70        if label == HipLabelsUS.IlliumAndAcetabulum:
71            return "Illium and Acetabulum"
72        elif label == HipLabelsUS.FemoralHead:
73            return "Femoral Head"
74        elif label == HipLabelsUS.OsIchium:
75            return "Os Ichium"
76        else:
77            return "Unknown"
class Side(enum.Enum):
25class Side(Enum):
26    """
27    For defining how far through a 3D Ultrasound volume the image is taken.
28    """
29
30    ANT = 0
31    POST = 1
32    GRAF = 2
33
34    @classmethod
35    def ALL(cls) -> List["Side"]:
36        """
37        Return all the sides
38        """
39        return [Side.POST, Side.ANT, Side.GRAF]
40
41    @classmethod
42    def get_name(cls, side: "Side") -> str:
43        """
44        Return the full name of the side from the abbreviation.
45        """
46        if side == Side.ANT:
47            return "Anterior"
48        elif side == Side.POST:
49            return "Posterior"
50        elif side == Side.GRAF:
51            return "Central"
52        else:
53            return "Unknown"

For defining how far through a 3D Ultrasound volume the image is taken.

ANT = <Side.ANT: 0>
POST = <Side.POST: 1>
GRAF = <Side.GRAF: 2>
@classmethod
def ALL(cls) -> List[Side]:
34    @classmethod
35    def ALL(cls) -> List["Side"]:
36        """
37        Return all the sides
38        """
39        return [Side.POST, Side.ANT, Side.GRAF]

Return all the sides

@classmethod
def get_name(cls, side: Side) -> str:
41    @classmethod
42    def get_name(cls, side: "Side") -> str:
43        """
44        Return the full name of the side from the abbreviation.
45        """
46        if side == Side.ANT:
47            return "Anterior"
48        elif side == Side.POST:
49            return "Posterior"
50        elif side == Side.GRAF:
51            return "Central"
52        else:
53            return "Unknown"

Return the full name of the side from the abbreviation.

Inherited Members
enum.Enum
name
value
class HipLabelsUS(enum.Enum):
56class HipLabelsUS(Enum):
57    """
58    Segmentation labels for Hip Ultrasound.
59    """
60
61    IlliumAndAcetabulum = 0
62    FemoralHead = 1
63    OsIchium = 2
64
65    @classmethod
66    def get_name(cls, label: "HipLabelsUS") -> str:
67        """
68        Return the full name of the label from the abbreviation.
69        """
70
71        if label == HipLabelsUS.IlliumAndAcetabulum:
72            return "Illium and Acetabulum"
73        elif label == HipLabelsUS.FemoralHead:
74            return "Femoral Head"
75        elif label == HipLabelsUS.OsIchium:
76            return "Os Ichium"
77        else:
78            return "Unknown"

Segmentation labels for Hip Ultrasound.

IlliumAndAcetabulum = <HipLabelsUS.IlliumAndAcetabulum: 0>
FemoralHead = <HipLabelsUS.FemoralHead: 1>
OsIchium = <HipLabelsUS.OsIchium: 2>
@classmethod
def get_name(cls, label: HipLabelsUS) -> str:
65    @classmethod
66    def get_name(cls, label: "HipLabelsUS") -> str:
67        """
68        Return the full name of the label from the abbreviation.
69        """
70
71        if label == HipLabelsUS.IlliumAndAcetabulum:
72            return "Illium and Acetabulum"
73        elif label == HipLabelsUS.FemoralHead:
74            return "Femoral Head"
75        elif label == HipLabelsUS.OsIchium:
76            return "Os Ichium"
77        else:
78            return "Unknown"

Return the full name of the label from the abbreviation.

Inherited Members
enum.Enum
name
value