@@ -29,13 +29,13 @@ class AlgorithmIdentificationSequence(DataElementSequence):
2929 """
3030
3131 def __init__ (
32- self ,
33- name : str ,
34- family : Union [Code , CodedConcept ],
35- version : str ,
36- source : Optional [str ] = None ,
37- parameters : Optional [Dict [str , str ]] = None
38- ):
32+ self ,
33+ name : str ,
34+ family : Union [Code , CodedConcept ],
35+ version : str ,
36+ source : Optional [str ] = None ,
37+ parameters : Optional [Dict [str , str ]] = None
38+ ):
3939 """
4040 Parameters
4141 ----------
@@ -81,11 +81,11 @@ class PixelMeasuresSequence(DataElementSequence):
8181 """
8282
8383 def __init__ (
84- self ,
85- pixel_spacing : Sequence [float ],
86- slice_thickness : float ,
87- spacing_between_slices : Optional [float ] = None ,
88- ) -> None :
84+ self ,
85+ pixel_spacing : Sequence [float ],
86+ slice_thickness : float ,
87+ spacing_between_slices : Optional [float ] = None ,
88+ ) -> None :
8989 """
9090 Parameters
9191 ----------
@@ -148,6 +148,7 @@ def __init__(
148148 def ds (num : float ) -> float :
149149 return float (str (num )[:16 ])
150150
151+ coordinate_system = CoordinateSystemNames (coordinate_system )
151152 if coordinate_system == CoordinateSystemNames .SLIDE :
152153 if pixel_matrix_position is None :
153154 raise TypeError (
@@ -163,6 +164,10 @@ def ds(num: float) -> float:
163164 item .ColumnPositionInTotalImagePixelMatrix = col_position
164165 elif coordinate_system == CoordinateSystemNames .PATIENT :
165166 item .ImagePositionPatient = list (image_position )
167+ else :
168+ raise ValueError (
169+ f'Unknown coordinate system "{ coordinate_system .value } ".'
170+ )
166171 self .append (item )
167172
168173 def __eq__ (self , other : Any ) -> bool :
@@ -216,10 +221,10 @@ class PlaneOrientationSequence(DataElementSequence):
216221 """
217222
218223 def __init__ (
219- self ,
220- coordinate_system : Union [str , CoordinateSystemNames ],
221- image_orientation : Sequence [float ]
222- ) -> None :
224+ self ,
225+ coordinate_system : Union [str , CoordinateSystemNames ],
226+ image_orientation : Sequence [float ]
227+ ) -> None :
223228 """
224229 Parameters
225230 ----------
@@ -233,12 +238,16 @@ def __init__(
233238
234239 """
235240 super ().__init__ ()
236- coordinate_system = CoordinateSystemNames (coordinate_system )
237241 item = Dataset ()
242+ coordinate_system = CoordinateSystemNames (coordinate_system )
238243 if coordinate_system == CoordinateSystemNames .SLIDE :
239244 item .ImageOrientationSlide = list (image_orientation )
240245 elif coordinate_system == CoordinateSystemNames .PATIENT :
241246 item .ImageOrientationPatient = list (image_orientation )
247+ else :
248+ raise ValueError (
249+ f'Unknown coordinate system "{ coordinate_system .value } ".'
250+ )
242251 self .append (item )
243252
244253 def __eq__ (self , other : Any ) -> bool :
0 commit comments