Skip to content
Open
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
6 changes: 6 additions & 0 deletions brukerapi/config/properties_2dseq_core.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
"conditions": []
}
],
"reco_type": [
{
"cmd": "#VisuCoreFrameType",
"conditions": []
}
],
"dim_type": [
{
"cmd": "#VisuCoreDimDesc.list + ['spatial',] + #VisuFGOrderDesc.sub_list(1)",
Expand Down
29 changes: 23 additions & 6 deletions brukerapi/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"num_slice_packages",
"slope",
"offset",
"dim_type"
"dim_type",
"reco_type"
],
"rawdata": [
"numpy_dtype",
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down