Skip to content
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

BIDS features - MATLAB 2022 internship #484

Open
wants to merge 142 commits into
base: master
Choose a base branch
from
Open

Conversation

mathieuboudreau
Copy link
Member

Opening this PR for Agah while he's away on intership in Stanford - I'm going to do a review of the current changes and what appears to be left to do.

agahkarakuzu and others added 16 commits October 11, 2022 13:24
- BIDS specification mappings for anat, dwi, fmap
- BIDS to qMRLab input rules 
- qMRLab to BIDS output rules
- qMRLab model registry
- Unit specifications
- README explaining the convention
- Add unit selection
- Improve parallel fit options 
- Add README
- Directory navigation was needed.
- Add model specific notes and refs inc BIDS
- Refactor BinderHub badge insert 
- Update references
- Add unit I/O management for all models
- Set checkAnterior version 2,5,0 to account for OriginalProtEnabled and setUserProtUnits
- Edit panel texts to avoid unit description duplication, wherever applicable.
- FITBIDS uses all /dev configs in relation to the new model registry to map a BIDS formatted data into a qMRLab process. Emits env var ISBIDS.
- getUserPreferences reads /usr configs and determines whether choices will be overridden for BIDS (env var ISBIDS)
- modelRegistry infers the mapping rules based on set preferences
- Add helper functions
- To store app data regarding unit scaling
- Add gitignore rule not to exclude 
- Save outputs in BIDS formats and units
- Scale input/outputs maps as necessary without affecting how the original model accepts input data and
- Use helper functions
- Add scaling function
- Improve documentation template
- Make static model to read list from model registry
- Output display units
- Accounted by the new model registry
- Fix misc issues
@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #484 (6d8646e) into master (036ff20) will decrease coverage by 0.91%.
The diff coverage is 46.57%.

❗ Current head 6d8646e differs from pull request most recent head af5c37f. Consider uploading reports for the commit af5c37f to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
- Coverage   47.40%   46.50%   -0.91%     
==========================================
  Files         260      272      +12     
  Lines        8648     9631     +983     
==========================================
+ Hits         4100     4479     +379     
- Misses       4548     5152     +604     
Flag Coverage Δ
matlab 46.50% <46.57%> (-0.12%) ⬇️
octave ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Common/AbstractModel.m 71.25% <ø> (+5.00%) ⬆️
src/Common/FitBIDS.m 0.00% <0.00%> (ø)
src/Common/FitResultsSave_BIDS.m 0.00% <0.00%> (ø)
src/Common/qMRLab_static_Models.m 0.00% <0.00%> (ø)
src/Common/saveUserPreferences.m 0.00% <0.00%> (ø)
src/Common/tools/versionChecker.m 0.00% <0.00%> (-62.17%) ⬇️
src/Common/units/validatePanelUnits.m 0.00% <0.00%> (ø)
...els_Functions/MP2RAGE/func/T1B1correctpackageTFL.m 84.74% <ø> (ø)
src/Common/getUserPreferences.m 32.50% <32.50%> (ø)
src/Models/T1_relaxometry/vfa_t1.m 41.00% <42.85%> (-34.45%) ⬇️
... and 27 more

... and 17 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 036ff20...af5c37f. Read the comment docs.

@mathieuboudreau
Copy link
Member Author

Tagging @vijayiyer05 from the MATLAB team!

@@ -28,7 +28,7 @@ RUN echo ${TAG}; \
mkdir $HOME/work; \
cd $HOME/work; \
git clone --recurse-submodules -b ${TAG} --single-branch --depth 1 https://github.com/qMRLab/qMRLab.git;\
chmod -R 777 $HOME/work/qMRLab; \
chmod -R 777 cd $HOME/work/qMRLab; \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cd seems out of place within a chmod command, I'm making a note to manually test the Dockerfile in case this needs to be fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this one too, but I did not want to push changes for it not to break a book elsewhere that maybe using the latest tag. Thanks!

@@ -24,6 +24,12 @@
"% |-------------- sub-01_TB1map.nii.gz",
"% |-------------- sub-01_TB1map.json",
"% ",
"% <https://osf.io/rt642/download Download> our example |TB1DAM| BIDS dataset and process:",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIDS demo documentation, making a note to myself to test this manually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it gets repeated for each model, so also making a note to check that this automated approach at generating the BIDS documentation is general enough for all models that it's generated for.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notes field is model specific to add BIDS-specific content and citation strings to the reference articles:

image

Handled by the following

% Generate model specific commands ====================== END
for ii =1:length(notesJson.notes)
if strcmp(Model.ModelName,notesJson.notes{ii}.model)
if isfield(notesJson.notes{ii},'note')
noteTexts.notes = cellstr(notesJson.notes{ii}.note');
else
noteTexts.notes = noNotes;
end
if isfield(notesJson.notes{ii},'citation')
noteTexts.citation =cellstr(['% ' notesJson.notes{ii}.citation]);
else
noteTexts.citation = noCitation;
end
break;
else
noteTexts.notes = noNotes;
noteTexts.citation = noCitation;
end
end
% Replace jokers ====================== START

@@ -0,0 +1,112 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: qMRLab BIDS files currently in a temporary dev/ directory, which will need to be renamed (and possible moved) prior to merging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev/ directory was not meant to be temporary, but we can rename it to config if you think that it makes more sense.

@@ -0,0 +1,226 @@
# ⚠️ Warning
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIDS documentation for the developers. Need to check if this should be moved to our wiki and/or ReadTheDocs before the PR is merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ho into the wiki page, we better keep RTD cleaner for users.

@mathieuboudreau
Copy link
Member Author

The test suite is failing, but doesn't appear to be related to the BIDS feature (it's during the MTsat batch example run). Note to self to check/resolve this, and see if some non-BIDS related code was touched in this branch that would have also raised this error.

@mathieuboudreau
Copy link
Member Author

Code coverage is failing also, likely due to the BIDS code being in dev/ and not src/ (where code is tested). Will need to move dev somewhere inside src, and see if the code is tested then to reach our code coverage threshold.

@@ -107,34 +104,39 @@

B1params = obj.options.B1correctionfactor;

[FitResult.MTSAT, R1] = MTSAT_exec(data, MTparams, PDparams, T1params, B1params);
FitResult.T1 = 1./R1;
[MTSAT, R1, R1cor, MTsatcor] = MTSAT_exec(data, MTparams, PDparams, T1params, B1params);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test suite currently fails due to the change on this line. Two extra outputs were set (R1cor and MTsatcor), but the function that's being called never defined these extra outputs and still only outputs 2 values:

function [MTsat, R1] = MTSAT_exec(data, MTParams, PDParams, T1Params, B1Params)

Despite an attempt at a workaround below on lines 119 and 123, the ~isempty call never get set since the code errors here.

It's not clear to me what exactly the two extra variables are expected to be (I could imagine that MTsatcor would maybe be with B1 correction from the code, but not sure about R1cor), I'll instead just add some placeholder "empty" variables that get outputted, and we can touch on this during the full review later on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled in dc2f259, but will need to revisit and/or check with Agah later what the intended behaviour was while this was being developped.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember Juan was working on this, the expected variables should be un-corrected (B1) maps. Most likely defaults were not matching what the test was expecting with some variable matching. Thanks for the fix, a more thorough solution to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants