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

Add positivity constraint on the propagator #338

Merged
merged 5 commits into from
Apr 11, 2014

Conversation

maurozucchelli
Copy link
Contributor

This pull request add the possibility to enforce positiveness in the EAP in the set of points defined by a grid of a certain radius. The number of points depend on the size of the grid. This option improves the results but makes the fitting a lot slower than without it, so it is better to chose the size of the grid wisely.

G = None
h = None
else:
G = self.cache_get('shore_matrix_G', key=(self.pos_grid, self.pos_radius))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would give the cached matrix a more declarative name than shore_matrix_G. Something like shore_matrix_positive_constraint

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@demianw
Copy link
Contributor

demianw commented Mar 14, 2014

Nice job, I just made a couple comments

@@ -108,6 +110,13 @@ def __init__(self,
square root of the b-value.
constrain_e0 : bool,
Constrain the optimization such that E(0) = 1.
pos_grid : int,
Grid that define the points of the EAP in which we want to enforce
positiveness, if None no constrain is imposed. The parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

Typos => "positivity", "no constraint"

@Garyfallidis Garyfallidis changed the title Add positivity constrain on the propagator Add positivity constraint on the propagator Mar 17, 2014
@@ -108,6 +110,13 @@ def __init__(self,
square root of the b-value.
constrain_e0 : bool,
Constrain the optimization such that E(0) = 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: constraint

@Garyfallidis
Copy link
Contributor

@maurozucchelli when you say it makes it slower can you give us some timings? How much slower and perhaps how much better the result is? Is there anything that can be done to make it faster can the psi matrix be smaller or something? Or can some more things be cached in advance?

@maurozucchelli
Copy link
Contributor Author

@Garyfallidis I made some tests:
Creating the matrix takes 1 second for a grid of size 11 and up to 30 seconds for a grid of size 35, but the matrix is then cached so this operation is made only for the first voxel than takes 5e-06 seconds to take the matrix from the cache for the other voxels.
The problem is the optimization, here a list of times:
Gridsize | Solution time (s)
11 | 0.07 per voxel
17 | 0.26 per voxel
21 | 0.45 per voxel
35 | 1.70 per voxel
For a full brain a gridsize of 11 makes the fitting last 2:30 hours which is ok I think.
The positive constraint makes avoid the presence of negative peaks on the ODF, the fitting is more robust to noise and all the maps looks better.

@Garyfallidis
Copy link
Contributor

Thx!

Garyfallidis added a commit that referenced this pull request Apr 11, 2014
Add positivity constraint on the propagator
@Garyfallidis Garyfallidis merged commit d5e6426 into dipy:master Apr 11, 2014
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