Skip to content

[Bug]: mirror_odd_lines incorrectly applied to non-EPI sequences with RECO_inp_order='REV_ALT_ROWS' #223

Description

@schuenke

Before submitting

  • I searched existing issues and did not find a duplicate
  • If reporting dataset incompatiblity, I am willing to provide the data
  • I am using the latest available version

Bug description

mirror_odd_lines reverses every other phase-encode line's readout when RECO_inp_order='REV_ALT_ROWS' is set. This is correct for symmetric EPI (where adjacent phase lines within one echo train have alternating readout polarity), but wrong for bipolar multi-echo sequences like MGE.

For the MGE example sequence in the PV7 Bruker API test data set (https://zenodo.org/records/4522220, exp number 26), the current code warns about a disagreement between the declared and inferred value, but uses the declared value anyway leading to wrong kspace data.

For PV360 MGE data, everything is working fine as it is, because the SchemaRawdata has no mirror_odd_lines logic

Steps to reproduce

When using this simple code snippet:

import numpy as np
from brukerapi.dataset import Dataset

data = Dataset(<path_to_MGE_data>)
img = np.fft.ifftshift(np.fft.ifftn(np.fft.fftshift(data.kspace, axes=(0, 1)), axes=(0, 1)), axes=(0, 1))

plt.imshow(np.abs(img[:, :, 16, 0, 0]))
plt.show()

the current output looks like this:

Image

When adjusting the mirror_odd_lines() function to ignore the declared value for non-EPI sequences like this:

@property
def mirror_odd_lines(self):
    """Whether §6.2 odd-line reversal applies to phase-encode lines."""
    value = self._dataset._parameter_value("RECO_inp_order")
    declared = None if value is None else str(value).upper() == "REV_ALT_ROWS"
    inferred = "EPI" in self._dataset.scheme_id
    if not inferred and declared:
        return False
    return self._declared_or_inferred(
        "RECO_inp_order", declared, inferred, "_warned_reco_input_order_disagreement"
    )

the image looks correct:

Image

I am not sure if you prefer to fix this in the mirror_odd_lines function or somewhere else, but ofc I can create a PR if you agree.

Project version

0.4.6

Paravision version

PV7

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions