diff --git a/suspect/io/twix.py b/suspect/io/twix.py index 8501751..1ffd471 100644 --- a/suspect/io/twix.py +++ b/suspect/io/twix.py @@ -202,21 +202,24 @@ def parse_twix_header(header_string): r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r" { \d+ (-?[0-9\.]+)? }" + r" { \d+ (-?[0-9\.]+)? }", + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] pos_cor_matches = [ r"sSpecPara\.sVoI\.sPosition\.dCor\s*=\s*(-?[[0-9]*[.]?[0-9]*]{0,})\s*", r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r" { \d+ (-?[0-9\.]+)? }" + r" { \d+ (-?[0-9\.]+)? }", + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] pos_tra_matches = [ r"sSpecPara\.sVoI\.sPosition\.dTra\s*=\s*(-?[[0-9]*[.]?[0-9]*]{0,})\s*", r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r" { \d+ (-?[0-9\.]+)? }" + r" { \d+ (-?[0-9\.]+)? }", + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] pos_sag = get_meta_regex(pos_sag_matches, header_string, default=0) pos_cor = get_meta_regex(pos_cor_matches, header_string, default=0) @@ -236,7 +239,7 @@ def parse_twix_header(header_string): r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r"\s*{\s*\s*{\s*(-?[0-9\.]+)?\s*}" + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] normal_cor_matches = [ r"sSpecPara\.sVoI\.sNormal\.dCor\s*=\s*(-?[[0-9]*[.]?[0-9]*]{0,})\s*$", @@ -244,7 +247,7 @@ def parse_twix_header(header_string): r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r"\s*{\s*.*\s*\s*{\s*(-?[0-9\.]+)?\s*}" + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] normal_tra_matches = [ r"sSpecPara\.sVoI\.sNormal\.dTra\s*=\s*(-?[[0-9]*[.]?[0-9]*]{0,})\s*$", @@ -252,7 +255,7 @@ def parse_twix_header(header_string): r" { \d+( -?[0-9\.]+)? }", r"\s*{\s*(-?[0-9\.]+)?\s*}", r"\s*{\s*(-?[0-9\.]+)?\s*}", - r"\s*{\s*.*\s*.*\s*\s*{\s*(-?[0-9\.]+)?\s*}" + r"[\s\S]*?[\s\S]*?{ (-?[0-9\.]+)?\s?}" ] in_plane_rot = get_meta_regex(in_plane_rot_matches, header_string, default=0) normal_sag = get_meta_regex(normal_sag_matches, header_string, default=0)