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
Signal recovery optimizer #429
base: master
Are you sure you want to change the base?
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.
There is a lot of comments, but most of them are minor simple tweaks. I have not tested if I can run it, but it looks good overall :)
dee3acb
to
80f45c6
Compare
… in symmetrical colorbar
…Specificaly, Gz must be calculated at each shimming slices deck (e.g., the target slice and slices before; Do not calculate Gz after concatenating slice-by-slice B0 map to form volumetric B0 maps
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.
We should find a way to calculate and pass the Gx, Gy, Gz options so that it does not affect the other "criteria". In the current form, the "mse" would unnecessarily calculate the gradients, pass it to the _scipy_minimize()
function and crash when trying to call "mse"'s _criteria_func()
.
Similarly, in the sequencer, there should be a function that handles all the necessary calculation and necessary plots for this new method in a if that gets executed only if it's this optimizer.
The code is looking good :)
shimmingtoolbox/cli/b0shim.py
Outdated
end_time = time.time() | ||
print("Time taken for shim_sequencer to run is : ", end_time - start_time, "seconds") |
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.
end_time = time.time() | |
print("Time taken for shim_sequencer to run is : ", end_time - start_time, "seconds") |
coil_Gx_mat = np.reshape(merged_coils_Gx, | ||
(n_channels, -1)).T[mask_erode_vec != 0, :] # masked points x N | ||
coil_Gy_mat = np.reshape(merged_coils_Gy, | ||
(n_channels, -1)).T[mask_erode_vec != 0, :] # masked points x N | ||
coil_Gz_mat = np.reshape(merged_coils_Gz, | ||
(n_channels, -1)).T[mask_erode_vec != 0, :] # masked points x N |
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 the acquisition is oblique? The "z gradient" would be in the slice encoding direction, does that have an impact on your calculation? There is some code in the toolbox (shimmingtoolbox.shim.realtime_shim:realtime_shim()) to calculate the gradient in the "true z" direction.
shimmingtoolbox/shim/sequencer.py
Outdated
@@ -186,10 +204,12 @@ def _eval_static_shim(opt: Optimizer, nii_fieldmap_orig, nii_mask, coef, slices, | |||
shimmed = np.zeros(unshimmed.shape + (len(slices),)) | |||
corrections = np.zeros(unshimmed.shape + (len(slices),)) | |||
masks_fmap = np.zeros(unshimmed.shape + (len(slices),)) | |||
print('The variable slices is as following: ' + str(slices)) # Currently the code works for --slice sequential shimming, but need to adapt it so that it also works for the --slices volume |
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.
print('The variable slices is as following: ' + str(slices)) # Currently the code works for --slice sequential shimming, but need to adapt it so that it also works for the --slices volume |
Co-authored-by: Alex Dastous <47249340+po09i@users.noreply.github.com>
Co-authored-by: Alex Dastous <47249340+po09i@users.noreply.github.com>
Co-authored-by: Alex Dastous <47249340+po09i@users.noreply.github.com>
Co-authored-by: Alex Dastous <47249340+po09i@users.noreply.github.com>
Co-authored-by: Alex Dastous <47249340+po09i@users.noreply.github.com>
…ming-toolbox into YM/signal_recovery
Checklist
Description
Add signal recovery optimizer
Linked issues