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

GUI bug fixes and new GUI buttons #358

Merged
merged 19 commits into from Sep 30, 2019
Merged

GUI bug fixes and new GUI buttons #358

merged 19 commits into from Sep 30, 2019

Conversation

tanguyduval
Copy link
Member

@tanguyduval tanguyduval commented Sep 24, 2019

Purpose

[BUG] Solve #357
[NEW] bvec and bval files can be loaded for Diffusion protocols (need DiffusionData in Model.MRIinputs). Now any diffusion dataset with .bvec and .bval files can be loaded easily in qMRLab
[NEW] Create button for protocol (e.g. linspace)
[NEW] Default button in the option panel can reset the protocol

Approach

Concerning #357 I just set NaN values to 0

Open Questions and Pre-Merge TODOs

  • Use github checklists. When solved, check the box and explain the answer.

  • Review that changed source files/lines are related to the pull request/issue
    If any files/commits were accidentally included, cherry-pick them into another branch.

  • Review that changed source files/lines were not accidentally deleted
    Fix appropriately if so.

  • Test new features or bug fix
    If not implemented/resolved adequately, solve it or inform the developer by requesting changes in your review.
    Preferably, set breakpoints in the locations that the code was changed and follow allong line by line to see if the code behaves as intended.

Manual GUI tests (general)
  • Does the qMRLab GUI open?
  • Can you change models?
  • Can you load a data folder for a model?
  • Can you view data?
  • Can you zoom in the image?
  • Can you pan out of the image?
  • Can you view the histogram of the data?
  • Can you change the color map?
  • Can you fit dataset (Fit data)?
  • Can you save/load the results?
  • Can you open the options panel?
  • Can you change option parameters?
  • Can you save/load option paramters?
  • Can you select a voxel?
  • Can you fit the data of that voxel ("View data fit")?
  • Can you simulate and fit a voxel ("Single Voxel Curve")?
  • Can you run a Sensitivity Analysis?
  • Can you simulate a Multi Voxel Distribution?
Specifications
  • Version:
  • Platform:
  • Subsystem:

@coveralls
Copy link

coveralls commented Sep 24, 2019

Coverage Status

Coverage decreased (-0.1%) to 42.911% when pulling 7316f4d on cosmetic into cd30473 on master.

@mathieuboudreau
Copy link
Member

Thanks @tanguyduval ! As for the NaN in masks, I'm worried about automatically setting values to 0; it removes some UI feedback telling us that there might be something wrong in the dataset (if there are NaNs in masks, I suspect that there is...). Also, QSM is very sensitive to the quality of the brain mask, and the algorithm could break under some circumstances if datapoints in the masks are not connected.

