@@ -316,19 +316,29 @@ def run(
316316 elif input_ .type == InterfaceTypes .TransformList :
317317 transform_list = input_ .data
318318 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+
332342 transform_json = {
333343 "transformType" : asdict (transform .transformType ),
334344 "numberOfFixedParameters" : transform .numberOfFixedParameters ,
@@ -540,22 +550,33 @@ def run(
540550 elif output .type == InterfaceTypes .TransformList :
541551 transform_list_json = ri .get_output_json (index )
542552 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 :
544555 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+
545562 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 )
548565 transform .fixedParameters = buffer_to_numpy_array (
549566 FloatTypes .Float64 ,
550567 ri .wasmtime_lift (data_ptr , data_size ),
551568 )
569+ output_array_index += 1
570+
552571 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 )
555574 transform .parameters = buffer_to_numpy_array (
556575 transform .transformType .parametersValueType ,
557576 ri .wasmtime_lift (data_ptr , data_size ),
558577 )
578+ output_array_index += 1
579+
559580 transform_list .append (transform )
560581 output_data = PipelineOutput (InterfaceTypes .TransformList , transform_list )
561582 elif output .type == InterfaceTypes .PolyData :
0 commit comments