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

[FIX] Remove hardcoded numbers of echoes. #95

Merged
merged 5 commits into from
Jul 25, 2018
Merged

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Jul 24, 2018

Closes #77.

Changes proposed in this pull request:

  • Remove hardcoded number of echoes from Kappa/Rho calculations.
  • Remove hardcoded number of echoes from adaptive mask creation.

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #95 into master will not change coverage.
The diff coverage is 60%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   42.74%   42.74%           
=======================================
  Files          27       27           
  Lines        1516     1516           
=======================================
  Hits          648      648           
  Misses        868      868
Impacted Files Coverage Δ
tedana/model/fit.py 8.08% <0%> (ø) ⬆️
tedana/utils/utils.py 83.85% <100%> (ø) ⬆️

Continue to review full report at Codecov.

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

@handwerkerd
Copy link
Member

I don't think the removal of '/ 3' in utils.py is a number of echoes issue.

lthrs = np.squeeze(echo_means[med_val].T) / 3 # QUESTION: why divide by 3?

Looking at the code above and below, this function is a simple, but arbitrary way to create a voxelwise mask. It makes the assumption that at least 1/3 of the volume isn't in the brain and it finds the voxel with the 33rd percentile magnitude in the first echo. It then uses the same voxel for all 3 echoes since it's assumed to be an out-of-brain voxel. It takes a threshold from each echo and uses that to define the echo-specific masking threshold. The '/ 3' seems to be used to set the threshold to 1/3 of the selected voxel in each echo so that you only exclude voxels that are really noise. Both the 33rd percentile and the divide by 3 steps seem like arbitrary thresholds, but the division by 3 doesn't look like it has anything to do with the number of echoes so it shouldn't be changed.

Also, this is passing CI, but does any of the sample data this is being tested on include more than 3 echoes? If not, then this change wouldn't alter the output.

@tsalo
Copy link
Member Author

tsalo commented Jul 25, 2018

That makes sense. I'll change that function back.

I also changed `med_val` to `perc_val` to make it clearer.
@emdupre
Copy link
Member

emdupre commented Jul 25, 2018

WDYT of flagging that value as arbitrary in the code comments, @tsalo ? Maybe with a # NOTE: ?

@tsalo
Copy link
Member Author

tsalo commented Jul 25, 2018

@emdupre That's a great idea! Adding notes now.

@emdupre
Copy link
Member

emdupre commented Jul 25, 2018

LGTM ! I'm ok to merge this in and then re-visit when we add additional tests from other 4+ echo datasets. WDYT @handwerkerd, @tsalo ?

@emdupre emdupre merged commit 31504f6 into ME-ICA:master Jul 25, 2018
@tsalo tsalo changed the title Remove hardcoded numbers of echoes. [FIX] Remove hardcoded numbers of echoes. Jul 26, 2018
@jbteves jbteves added breaking change WIll make a non-trivial change to outputs and removed output-change labels Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change WIll make a non-trivial change to outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hard coded number of echoes in Kappa & Rho Estimates
4 participants