Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added siemens data reader and phase shifter #89

Merged
merged 15 commits into from
Apr 29, 2024

Conversation

chaithyagr
Copy link
Member

These essential functions seem to be better if it belonged here as compared to on pysap-mri. That way, you can have a complete DC Adjoint code working from CLI without any need for pysap-mri, for light simple quick rersults..

Later, pysap-mri can build further ahead on this CLI for compressed sensing based recon. I have basic CLI code setup and I shall make another PR for it. Still figuring out the structuring of config.

@chaithyagr chaithyagr self-assigned this Apr 10, 2024
@chaithyagr chaithyagr requested a review from paquiteau April 10, 2024 14:24
Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice proposal. There are some points to discuss though. I think that mri-nufft should remains as agnostic and generalist as possible. I view it more as a backend stuff, on which people build their stuff (while citing us, of course :D )

import numpy as np

try:
from mapvbvd import mapVBVD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to also be added to pyproject.toml (maybe in an io dependency bundle ?)

Comment on lines 41 to 45
if not MAPVBVD_FOUND:
raise ImportError(
"The mapVBVD module is not available. Please install it using "
"the following command: pip install pymapVBVD"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may simply do the import in the function then ?

src/mrinufft/io/siemens.py Outdated Show resolved Hide resolved
Comment on lines 54 to 58
"num_coils": int(twixObj.image.NCha),
"num_shots": int(twixObj.image.NLin),
"num_contrasts": int(twixObj.image.NSet),
"num_adc_samples": int(twixObj.image.NCol),
"num_slices": int(twixObj.image.NSli),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall in MRI-NUFFT we tend to use n_coils, n_shots, etc... I would advise to use these convention here too.

hdr["num_slices"],
hdr["num_contrasts"]
)
if "SPARKLING_VE11C" in data_type:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have other value of data_type in mind ?
I would recommend to use an enum to gather them. Overall this section of the code only updates the header, and may be refactored to a dedicated function. The workflow would then be

parser = parse_header_type[data_type] # e.g. using a `MethodRegister` from `_utils.py`
hdr |= parser(twixObj)

Comment on lines 4 to 6
@with_numpy_cupy
def add_phase_to_kspace_with_shifts(kspace_data, kspace_loc, normalized_shifts):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_numpy_cupy expect a signature with (self, data, output=None). I think you are going to get trouble here.

@chaithyagr chaithyagr requested a review from paquiteau April 11, 2024 08:05
@chaithyagr
Copy link
Member Author

Adding back for review of updated codes. I will get some tests up also though

src/mrinufft/io/nsp.py Outdated Show resolved Hide resolved
Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I still think we should extract the ARBGRAD stuff in a dedicated function.

This could be a wrapper around read_siemens_rawdat, e.g a read_nsp_mp2rage or alike.

src/mrinufft/io/nsp.py Show resolved Hide resolved
src/mrinufft/io/nsp.py Show resolved Hide resolved
@chaithyagr chaithyagr requested a review from paquiteau April 29, 2024 14:32
@chaithyagr
Copy link
Member Author

There seems to be no way to test IO arbGrad module. For now lets just merge and add an issue for needing test?

@paquiteau paquiteau merged commit 8e15f05 into mind-inria:master Apr 29, 2024
8 checks passed
@chaithyagr
Copy link
Member Author

Something went wrong here! I dont see my changes at master. The split up of read_siemens_rawdat and read_arbgrad_rawdat stuff. I will change this in #90 PR.

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