File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 44"""
55
66import json
7+ import re
78from pathlib import Path
89
910import numpy as np
@@ -901,8 +902,9 @@ def assign_variants(summary, rename_cols):
901902 Notes
902903 -----
903904 Variant names are constructed using the following rules:
904- 1. Basic parameters use their actual values (e.g., VARIANTFlipAngle75)
905- 2. Clustered parameters use their cluster numbers (e.g., VARIANTEchoTime2)
905+ 1. Basic parameters use their actual values (e.g., VARIANTFlipAngle75),
906+ with non-alphanumeric characters removed.
907+ 2. Clustered parameters use their cluster numbers prefixed with "C" (e.g., VARIANTEchoTimeC2)
906908 3. Special parameters like HasFieldmap use predefined strings (e.g., VARIANTNoFmap)
907909 4. Multiple parameters are concatenated (e.g., VARIANTEchoTime2FlipAngle75)
908910 """
@@ -972,6 +974,13 @@ def assign_variants(summary, rename_cols):
972974 # If the value is an actual float
973975 elif isinstance (val , float ):
974976 val = str (val ).replace ("." , "p" )
977+ if val .endswith ("p0" ):
978+ # Remove the trailing "p0"
979+ val = val [:- 2 ]
980+
981+ # Filter out non-alphanumeric characters
982+ val = re .sub (r"[^a-zA-Z0-9]" , "" , val )
983+
975984 acq_str += f"{ col } { val } "
976985
977986 if acq_str == "VARIANT" :
You can’t perform that action at this time.
0 commit comments