diff --git a/TPTBox/core/poi.py b/TPTBox/core/poi.py index b3eb7c5..ff97cb0 100755 --- a/TPTBox/core/poi.py +++ b/TPTBox/core/poi.py @@ -1247,3 +1247,16 @@ def calc_poi_average(pois: list[POI], keep_points_not_present_in_all_pois: bool # Sort the new ctd by keys ctd = dict(sorted(ctd.items())) return POI(centroids=ctd, orientation=pois[0].orientation, zoom=pois[0].zoom, shape=pois[0].shape, rotation=pois[0].rotation) + + +def _load_from_POI_spine_r(data: dict): + orientation = None + centroids = POI_Descriptor() + for d in data["centroids"]["centroids"]: + if "direction" in d: + orientation = d["direction"] + continue + centroids[d["label"], 50] = (d["X"], d["Y"], d["Z"]) + zoom = data["Spacing"] + shape = data["Shape"] + return POI(centroids, orientation=orientation, zoom=zoom, shape=shape, info=data, rotation=None) # type: ignore diff --git a/TPTBox/core/poi_fun/poi_global.py b/TPTBox/core/poi_fun/poi_global.py index 016bf72..3636676 100755 --- a/TPTBox/core/poi_fun/poi_global.py +++ b/TPTBox/core/poi_fun/poi_global.py @@ -69,6 +69,12 @@ def zoom(self): def origin(self): return (0, 0, 0) + @property + def orientation(self): + if self.itk_coords: + return ("L", "A", "S") + return ("R", "P", "S") + @property def is_global(self) -> bool: """ diff --git a/TPTBox/core/vert_constants.py b/TPTBox/core/vert_constants.py index 79d4e94..62ec764 100755 --- a/TPTBox/core/vert_constants.py +++ b/TPTBox/core/vert_constants.py @@ -140,6 +140,81 @@ def _get_id(cls, s: str | int, no_raise=True) -> int: # noqa: ARG003 return int(s) +class Full_Body_Instance_Vibe(Abstract_lvl): + spleen = 1 + kidney_right = 2 + kidney_left = 3 + gallbladder = 4 + liver = 5 + stomach = 6 + pancreas = 7 + adrenal_gland_right = 8 + adrenal_gland_left = 9 + lung_upper_lobe_left = 10 + lung_lower_lobe_left = 11 + lung_upper_lobe_right = 12 + lung_middle_lobe_right = 13 + lung_lower_lobe_right = 14 + esophagus = 15 + trachea = 16 + thyroid_gland = 17 + intestine = 18 + duodenum = 19 + unused = 20 + urinary_bladder = 21 + prostate = 22 + sacrum = 23 + heart = 24 + aorta = 25 + pulmonary_vein = 26 + brachiocephalic_trunk = 27 + subclavian_artery_right = 28 + subclavian_artery_left = 29 + common_carotid_artery_right = 30 + common_carotid_artery_left = 31 + brachiocephalic_vein_left = 32 + brachiocephalic_vein_right = 33 + atrial_appendage_left = 34 + superior_vena_cava = 35 + inferior_vena_cava = 36 + portal_vein_and_splenic_vein = 37 + iliac_artery_left = 38 + iliac_artery_right = 39 + iliac_vena_left = 40 + iliac_vena_right = 41 + humerus_left = 42 + humerus_right = 43 + scapula_left = 44 + scapula_right = 45 + clavicula_left = 46 + clavicula_right = 47 + femur_left = 48 + femur_right = 49 + hip_left = 50 + hip_right = 51 + spinal_cord = 52 + gluteus_maximus_left = 53 + gluteus_maximus_right = 54 + gluteus_medius_left = 55 + gluteus_medius_right = 56 + gluteus_minimus_left = 57 + gluteus_minimus_right = 58 + autochthon_left = 59 + autochthon_right = 60 + iliopsoas_left = 61 + iliopsoas_right = 62 + sternum = 63 + costal_cartilages = 64 + subcutaneous_fat = 65 + muscle = 66 + inner_fat = 67 + IVD = 68 + vertebra_body = 69 + vertebra_posterior_elements = 70 + spinal_channel = 71 + bone_other = 72 + + class Full_Body_Instance(Abstract_lvl): skull = 1 clavicula_right = 2