diff --git a/brukerapi/config/properties_2dseq_core.json b/brukerapi/config/properties_2dseq_core.json index 69147f6..270e842 100644 --- a/brukerapi/config/properties_2dseq_core.json +++ b/brukerapi/config/properties_2dseq_core.json @@ -151,6 +151,12 @@ "conditions": [] } ], + "reco_type": [ + { + "cmd": "#VisuCoreFrameType", + "conditions": [] + } + ], "dim_type": [ { "cmd": "#VisuCoreDimDesc.list + ['spatial',] + #VisuFGOrderDesc.sub_list(1)", diff --git a/brukerapi/schemas.py b/brukerapi/schemas.py index 30c4d7f..ecee6fc 100644 --- a/brukerapi/schemas.py +++ b/brukerapi/schemas.py @@ -42,7 +42,8 @@ "num_slice_packages", "slope", "offset", - "dim_type" + "dim_type", + "reco_type" ], "rawdata": [ "numpy_dtype", @@ -553,25 +554,40 @@ def scale(self): self._dataset.data = np.reshape(self._dataset.data, self._dataset.shape_final, order='F') def deserialize(self, data, layouts): - # scale if self._dataset._state['scale']: data = self._scale_frames(data, layouts, 'FW') - # frames -> frame_groups data = self._frames_to_framegroups(data, layouts) - + if hasattr(self._dataset, 'reco_type'): + # complex reco: + if self._dataset.reco_type[0] == 'REAL_IMAGE' and self._dataset.reco_type[1] == 'IMAGINARY_IMAGE': + data = np.squeeze(data[...,::2] + 1j * data[...,1::2]) + elif self._dataset.reco_type[0] == 'IMAGINARY_IMAGE' and self._dataset.reco_type[1] == 'REAL_IMAGE': + data = np.squeeze(data[...,1::2] + 1j * data[...,::2]) + # real reco: + elif self._dataset.reco_type[0] == 'REAL_IMAGE': + pass + # imaginary reco: + elif self._dataset.reco_type[0] == 'IMAGINARY_IMAGE': + pass + # imaginary reco: + elif self._dataset.reco_type[0] == 'PHASE_IMAGE': + pass + # standard (magntitude) reco: + elif self._dataset.reco_type == ['MAGNITUDE_IMAGE']: + pass + else: + pass return data def _scale_frames(self, data, layouts, dir): """ - :param data: :param layouts: :param dir: :return: """ - # dataset is created with scale state set to False if self._dataset._state['scale'] is False: return data @@ -593,6 +609,7 @@ def _scale_frames(self, data, layouts, dir): if dir == 'BW': data = np.round(data) + return data def _frames_to_framegroups(self, data, layouts, mask=None):