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

Bago dti min #12

Open
wants to merge 85 commits into
base: dti_min_signal_test
Choose a base branch
from
Open

Conversation

arokem
Copy link

@arokem arokem commented Dec 10, 2014

There are too many commits here, but some of these should go away when you rebase your branch on master. It's the recent merge of the LiFE branch.

The last commit is what I am proposing. How about that? I have set it so that a voxel with 0 signal is considered to be masked (there's something wrong with that one anyway, no?) and a signal with a very low signal has high eigen-values. What do you think? Does this solve your issue? Any other ideas?

stefanv and others added 30 commits December 4, 2014 01:45
And replaced with `move_streamlines`, but I am defering that until I get a
sense of what is happening here.
Maybe use dipy.sims.voxel directly?
stefanv and others added 2 commits December 10, 2014 12:55
@MrBago
Copy link
Owner

MrBago commented Dec 10, 2014

I don't think this works. You cannot pass a test simply by changing the test :). The whole issue here is that we could, and sometimes do get voxels with zeros.

The case with all zeros should be considered masked, there is nothing else we can really do with that, but I'd prefer not to have to deal with it explicitly inside of the loop, that's a pretty big performance penalty.

The whole point of the other test case was to show the shortcomings of the current code. Yes a voxel with very low signals will have high diffusivity. A dwi signal of 0 should be "very low signal" and give a similar result. By changing the test, you've stopped testing the very case I'm concerned about.

My proposal is to revert the code, and handle this in the TensorModel instead of the fit method. This has the added benefit of reducing code duplication because we do not need handle this repeatedly for each fit_method.

@arokem
Copy link
Author

arokem commented Dec 10, 2014

OK - I am just trying to understand the concern. Will keep hacking on
this...

On Wed, Dec 10, 2014 at 2:10 PM, MrBago notifications@github.com wrote:

I don't think this works. You cannot pass a test simply by changing the
test :). The whole issue here is that we could, and sometimes do get voxels
with zeros.

The case with all zeros should be considered masked, there is nothing else
we can really do with that, but I'd prefer not to have to deal with it
explicitly inside of the loop, that's a pretty big performance penalty.

The whole point of the other test case was to show the shortcomings of the
current code. Yes a voxel with very low signals will have high diffusivity.
A dwi signal of 0 should be "very low signal" and give a similar result. By
changing the test, you've stopped testing the very case I'm concerned about.

My proposal is to revert the code, and handle this in the TensorModel
instead of the fit method. This has the added benefit of reducing code
duplication because we do not need handle this repeatedly for each
fit_method.


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

@arokem
Copy link
Author

arokem commented Dec 10, 2014

Oh - one more detail: what should the eigenvalue be for those voxels (all
zeros, except the b0 measurements)?

I guess it should be isotropic, so the eigen-vectors is np.eye(3), but what
exactly do we set the eigenvalues to be?

On Wed, Dec 10, 2014 at 2:14 PM, Ariel Rokem arokem@gmail.com wrote:

OK - I am just trying to understand the concern. Will keep hacking on
this...

On Wed, Dec 10, 2014 at 2:10 PM, MrBago notifications@github.com wrote:

I don't think this works. You cannot pass a test simply by changing the
test :). The whole issue here is that we could, and sometimes do get voxels
with zeros.

The case with all zeros should be considered masked, there is nothing
else we can really do with that, but I'd prefer not to have to deal with it
explicitly inside of the loop, that's a pretty big performance penalty.

The whole point of the other test case was to show the shortcomings of
the current code. Yes a voxel with very low signals will have high
diffusivity. A dwi signal of 0 should be "very low signal" and give a
similar result. By changing the test, you've stopped testing the very case
I'm concerned about.

My proposal is to revert the code, and handle this in the TensorModel
instead of the fit method. This has the added benefit of reducing code
duplication because we do not need handle this repeatedly for each
fit_method.


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

@arokem
Copy link
Author

arokem commented Dec 10, 2014

Is this too much?

arokem@304f9cd

It deals with the whole issue up-front, regardless of the fitting
algorithm.

Not all tests are passing, but I think it might be doing the right thing
nevertheless. I think that the test failures are coming from places where
the eigen-values and eigenvectors are set to 0, and previously they might
have been set to nan (?). I have to go now, but I will be back online
tomorrow morning.

