Skip to content

Commit

Permalink
added __str__ methods for cube types (pytrip#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoanka committed Oct 30, 2021
1 parent f519773 commit 64535a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytrip/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def __init__(self, cube=None):

self.z_table = False # positions are stored in self.slice_pos (list of slice#,pos(mm),thickness(mm),tilt)

def __str__(self):
return "Cube: "+self.basename

def __add__(self, other):
""" Overload + operator
"""
Expand Down
5 changes: 5 additions & 0 deletions pytrip/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def __init__(self, cube=None):
self._plan_dicom_series_instance_uid = uid.generate_uid(prefix=None)
self._dose_dicom_series_instance_uid = uid.generate_uid(prefix=None)

def __str__(self):
if self.type == "DOS":
return "Dose: " + self.basename
return "Dose (type " + self.type + "): " + self.basename

def read_dicom(self, dcm):
""" Imports the dose distribution from DICOM object.
Expand Down
5 changes: 5 additions & 0 deletions pytrip/let.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def __init__(self, cube=None):
self.type = "LET"
self.let_type = None

def __str__(self):
if self.type == "LET":
return "LET: " + self.basename
return "LET (type " + self.type + "): " + self.basename

def get_max(self):
""" Returns the largest value in the LETCube.
Expand Down

0 comments on commit 64535a3

Please sign in to comment.