@@ -316,19 +316,29 @@ def run(
316
316
elif input_ .type == InterfaceTypes .TransformList :
317
317
transform_list = input_ .data
318
318
transform_list_json = []
319
- for idx , transform in enumerate (transform_list ):
320
- if transform .numberOfFixedParameters :
321
- fpv = array_like_to_bytes (transform .fixedParameters )
322
- else :
323
- fpv = bytes ([])
324
- fixed_parameters_ptr = ri .set_input_array (fpv , index , idx * 2 )
325
- fixed_parameters = f"data:application/vnd.itk.address,0:{ fixed_parameters_ptr } "
326
- if transform .numberOfParameters :
327
- pv = array_like_to_bytes (transform .parameters )
328
- else :
329
- pv = bytes ([])
330
- parameters_ptr = ri .set_input_array (pv , index , idx * 2 + 1 )
331
- parameters = f"data:application/vnd.itk.address,0:{ parameters_ptr } "
319
+ input_array_index = 0
320
+ for transform in transform_list :
321
+ fixed_parameters = ""
322
+ parameters = ""
323
+
324
+ # Skip setting input arrays for Composite transforms as they don't have array data
325
+ if transform .transformType .transformParameterization != "Composite" :
326
+ if transform .numberOfFixedParameters :
327
+ fpv = array_like_to_bytes (transform .fixedParameters )
328
+ else :
329
+ fpv = bytes ([])
330
+ fixed_parameters_ptr = ri .set_input_array (fpv , index , input_array_index )
331
+ fixed_parameters = f"data:application/vnd.itk.address,0:{ fixed_parameters_ptr } "
332
+ input_array_index += 1
333
+
334
+ if transform .numberOfParameters :
335
+ pv = array_like_to_bytes (transform .parameters )
336
+ else :
337
+ pv = bytes ([])
338
+ parameters_ptr = ri .set_input_array (pv , index , input_array_index )
339
+ parameters = f"data:application/vnd.itk.address,0:{ parameters_ptr } "
340
+ input_array_index += 1
341
+
332
342
transform_json = {
333
343
"transformType" : asdict (transform .transformType ),
334
344
"numberOfFixedParameters" : transform .numberOfFixedParameters ,
@@ -540,22 +550,33 @@ def run(
540
550
elif output .type == InterfaceTypes .TransformList :
541
551
transform_list_json = ri .get_output_json (index )
542
552
transform_list = []
543
- for idx , transform_json in enumerate (transform_list_json ):
553
+ output_array_index = 0
554
+ for transform_json in transform_list_json :
544
555
transform = Transform (** transform_json )
556
+
557
+ # Skip array reading for Composite transforms as they don't have array data
558
+ if transform .transformType .transformParameterization == "Composite" :
559
+ transform_list .append (transform )
560
+ continue
561
+
545
562
if transform .numberOfFixedParameters > 0 :
546
- data_ptr = ri .get_output_array_address (0 , index , idx * 2 )
547
- data_size = ri .get_output_array_size (0 , index , idx * 2 )
563
+ data_ptr = ri .get_output_array_address (0 , index , output_array_index )
564
+ data_size = ri .get_output_array_size (0 , index , output_array_index )
548
565
transform .fixedParameters = buffer_to_numpy_array (
549
566
FloatTypes .Float64 ,
550
567
ri .wasmtime_lift (data_ptr , data_size ),
551
568
)
569
+ output_array_index += 1
570
+
552
571
if transform .numberOfParameters > 0 :
553
- data_ptr = ri .get_output_array_address (0 , index , idx * 2 + 1 )
554
- data_size = ri .get_output_array_size (0 , index , idx * 2 + 1 )
572
+ data_ptr = ri .get_output_array_address (0 , index , output_array_index )
573
+ data_size = ri .get_output_array_size (0 , index , output_array_index )
555
574
transform .parameters = buffer_to_numpy_array (
556
575
transform .transformType .parametersValueType ,
557
576
ri .wasmtime_lift (data_ptr , data_size ),
558
577
)
578
+ output_array_index += 1
579
+
559
580
transform_list .append (transform )
560
581
output_data = PipelineOutput (InterfaceTypes .TransformList , transform_list )
561
582
elif output .type == InterfaceTypes .PolyData :
0 commit comments