On Wed, Dec 10, 2014 at 2:18 PM, Ariel Rokem arokem@gmail.com wrote:

Oh - one more detail: what should the eigenvalue be for those voxels (all
zeros, except the b0 measurements)?

I guess it should be isotropic, so the eigen-vectors is np.eye(3), but
what exactly do we set the eigenvalues to be?

On Wed, Dec 10, 2014 at 2:14 PM, Ariel Rokem arokem@gmail.com wrote:

OK - I am just trying to understand the concern. Will keep hacking on
this...

On Wed, Dec 10, 2014 at 2:10 PM, MrBago notifications@github.com wrote:

I don't think this works. You cannot pass a test simply by changing the
test :). The whole issue here is that we could, and sometimes do get voxels
with zeros.

The case with all zeros should be considered masked, there is nothing
else we can really do with that, but I'd prefer not to have to deal with it
explicitly inside of the loop, that's a pretty big performance penalty.

The whole point of the other test case was to show the shortcomings of
the current code. Yes a voxel with very low signals will have high
diffusivity. A dwi signal of 0 should be "very low signal" and give a
similar result. By changing the test, you've stopped testing the very case
I'm concerned about.

My proposal is to revert the code, and handle this in the TensorModel
instead of the fit method. This has the added benefit of reducing code
duplication because we do not need handle this repeatedly for each
fit_method.


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

@arokem
Copy link
Author

arokem commented Dec 11, 2014

OK - I believe that the tests should be passing now (they're passing on my laptop). We still need to refactor out all the references to min_signal, outside of the __init__ and fit functions of the TensorModel, because this issue should be dealt with upfront in those places. Thoughts?

@MrBago
Copy link
Owner

MrBago commented Dec 11, 2014

Not the approach that I would have taken :), but it does solve the problem.
How should we go about merging this?

Bago

MrBago and others added 6 commits December 11, 2014 11:17
These two cases should be separated: if s0 is non-zero, and all of the d_sig is
zero, the eigenvalues should be high (3.0 per default, the diffusion of water
in water at 37 deg C). If all of the signals are 0, we set the eigenvalues and
eigenvectors to 0.
Also, deal with setting of min_signal. This still needs a little bit more
cleanup.
@arokem
Copy link
Author

arokem commented Dec 11, 2014

How about I rebase this stuff on master and make a new PR?

@MrBago
Copy link
Owner

MrBago commented Dec 11, 2014

Sure, I believe with this approach we should be able to remove all
references to min_singal right?

Bago

On Thu, Dec 11, 2014 at 11:18 AM, Ariel Rokem notifications@github.com
wrote:

How about I rebase this stuff on master and make a new PR?


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

@arokem
Copy link
Author

arokem commented Dec 11, 2014

Yes - we can keep it around at the init level, so people can use it if
they want, but it is a bit vestigial.

On Thu, Dec 11, 2014 at 11:21 AM, MrBago notifications@github.com wrote:

Sure, I believe with this approach we should be able to remove all
references to min_singal right?

Bago

On Thu, Dec 11, 2014 at 11:18 AM, Ariel Rokem notifications@github.com
wrote:

How about I rebase this stuff on master and make a new PR?


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


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

@arokem
Copy link
Author

arokem commented Dec 11, 2014

I decided to go with the more extreme variant of this. What do you think?

On Thu, Dec 11, 2014 at 11:25 AM, Ariel Rokem arokem@gmail.com wrote:

Yes - we can keep it around at the init level, so people can use it if
they want, but it is a bit vestigial.

On Thu, Dec 11, 2014 at 11:21 AM, MrBago notifications@github.com wrote:

Sure, I believe with this approach we should be able to remove all
references to min_singal right?

Bago

On Thu, Dec 11, 2014 at 11:18 AM, Ariel Rokem notifications@github.com
wrote:

How about I rebase this stuff on master and make a new PR?


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


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

DTI requires a b0 measurement. This did not exist in the data that was
previously used for testing. For that reason, the eigenvalues in these tests
were always exceedingly low (set by min_diffusivity, I believe). I believe that
it makes more sense to test the model fitting with DTI data. Single b-value and
including a b0 measurement.
@MrBago
Copy link
Owner

MrBago commented Dec 12, 2014

@arokem I'd like to talk about this, can you contact me offline?

Almost there - still need to deal with that hard-coded minimum for cases where
all the signal is 0. Need to think about that.
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.

4 participants