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
base: develop
Are you sure you want to change the base?
CLI scripts #177
Conversation
There was a problem hiding this 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
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"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
src/mri/cli/dc_adjoint.py
Outdated
) | ||
|
||
|
||
def recon(obs_file: str, traj_file: str, obs_reader, traj_reader, fourier): |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
src/mri/cli/dc_adjoint.py
Outdated
per_ch_image = fourier_op.adj_op(kspace_data) | ||
combined_image = np.linalg.norm(per_ch_image, axis=-1) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
src/mri/cli/dc_adjoint.py
Outdated
) | ||
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")) |
There was a problem hiding this comment.
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.
Co-authored-by: Pierre-Antoine Comby <pierre-antoine.comby@crans.org>
Co-authored-by: Pierre-Antoine Comby <pierre-antoine.comby@crans.org>
There was a problem hiding this 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 ..
This is an ongoing PR for creating CLI for pysap-mri reconstruct to streamline and make the work reproducibile.