Maybe an alternative could be a popup appearing while initially loading the masked data, notifying the user about the issues in the mask data ("FYI: there are some points in the mask that are NaN. What do you want us to do with them ? (1) ignore (2) set to 0 (3) set to 1). What do you think?

@agahkarakuzu
Copy link
Member

agahkarakuzu commented Sep 25, 2019

("FYI: there are some points in the mask that are NaN. What do you want us to do with them ? (1) ignore (2) set to 0 (3) set to 1). What do you think?

NaN values are dangerous in masks or in images that are being masked! Logical operations go schrodinger's cat and yield unexpected results, at least in Matlab I have nasty experiences :)

I think those values can be set to zero and a xxx_nan_mask binary image can be exported to inform the user about which values were changed from NaN --> 0.

@@ -77,6 +77,7 @@

% Find voxels that are not empty
if isfield(data,'Mask') && (~isempty(data.Mask))
data.Mask(isnan(data.Mask))=0;
Copy link
Member

Choose a reason for hiding this comment

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

This seems quite reasonable to me. Would saving isnan(data.Mask) output be extra?

@mathieuboudreau
Copy link
Member

("FYI: there are some points in the mask that are NaN. What do you want us to do with them ? (1) ignore (2) set to 0 (3) set to 1). What do you think?

NaN values are dangerous in masks or in images that are being masked! Logical operations go schrodinger's cat and yield unexpected results, at least in Matlab I have nasty experiences :)

I think those values can be set to zero and a xxx_nan_mask binary image can be exported to inform the user about which values were changed from NaN --> 0.

I agree that they are "dangerous", but I'm afraid that automatically handling this might then create some issues long term if we don't inform the user that there was NaN in the masks. The dangerous thing was that they made a mistake in creating the mask in the first place (NaN should not have been there at all, so what else went wrong before) ! Automatically setting to 0 could cause some issues, like in QSM, where I could see some problems with the deconvolution if there are a lot of sparse 0 in the brain because some NaN appeared there. QSM is extremely sensitive to boundary conditions, and so I could envision a situation where someone complains that their QSM processed maps are aweful, but everything looks fine, and it's because we automatically set the NaNs in the brain to 0. I will be very hard to debug/discover, if we dont at a bare minimum inform the user that NaNs in the data exists, and what we did about it. For example, using a popup.

Copy link
Member

@mathieuboudreau mathieuboudreau left a comment

Choose a reason for hiding this comment

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

Add functionality that informs user that NaNs in the data exists, and how we tried to resolve it.

@agahkarakuzu
Copy link
Member

@mathieuboudreau I'd say we avoid pop-up, carry on with processing by NaN --> 0 but report/log it.

@tanguyduval
Copy link
Member Author

@mathieuboudreau @agahkarakuzu I propose to use the input wait of FitData. If present, a warning dialog will open and recommend to check mask,. Otherwise, a warning will be displayed in the command Window.

@agahkarakuzu
Copy link
Member

@tanguyduval for non-voxelwise models this is not taking effect. I tired it with vfa_t1.

Should we include this in SanityCheck ?

@tanguyduval
Copy link
Member Author

@agahkarakuzu good catch. Solved in a3c1eb4

@agahkarakuzu
Copy link
Member

agahkarakuzu commented Sep 25, 2019

I pushed a small commit to show warning only when NaN exists and also add this check to the voxelwise as well.

Checked functionality with vfa_t1 and ir_t1.

@mathieuboudreau quick question, can you fit mt_sat via GUI ?

@tanguyduval
Copy link
Member Author

I pushed a small commit to show warning only when NaN exists

Oups... my mistake

and also add this check to the voxelwise as well.

I think you have duplicated the check for voxelwise... the first check is already before the condition if voxelwise

Checked functionality with vfa_t1 and ir_t1.

@mathieuboudreau quick question, can you fit mt_sat via GUI ?

@mathieuboudreau
Copy link
Member

Looks like PR #355 caused a lot of issues, there was the NaN issue that a user reported in #357, but @TommyBoshkovski let me know today that a lot of our models were also broken due to a similar issue (but not displaying the same error). I also discovered a completely different bug that happened for b1_dam, which I fixed in 7316f4d. This makes me suspect that there might be some more lingering around, so please be vigilant and report any GUI-related oddities if you encounter them; I had tested the GUI while reviewing #355, but only for one model (VFA), which worked fine. I think it may be overkill to test all models at every PR, so I won't update the checklist, but if ever any of you review a PR that specifically deals with the GUI backend (like imtools), then I think it may be prudent to do a more thorough review.

@mathieuboudreau
Copy link
Member

@tanguyduval is this branch ready to be merged, or do you have more local changes to push?

@tanguyduval
Copy link
Member Author

tanguyduval commented Sep 30, 2019

@mathieuboudreau this branch can be merged (and should be merged ASAP). I solved the problem of NaN at periphery here: 83d1b69
Don't know why the tests did not catch this, I'll investigate
Thanks for 7316f4d, I'll integrate it to imtool3D_td

Copy link
Member

@mathieuboudreau mathieuboudreau left a comment

Choose a reason for hiding this comment

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

Approved after further testing & bug fixes.

@mathieuboudreau
Copy link
Member

@tanguyduval I saw that commit about the NaNs at periphery, but don't fully understand what the issue was by reading the thread here. Can you expand on it?

I think Travis didn't catch these errors as most appear to deal with some GUI & data relationships, so maybe the CLI don't call the same tools during the tests.

@mathieuboudreau
Copy link
Member

Thanks for all the help @tanguyduval !

@tanguyduval
Copy link
Member Author

@mathieuboudreau nii_xform, in addition to loading files, applies an affine transform to match the reference. The interpolation that applies during the transformation introduce NaNs at periphery.

In qMRLab, we load each file independently (the reference was the same file that the one that was loaded). I modified the loading function to just load and skip the affine transform in this case.

And you are right, the CLI don't call this part...

@mathieuboudreau
Copy link
Member

Great, thanks for clarifying!

@mathieuboudreau mathieuboudreau changed the title Cosmetic GUI bug fixes and new GUI buttons Sep 30, 2019
@mathieuboudreau mathieuboudreau merged commit 2b2b9d8 into master Sep 30, 2019
@mathieuboudreau mathieuboudreau deleted the cosmetic branch September 30, 2019 20:05
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

4 participants