-
Notifications
You must be signed in to change notification settings - Fork 8
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
DCE-dro #39
base: main
Are you sure you want to change the base?
DCE-dro #39
Conversation
Added fitting for 1 voxel and for the whole image
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 think the issue with this code is that it still rewrites some of the existing osipi functions instead of using them directly, e.g. osipi.S_to_C_via_R1_SPGR
There is a lot of good work here, I'm keen to see the documentation
@LucyKershaw Yeah, initially I was copying the code as is without modifying the functions, but I'll update it to rely on the osipi functions. There were a lot of questions and some lines that were unclear to me, which is why I didn't change them earlier. |
@MohamedNasser8 Can you update this branch to use existing functions to remove redundancy? |
src/osipi/DRO/main.py
Outdated
# trans_K1 = mf_K1.copy() | ||
# trans_k2 = mf_k2.copy() | ||
# trans_Vp = mf_Vp.copy() | ||
# | ||
# vmax_K1, vmax_k2, vmax_Vp = 1, 1, 0.2 | ||
# vmin_K1, vmin_k2, vmin_Vp = 0.2, 0.2, 0.01 | ||
# lb_K1, lb_k2, lb_Vp = 0.54, 0.52, 0.49 | ||
# ub_K1, ub_k2, ub_Vp = 1.52, 1.5, 1.43 | ||
# lim_K1, lim_k2, lim_Vp = vmax_K1 + 0.5, vmax_k2 + 0.1, vmax_Vp + 0.5 | ||
# ub_lim = 1.01 | ||
# | ||
# trans_K1[trans_K1 <= vmin_K1] = trans_K1[trans_K1 <= vmin_K1] * lb_K1 | ||
# trans_K1[trans_K1 >= lim_K1] = trans_K1[trans_K1 >= lim_K1] * ub_lim | ||
# trans_K1[(trans_K1 >= vmax_K1) & (trans_K1 < lim_K1)] = ( | ||
# trans_K1[(trans_K1 >= vmax_K1) & (trans_K1 < lim_K1)] * ub_K1 | ||
# ) | ||
# trans_K1[(trans_K1 > vmin_K1) & (trans_K1 < vmax_K1)] = trans_K1[ | ||
# (trans_K1 > vmin_K1) & (trans_K1 < vmax_K1) | ||
# ] * ( | ||
# lb_K1 | ||
# + ( | ||
# ( | ||
# (trans_K1[(trans_K1 > vmin_K1) & (trans_K1 < vmax_K1)] - vmin_K1) | ||
# / (vmax_K1 - vmin_K1) | ||
# ) | ||
# * (ub_K1 - lb_K1) | ||
# ) | ||
# ) | ||
# | ||
# trans_k2[trans_k2 <= vmin_k2] = trans_k2[trans_k2 <= vmin_k2] * lb_k2 | ||
# trans_k2[trans_k2 >= lim_k2] = trans_k2[trans_k2 >= lim_k2] * ub_lim | ||
# trans_k2[(trans_k2 >= vmax_k2) & (trans_k2 < lim_k2)] = ( | ||
# trans_k2[(trans_k2 >= vmax_k2) & (trans_k2 < lim_k2)] * ub_k2 | ||
# ) | ||
# trans_k2[(trans_k2 > vmin_k2) & (trans_k2 < vmax_k2)] = trans_k2[ | ||
# (trans_k2 > vmin_k2) & (trans_k2 < vmax_k2) | ||
# ] * ( | ||
# lb_k2 | ||
# + ( | ||
# ( | ||
# (trans_k2[(trans_k2 > vmin_k2) & (trans_k2 < vmax_k2)] - vmin_k2) | ||
# / (vmax_k2 - vmin_k2) | ||
# ) | ||
# * (ub_k2 - lb_k2) | ||
# ) | ||
# ) | ||
# | ||
# trans_Vp[trans_Vp <= vmin_Vp] = trans_Vp[trans_Vp <= vmin_Vp] * lb_Vp | ||
# trans_Vp[(trans_Vp >= lim_Vp)] = trans_Vp[trans_Vp >= lim_Vp] * ub_lim | ||
# trans_Vp[(trans_Vp >= vmax_Vp) & (trans_Vp < lim_Vp)] = ( | ||
# trans_Vp[(trans_Vp >= vmax_Vp) & (trans_Vp < lim_Vp)] * ub_Vp | ||
# ) | ||
# trans_Vp[(trans_Vp > vmin_Vp) & (trans_Vp < vmax_Vp)] = trans_Vp[ | ||
# (trans_Vp > vmin_Vp) & (trans_Vp < vmax_Vp) | ||
# ] * ( | ||
# lb_Vp | ||
# + ( | ||
# ( | ||
# (trans_Vp[(trans_Vp > vmin_Vp) & (trans_Vp < vmax_Vp)] - vmin_Vp) | ||
# / (vmax_Vp - vmin_Vp) | ||
# ) | ||
# * (ub_Vp - lb_Vp) | ||
# ) | ||
# ) | ||
# | ||
# trans_Vp[trans_Vp > 1] = 1 | ||
# | ||
# Ctiss_tr = forward_extended_tofts(trans_K1, trans_k2, trans_Vp, Ea, t) | ||
# | ||
# R1_tr, R2st_tr = calcR1_R2(R10, R20st_value, r1, r2st, Ctiss_tr) | ||
# dro_S_tr, M_tr = Conc2Sig_Linear(Tr, Te, fa, R1_tr, R2st_tr, signal[:, :, :8, :], 1, M) | ||
# | ||
# dro_Snoise_tr = addnoise(1, stdS, dro_S_tr, Nt=data_shape[-1]) | ||
# | ||
# animate_mri(signal, mode="time", slice_index=7, time_index=5) | ||
# animate_mri(dro_Snoise_tr, mode="time", slice_index=7, time_index=5) | ||
# animate_mri(dro_Snoise, mode="time", slice_index=7, time_index=5) |
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 can remove.
In addition to what Lucy mentioned above:
|
- add imports as osipi dro - refactor function name to be snake case - added save function in utils
PR: Updates to DRO Code
I have made some updates to the DRO code, based on the existing code from TF6.
Changes Made:
Removed Extra Code for Reading Functions:
read_dicoms_as_4d_signal
which takes a path and returns a 4D MR dataset.Added Animation Functionality:
Removed Directory Creation and Data Saving Code:
Additions