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

CLI scripts #177

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from
Draft

CLI scripts #177

wants to merge 42 commits into from

Conversation

chaithyagr
Copy link
Contributor

This is an ongoing PR for creating CLI for pysap-mri reconstruct to streamline and make the work reproducibile.

@chaithyagr chaithyagr self-assigned this Apr 11, 2024
Copy link
Contributor

@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 start, later examples on how to use the CLI would be nice.

src/mri/cli/dc_adjoint.py Outdated Show resolved Hide resolved
src/mri/cli/dc_adjoint.py Outdated Show resolved Hide resolved
else:
log.warn("Trajectory name not found in data header, validation step not done")
shots, traj_params = traj_reader(
traj_file, dwell_time=DEFAULT_RASTER_TIME / data_header["oversampling_factor"]
Copy link
Contributor

Choose a reason for hiding this comment

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

you may want to have the raster time being a parameter for future flexibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It already is, will update the code to bring that config here. Good catch

)


def recon(obs_file: str, traj_file: str, obs_reader, traj_reader, fourier):
Copy link
Contributor

Choose a reason for hiding this comment

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

Type hints for hydra zen to be happy ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is handeled above. The readers are partially configured objects based on inputs.

Comment on lines 84 to 85
per_ch_image = fourier_op.adj_op(kspace_data)
combined_image = np.linalg.norm(per_ch_image, axis=-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

what if I provided the smaps in the file or separately ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya, thats not yet supported :P

)
per_ch_image = fourier_op.adj_op(kspace_data)
combined_image = np.linalg.norm(per_ch_image, axis=-1)
pkl.dump(combined_image, open("dc_adjoint.pkl", "wb"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather have the output format left to the user (.npy, .nii)m, as well as the filename. Once reconstructed, the user will probably want to view the data in their favorite viewer.

chaithyagr and others added 3 commits April 24, 2024 10:15
Co-authored-by: Pierre-Antoine Comby <pierre-antoine.comby@crans.org>
Co-authored-by: Pierre-Antoine Comby <pierre-antoine.comby@crans.org>
Copy link
Contributor

@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.

LGTM, we will see how usage would dictate new changes ..

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.

None yet

2 participants