@@ -230,6 +230,7 @@ def pack_BV_header(hdr_dict_proto, hdr_dict, parent_hdr_dict=None):
230
230
if hdr_dict [def_or_name [1 ]] == def_or_name [2 ]:
231
231
part = pack ('<' + pack_format , value )
232
232
else :
233
+ # skip to next header field if condition is not met
233
234
continue
234
235
else :
235
236
part = pack ('<' + pack_format , value )
@@ -309,7 +310,7 @@ def update_BV_header(hdr_dict_proto, hdr_dict_old, hdr_dict_new,
309
310
When update_BV_header() is called recursively the not yet updated
310
311
(parent) hdr_dict is passed to give access to n_fields_name fields
311
312
outside the current scope (see below).
312
- parent_new: OrderedDict
313
+ parent_new: None or OrderedDict, optional
313
314
When update_BV_header() is called recursively the not yet updated
314
315
(parent) hdr_dict is passed to give access to n_fields_name fields
315
316
outside the current scope (see below).
@@ -321,16 +322,18 @@ def update_BV_header(hdr_dict_proto, hdr_dict_old, hdr_dict_new,
321
322
conditional fields.
322
323
"""
323
324
for name , pack_format , def_or_name in hdr_dict_proto :
324
- # handle nested loop fields
325
- if isinstance (pack_format , tuple ):
325
+ # handle only nested loop fields
326
+ if not isinstance (pack_format , tuple ):
327
+ continue
328
+ else :
326
329
# calculate the change of array length and the new array length
327
330
if def_or_name in hdr_dict_old :
328
- delta_values = hdr_dict_new [def_or_name ] - \
329
- hdr_dict_old [def_or_name ]
331
+ delta_values = ( hdr_dict_new [def_or_name ] -
332
+ hdr_dict_old [def_or_name ])
330
333
n_values = hdr_dict_new [def_or_name ]
331
334
else :
332
- delta_values = parent_new [def_or_name ] - \
333
- parent_old [def_or_name ]
335
+ delta_values = ( parent_new [def_or_name ] -
336
+ parent_old [def_or_name ])
334
337
n_values = parent_new [def_or_name ]
335
338
if delta_values > 0 : # add nested loops
336
339
for i in range (delta_values ):
@@ -384,8 +387,8 @@ def combine_st(st_array, inv=False):
384
387
385
388
Parameters
386
389
----------
387
- st_array: array
388
- array filled with transformation matrices of shape (4, 4)
390
+ st_array: array of shape (n, 4, 4)
391
+ array filled with n transformation matrices of shape (4, 4)
389
392
390
393
inv: boolean
391
394
Set to true to invert the transformation matrices before
@@ -754,12 +757,12 @@ def get_bbox_center(self):
754
757
framing cube.
755
758
"""
756
759
hdr = self ._hdr_dict
757
- x = hdr ['x_start' ] + \
758
- ((hdr ['x_end' ] - hdr ['x_start' ]) / 2 )
759
- y = hdr ['y_start' ] + \
760
- ((hdr ['y_end' ] - hdr ['y_start' ]) / 2 )
761
- z = hdr ['z_start' ] + \
762
- ((hdr ['z_end' ] - hdr ['z_start' ]) / 2 )
760
+ x = ( hdr ['x_start' ] +
761
+ ((hdr ['x_end' ] - hdr ['x_start' ]) / 2 ) )
762
+ y = ( hdr ['y_start' ] +
763
+ ((hdr ['y_end' ] - hdr ['y_start' ]) / 2 ) )
764
+ z = ( hdr ['z_start' ] +
765
+ ((hdr ['z_end' ] - hdr ['z_start' ]) / 2 ) )
763
766
return z , y , x
764
767
765
768
def get_zooms (self ):
0 commit comments