From b87a2255dc0a5ac1a0674d5e830400793c2199f0 Mon Sep 17 00:00:00 2001 From: Bartosz Kossowski Date: Fri, 9 Apr 2021 15:50:23 +0200 Subject: [PATCH] Add a few workarounds to load new RDAs from Vida scanner A bit nasty --- suspect/io/rda.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/suspect/io/rda.py b/suspect/io/rda.py index 722db2b..ab839b0 100644 --- a/suspect/io/rda.py +++ b/suspect/io/rda.py @@ -25,10 +25,10 @@ "StationName", "InstitutionName", "DeviceSerialNumber", "InstanceDate", "InstanceTime", "InstanceComments", "SequenceName", "SequenceDescription", "Nucleus", "TransmitCoil", "PatientSex", "HammingFilter", "FrequencyCorrection"], - "float_arrays": ["PositionVector", "RowVector", "ColumnVector"], + "float_arrays": ["PositionVector", "RowVector", "ColumnVector","SlabThickness"], "integer_arrays": ["CSIMatrixSize", "CSIMatrixSizeOfScan", "CSIGridShift"], "string_arrays": ["SoftwareVersion"], - "dictionaries": ["TransmitRefAmplitude"] + "dictionaries": ["TransmitRefAmplitude","SlabOrientation","MidSlabPosition",""] } @@ -46,7 +46,7 @@ def load_rda(filename): elif key in rda_types["integers"]: header_dict[key] = int(value) elif key in rda_types["floats"]: - header_dict[key] = float(value) + header_dict[key] = float(value.replace(",",".",1)) elif "[" in key and "]" in key: # could be a dict or a list key, index = re.split(r"\]|\[", key)[0:2] @@ -57,7 +57,7 @@ def load_rda(filename): else: # not a dictionary, must be a list if key in rda_types["float_arrays"]: - value = float(value) + value = float(value.replace(",",".",1)) elif key in rda_types["integer_arrays"]: value = int(value) index = int(index) @@ -90,6 +90,17 @@ def load_rda(filename): if "VOIReadoutFOV" not in header_dict: if "VOIReadoutVOV" in header_dict: header_dict["VOIReadoutFOV"] = header_dict.pop("VOIReadoutVOV") + #lazy workaround for new Viva scanner + elif "SlabOrientation" in header_dict: + header_dict["VOIReadoutFOV"] = 999.9 + header_dict["VOIPhaseFOV"] = 999.9 + header_dict["VOIThickness"] = 999.9 + header_dict["VOIPositionSag"] = 999.9 + header_dict["VOIPositionCor"] = 999.9 + header_dict["VOIPositionTra"] = 999.9 + #header_dict["PixelSpacingCol"] = 999.9 + #header_dict["PixelSpacingRow"] = 999.9 + header_dict["PixelSpacing3D"] = 999.9 # combine positional elements in the header voi_size = (header_dict["VOIReadoutFOV"],