[go: up one dir, main page]

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

Incomprehensible ValueError thrown by RegionExtractor #907

Open
dohmatob opened this issue Dec 14, 2015 · 18 comments
Open

Incomprehensible ValueError thrown by RegionExtractor #907

dohmatob opened this issue Dec 14, 2015 · 18 comments
Assignees
Labels
Documentation for documentation related questions or requests Enhancement for feature requests Good first issue Good for newcomers. Equivalent to "very low" effort. Priority: high The task is urgent and needs to be addressed as soon as possible.

Comments

@dohmatob
Copy link
Contributor

I'll find time to expand on the issue desc and provide minimal example to rep.

RegionExtractor(["image1.nii", "image2.nii"], threshold=3.)

Throws error:

ValueError: threshold given as ratio to the number of voxels must be Real number and should be positive and between 0 and total number of maps i.e. n_maps=2. You provided 3.0
@dohmatob dohmatob added Documentation for documentation related questions or requests Enhancement for feature requests Good first issue Good for newcomers. Equivalent to "very low" effort. Priority: high The task is urgent and needs to be addressed as soon as possible. labels Dec 14, 2015
@lesteve
Copy link
Contributor
lesteve commented Dec 14, 2015

Would you mind describing in more details the part of the error message you find incomprehensible? It seems that you have provided threshold=3 and it is telling you you 0. < threshold <= 2.

@KamalakerDadi
Copy link
Contributor

I will go into more detailed version of this input type, what happens when user gave a list of 4D imgs. But as far as I see it should be a single 4D Nifti like object not a list of objects. If that's the case, I agree its incomprehensible error message. I will check it anyway.

Do you also have problem with single 4D image ?

@GaelVaroquaux
Copy link
Member
GaelVaroquaux commented Dec 16, 2015 via email

@GaelVaroquaux
Copy link
Member
GaelVaroquaux commented Dec 16, 2015 via email

@bthirion
Copy link
Member

All this makes sense, but will be suprising to many people who have done neuroimaging with other tools: they are used to equating 'thresholds' and 'statistical thresholds', while the concept of threshold used here is different, something like a 'selection threshold'. Maybe we should give a more explicit naming.

@GaelVaroquaux
Copy link
Member
GaelVaroquaux commented Dec 16, 2015 via email

@bthirion
Copy link
Member

'ratio', 'selection_ratio' ?

@KamalakerDadi
Copy link
Contributor

Just to share some information about the usage of threshold and its strategies:

regions extraction based on statistical thresholds can be used based upon selecting thresholding_strategy='img_value' which will act according to given threshold in statistical value provided that the value should not exceed the max.

regions extraction based on selection threshold can be done upon selecting thresholding_strategy='ratio_n_voxels' or thresholding_strategy='percentile' where threshold should be given upon the n_maps provided should not exceed more than n_maps as stated in the error message.

In this particular error case, selecting thresholding_strategy='img_value' should work if one is trying to threshold upon their statistical values or otherwise leaving to defaults should also work.

We had naming problem before. Since, we have two different strategies, fixing one name from current threshold to ratio or selection_ratio will again be a conflict to statistical thresholding strategy. Let me know if I am wrong.

@banilo
Copy link
Collaborator
banilo commented Jan 8, 2016

'cutoff'?

@KamalakerDadi
Copy link
Contributor

I feel 'cutoff' than 'threshold' is even more difficult to reach to users.

@KamalakerDadi
Copy link
Contributor

I am thinking of fixing this issue by rewriting error message as below:

threshold=3.0 provided to select for number of nonzero voxels across total number of maps (n_maps) is not valid. Please provide valid number between 0. and n_maps=2

What do you think ? @dohmatob @lesteve @GaelVaroquaux @AlexandreAbraham @banilo

@bthirion
Copy link
Member

'number of nonzero voxels across total number of maps (n_maps)' is still unclear to me, because when you say "number of nonzero voxels" people will think "maybe several hundreds (or thousands)".
IMHO the semantics of this parameters would be clearer if it were between 0 and 1, as it would represent a fraction of the population, which is easier to explain. I have to say, it is really hard to figure out what is actually done on the fit().

@KamalakerDadi
Copy link
Contributor

I have to say, it is really hard to figure out what is actually done on the fit().

Is it not clear in terms of documentation or implementation ? I am not sure which part is hard to figure ?

@AlexandreAbraham
Copy link
Contributor

IMHO the semantics of this parameters would be clearer if it were between 0 and 1, as it would represent a fraction of the population, which is easier to explain.

It is easier to explain but it defeats the purpose of the method presented here. The main advantage of this thresholding approach is that you can chose a value corresponding to a certain level of sparsity in the brain (1 if you want to avoid overlap, up to 3 if overlaps are OK for you) and then, no matter how many maps you provide, your atlas will always "look" the same, no adjustment needed. When dealing with a lot of atlases, I find it very convenient.

@bthirion
Copy link
Member

This makes sense, but then we need a serious refactoring of the documentation to clarify this, and ideally an example dedicated to region extraction that illustrates the impact of these parameters.

@bthirion
Copy link
Member

On 13/01/2016 10:06, KamalakerDadi wrote:

I have to say, it is really hard to figure out what is actually
done on the fit().

Is it not clear in terms of documentation or implementation ? I am not
sure which part is hard to figure ?


Reply to this email directly or view it on GitHub
#907 (comment).

This means 3 things:

  • The code does not run a clear operation on the data, like
    thresholding, mean computation or extraction of connected components or
    even a watershed analysis.
  • Handling it with a multi-variate point of view (n_maps > 1) is also
    non-classical. I'm not aware of any such procedure apart from that one.
  • I am currently trying to run it on other data to build an intuition,
    and do not get it.
    Of course I could take time and read the code, but I believe that
    user-level functions should be better explained.
    HTH

@GaelVaroquaux
Copy link
Member
  • Handling it with a multi-variate point of view (n_maps > 1) is also
    non-classical. I'm not aware of any such procedure apart from that one.

Right, but that's exactly what the object is there for.

It should probably be named different, with a name that stresses that it
is multi-maps.

@KamalakerDadi
Copy link
Contributor

ping @GaelVaroquaux @AlexandreAbraham @lesteve

I would like to know your opinion and ideas to bring code to more user friendly and understandable. I am working on to propose some idea. Meanwhile, any ideas or suggestions would be really helpful and great.

@bthirion bthirion self-assigned this Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation for documentation related questions or requests Enhancement for feature requests Good first issue Good for newcomers. Equivalent to "very low" effort. Priority: high The task is urgent and needs to be addressed as soon as possible.
Projects
None yet
Development

No branches or pull requests

7 participants