Open
Conversation
Added fitting for 1 voxel and for the whole image
LucyKershaw
reviewed
Aug 26, 2024
Collaborator
Author
|
@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. |
Collaborator
|
@MohamedNasser8 Can you update this branch to use existing functions to remove redundancy? |
ltorres6
reviewed
Sep 4, 2024
src/osipi/DRO/main.py
Outdated
Comment on lines
145
to
221
| # 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) |
Collaborator
|
In addition to what Lucy mentioned above:
|
- add imports as osipi dro - refactor function name to be snake case - added save function in utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_signalwhich takes a path and returns a 4D MR dataset.Added Animation Functionality:
Removed Directory Creation and Data Saving Code:
Additions