Skip to content

Adjust converter to enable dataset processing even if errors occur#69

Open
yuliadub wants to merge 3 commits into
mainfrom
yuliadub/mrd-converter-changes
Open

Adjust converter to enable dataset processing even if errors occur#69
yuliadub wants to merge 3 commits into
mainfrom
yuliadub/mrd-converter-changes

Conversation

@yuliadub

Copy link
Copy Markdown
Collaborator

Tested this on FastMRI knee and brain data, as well as Mosaic (new data source) data. Brain data and mosaic data was not converting correctly, below is the summary of why, both appear as artifacts of how the data we acquired was built.

Slice count (header 32 vs dataset 16, your brain file)
The fastMRI public brain release intentionally ships only a subset of the acquired slices (typically the diagnostically central ones) to control file size. The XML header is preserved verbatim from the original Siemens acquisition, which had the full 32. The fastMRI documentation/papers note this — the slice subsetting is a release-time decision, not a corruption. Trusting the dataset's first axis is the right call.

Axis order swap (Siemens twix file) — non-conforming layout.
The data is internally consistent (640 still matches matrix_size.x. What's broken is the storage convention — whoever repackaged the twix dump into the fastMRI HDF5 layout wrote phase-encode-first instead of readout-first. The samples themselves are intact, just transposed. So reconstruction will be correct as long as transpose happens on read, which is what the swapped branch does. Worth flagging upstream as a metadata/layout bug in the repackager, but the pixel data is fine.

@naegelejd

Copy link
Copy Markdown
Collaborator

Per our discussion, I think we need to clean the MRD header too, so the file produced by the converter is internally consistent 😄

When slice count differs:

  • header.encoding[0].encoding_limits.slice.maximum → set to minimum + num_slices - 1 (don't assume minimum is 0).
  • header.encoding[0].encoding_limits.slice.center → clamp into the new [minimum, maximum] range if it falls outside.

When channel count differs:

  • header.acquisition_system_information.receiver_channelsnum_channels.
  • header.acquisition_system_information.coil_label → truncate to num_channels if longer.

@naegelejd

Copy link
Copy Markdown
Collaborator

Also, the conda build failed because of an upstream issue with the xsd library that ismrmrd uses.

I've already fixed it in #66, and John approved, so I'll merge it now.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants