From be31e028c2a972e5a8389382c8983085983f148a Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Wed, 29 Oct 2025 15:18:38 -0400 Subject: [PATCH 1/2] fix process --- main.nf | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.nf b/main.nf index 88da20d..5b6bf72 100644 --- a/main.nf +++ b/main.nf @@ -636,10 +636,18 @@ process Bundle_Endpoints_Metrics { b_metrics+=" afd_metric.nii.gz" fi - scil_tractogram_project_streamlines_to_map.py \$bundle \${bname} --in_metrics \${b_metrics} --from_wm + scil_tractogram_project_map_to_streamlines.py \${bundle} \${bundle/.trk/_with_dpp.trk} \ + --in_maps \${b_metrics} \ + --out_dpp_name \${b_metrics//.nii.gz/} + + scil_tractogram_project_streamlines_to_map.py \${bundle/.trk/_with_dpp.trk} \${bname}/ \ + --use_dpp \${b_metrics//.nii.gz/} \ + --mean_streamline \ + --to_endpoints + cd \${bname} for i in *.nii.gz; - do mv "\$i" "${sid}__\$i"; + do mv "\$i" "${sid}__\${i/.nii.gz/_endpoints_metric.nii.gz}"; done for i in *; From 918f62d65fc1a6cce2f55823cad5d13cf2c0630e Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Wed, 5 Nov 2025 16:34:25 -0500 Subject: [PATCH 2/2] fix endpoint metrics with more than 10 dpp --- main.nf | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/main.nf b/main.nf index 5b6bf72..eb1404e 100644 --- a/main.nf +++ b/main.nf @@ -329,7 +329,6 @@ process Bundle_Label_And_Distance_Maps { bname=\$(basename \$bundle .trk) fi bname=\${bname/_ic/} - centroid=${sid}__\${bname}_centroid_${params.nb_points}.trk if [[ -f \${centroid} ]]; then scil_bundle_label_map.py \$bundle \${centroid} tmp_out -f @@ -636,14 +635,23 @@ process Bundle_Endpoints_Metrics { b_metrics+=" afd_metric.nii.gz" fi - scil_tractogram_project_map_to_streamlines.py \${bundle} \${bundle/.trk/_with_dpp.trk} \ - --in_maps \${b_metrics} \ - --out_dpp_name \${b_metrics//.nii.gz/} + IFS=' ' read -r -a all_items <<< "\${b_metrics}" + + block_size=10 + i=0 + while [ \$i -lt \${#all_items[@]} ]; do + subset=("\${all_items[@]:\$i:\$block_size}") + scil_tractogram_project_map_to_streamlines.py \${bundle} \${bundle/.trk/_with_dpp.trk} \ + --in_maps \${subset[@]} \ + --out_dpp_name \${subset[@]//.nii.gz/} -f - scil_tractogram_project_streamlines_to_map.py \${bundle/.trk/_with_dpp.trk} \${bname}/ \ - --use_dpp \${b_metrics//.nii.gz/} \ - --mean_streamline \ - --to_endpoints + scil_tractogram_project_streamlines_to_map.py \${bundle/.trk/_with_dpp.trk} \${bname}/ \ + --use_dpp \${subset[@]//.nii.gz/} \ + --mean_streamline \ + --to_endpoints + + ((i += block_size)) + done cd \${bname} for i in *.nii.gz;