-
Notifications
You must be signed in to change notification settings - Fork 37
Parallel #113
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
Open
oliverchampion
wants to merge
22
commits into
main
Choose a base branch
from
parallel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Parallel #113
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
faea568
added parallel, testing and 3D testing
oliverchampion a0ad54a
implemented parallel + testing; 3D + testing
oliverchampion bc69159
fixed bugs
oliverchampion 3e446fe
last updates
oliverchampion ee96f11
typo
oliverchampion 0c1067e
Update conftest.py
oliverchampion cace5b1
updated all typo's and errors. passes tests locally now
oliverchampion 23e711c
SLS TRF removed
oliverchampion bdcd9b9
download data in right location
oliverchampion 076b776
Merge branch 'main' into parallel
oliverchampion fdc74db
Update conftest.py
oliverchampion 1e3cecd
Merge branch 'parallel' of https://github.com/OSIPI/TF2.4_IVIM-MRI_Co…
oliverchampion d64fd6e
Update test_ivim_fit.py
oliverchampion 2f4174c
test on 2 cores (default avail on github) and with less strict time b…
oliverchampion aeee141
fix some of the failed tests and reduce output
oliverchampion 270b95d
resolved some of the failing tests
oliverchampion ae2bd26
fix typos
oliverchampion 127d966
remove hard fail on not making parallle faster. Just a warning now.
oliverchampion 1c6d6f2
hope it does not trigger the AI fits. They are not triggered locally...
oliverchampion 04a19d3
summarize warnings
oliverchampion 1e9e2c6
Update unit_test.yml
oliverchampion bd265c4
Update unit_test.yml
oliverchampion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
__pycache__/ | ||
*.nii.gz | ||
*.nii | ||
*.npy | ||
*.dcm | ||
*.mat | ||
*.raw | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,33 @@ | |
import argparse | ||
import os | ||
from utilities.data_simulation.Download_data import download_data | ||
import pathlib | ||
|
||
########## | ||
# code written by Oliver J Gurney-Champion | ||
# code adapted from MAtlab code by Eric Schrauben: https://github.com/schrau24/XCAT-ERIC | ||
# This code generates a 4D IVIM phantom as nifti file | ||
|
||
def phantom(bvalue, noise, TR=3000, TE=40, motion=False, rician=False, interleaved=False,T1T2=True): | ||
download_data() | ||
np.random.seed(42) | ||
if motion: | ||
states = range(1,21) | ||
else: | ||
states = [1] | ||
for state in states: | ||
# Load the .mat file | ||
mat_data = loadmat('../../download/Phantoms/XCAT_MAT_RESP/XCAT5D_RP_' + str(state) + '_CP_1.mat') | ||
project_root = pathlib.Path(__file__).resolve().parent.parent | ||
filename = f'XCAT5D_RP_{state}_CP_1.mat' | ||
mat_path = project_root / '..' /'download' / 'Phantoms' / 'XCAT_MAT_RESP' / filename | ||
mat_data = loadmat(mat_path) | ||
|
||
# Access the variables in the loaded .mat file | ||
XCAT = mat_data['IMG'] | ||
XCAT = XCAT[-1:0:-2,-1:0:-2,10:160:4] | ||
|
||
D, f, Ds = contrast_curve_calc() | ||
S, Dim, fim, Dpim, legend = XCAT_to_MR_DCE(XCAT, TR, TE, bvalue, D, f, Ds,T1T2=T1T2) | ||
S, Dim, fim, Dpim, legend = XCAT_to_MR_IVIM(XCAT, TR, TE, bvalue, D, f, Ds,T1T2=T1T2) | ||
if state == 1: | ||
Dim_out = Dim | ||
fim_out = fim | ||
|
@@ -187,7 +192,7 @@ def contrast_curve_calc(): | |
return D, f, Ds | ||
|
||
|
||
def XCAT_to_MR_DCE(XCAT, TR, TE, bvalue, D, f, Ds, b0=3, ivim_cont = True, T1T2=True): | ||
def XCAT_to_MR_IVIM(XCAT, TR, TE, bvalue, D, f, Ds, b0=3, ivim_cont = True, T1T2=True): | ||
########################################################################################### | ||
# This script converts XCAT tissue values to MR contrast based on the SSFP signal equation. | ||
# Christopher W. Roy 2018-12-04 # [email protected] | ||
|
@@ -436,7 +441,6 @@ def parse_bvalues_file(file_path): | |
motion = args.motion | ||
interleaved = args.interleaved | ||
T1T2 = args.T1T2 | ||
download_data() | ||
for key, bvalue in bvalues.items(): | ||
bvalue = np.array(bvalue) | ||
sig, XCAT, Dim, fim, Dpim, legend = phantom(bvalue, noise, motion=motion, interleaved=interleaved,T1T2=T1T2) | ||
|
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This downloads data during testing now, correct? Is that slow or burdensome?
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.
Yes and no. The volume, parallel and AI tests just last long, full stop. Downloading the data is relatively quick compared to that less than minute Vs hours).
I think there are two ways we can go here.
I think I could accelerate the volume fit by dramatically reducing the number of vowels; there probably is no need for high resolution.
For the parallel fit, the smaller I make the number of vowels/volume, the less of an acceleration we get from going parallel and the harder it is to test this. For small volumes, typically linear goes way faster. That is why I ended up increasing the volume.
So either we can make a large volume (then the download time is neglectable) and do long tests. Or, we can go for a small volume and ignore the parallel timing. In that cases precalculting the volume and saving it will be faster.
That said, the AI tests also last 5+ minutes per algorithm and we must decide whether we want that to be done every merge...
Either way, all building blocks are here now :)