Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New labels map update #13

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ OPTIONAL ARGUMENTS (current value)
--use_provided_centroids Use the provided pre-computed centroids rather than using automatic computation ($use_provided_centroids)
--bundle_suffix_to_remove Use to remove the suffix from RBx-Flow ($bundle_suffix_to_remove)

--min_streamline_count Minimum streamline count threshold from trimming of 'edges' in the voxel labels map
--min_voxel_count Minimum voxel count threshold from trimming of 'edges' in the voxel labels map
--min_streamline_count Minimum streamline count threshold from trimming of 'edges' in the voxel labels map ($min_streamline_count)
--min_voxel_count Minimum voxel count threshold from trimming of 'edges' in the voxel labels map ($min_voxel_count)

--mean_std_density_weighting Weight the mean/std by the local tract density ($mean_std_density_weighting)
--mean_std_per_point_density_weighting Weight the mean/std per point by the local tract density ($mean_std_per_point_density_weighting)
Expand Down
34 changes: 18 additions & 16 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ process Bundle_Label_And_Distance_Maps {
bundles_centroids_for_label_and_distance_map

output:
set sid, "${sid}__*_labels.npz", "${sid}__*_distances.npz" into\
set sid, "${sid}__*_labels.nii.gz", "${sid}__*_distances.nii.gz" into\
label_distance_maps_for_mean_std_per_point
set sid, "${sid}__*_labels.trk" into bundles_for_uniformize
file "${sid}__*_distances.trk"
Expand All @@ -243,15 +243,17 @@ process Bundle_Label_And_Distance_Maps {
bname=\${bname/_ic/}

centroid=${sid}__\${bname}_centroid_${params.nb_points}.trk
scil_compute_bundle_voxel_label_map.py \$bundle \${centroid} \
${sid}__\${bname}_labels.nii.gz \
--out_labels_npz ${sid}__\${bname}_labels.npz \
--out_distances_npz ${sid}__\${bname}_distances.npz \
--labels_color_dpp ${sid}__\${bname}_labels.trk \
--distances_color_dpp ${sid}__\${bname}_distances.trk \
scil_compute_bundle_voxel_label_map.py \$bundle \${centroid} tmp_out\
--min_streamline_count ${params.min_streamline_count} \
--min_voxel_count ${params.min_voxel_count}
done
--min_voxel_count ${params.min_voxel_count} -f

mv tmp_out/labels_map.nii.gz ${sid}__\${bname}_labels.nii.gz
mv tmp_out/distance_map.nii.gz ${sid}__\${bname}_distances.nii.gz

mv tmp_out/labels.trk ${sid}__\${bname}_labels.trk
mv tmp_out/distance.trk ${sid}__\${bname}_distances.trk

done
"""
}

Expand Down Expand Up @@ -361,7 +363,7 @@ process Color_Bundle {
String bundles_list = bundles.join(", ").replace(',', '')
"""
echo '$json_str' >> colors.json
scil_assign_color_to_tractogram.py $bundles_list --dict_colors colors.json
scil_assign_uniform_color_to_tractograms.py $bundles_list --dict_colors colors.json
"""
}

Expand Down Expand Up @@ -694,16 +696,16 @@ process Bundle_Mean_Std_Per_Point {
fi
bname=\${bname/_uniformized/}
mv \$bundle \$bname.trk
label_map=${sid}__\${bname}_labels.npz
distance_map=${sid}__\${bname}_distances.npz
label_map=${sid}__\${bname}_labels.nii.gz
distance_map=${sid}__\${bname}_distances.nii.gz

if [ -f "\${bname}_afd_metric.nii.gz" ]; then
b_metrics="!(*afd*).nii.gz \${bname}_afd_metric.nii.gz"
else
b_metrics="$metrics"
fi

scil_compute_bundle_mean_std_per_point.py \$bname.trk \$label_map \$distance_map \
scil_compute_bundle_mean_std_per_point.py \$bname.trk \$label_map \
\${b_metrics} --sort_keys $density_weighting > \$bname.json
done
scil_merge_json.py *.json ${sid}__mean_std_per_point.json --no_list \
Expand All @@ -725,7 +727,7 @@ process Plot_Mean_Std_Per_Point {
"""
echo '$json_str' >> colors.json
scil_plot_mean_std_per_point.py $mean_std_per_point tmp_dir/ --dict_colors \
colors.json
colors.json --nb_pts $params.nb_points
mv tmp_dir/* ./
"""
}
Expand All @@ -743,7 +745,7 @@ process Plot_Lesions_Per_Point {
echo '$json_str' >> colors.json
scil_merge_json.py $lesion_per_point tmp.json --recursive --average_last_layer
scil_plot_mean_std_per_point.py tmp.json tmp_dir/ --dict_colors \
colors.json
colors.json --nb_pts $params.nb_points
mv tmp_dir/* ./
"""
}
Expand Down Expand Up @@ -998,7 +1000,7 @@ process Plot_Population_Mean_Std_Per_Point {
"""
echo '$json_str' >> colors.json
scil_plot_mean_std_per_point.py $json_a tmp_dir/ --dict_colors colors.json \
--stats_over_population
--stats_over_population --nb_pts $params.nb_points
mv tmp_dir/* ./
"""
}
4 changes: 2 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ params {
skip_projection_endpoints_metrics=true
bundle_suffix_to_remove='_cleaned'

min_streamline_count=1000
min_voxel_count=5000
min_streamline_count=100000
min_voxel_count=1000000

colors=["AC":"0x02d983",
"AF_L":"0xcc0000",
Expand Down