-
Notifications
You must be signed in to change notification settings - Fork 429
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
NF - Particle Filtering Tractography (merge) #1384
Merged
Merged
Changes from 40 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
183c676
NF - added CMC tissue classifier
gabknight d0213d5
TST - test CMC tissue classifier
gabknight c87da16
WIP - particle filtering tractography
gabknight 047ee3b
WIP - PFT fixed rebased conflicts
gabknight f566927
WIP - fixed error in PFT tracking class
gabknight a574c32
NF - added getters for include/exclude maps
gabknight bfad3e1
RF - rename getters
gabknight deadc76
NF - added PFT tracker
gabknight 86328b4
NF - added from PVE map constructor for ACT and CMC tissue classifier
gabknight 29e55ba
BF - fixed memory error in PFT
gabknight 9f51480
PEP8 - PFT
gabknight bfea2b2
TST - add CMC tissueclassifier tests
gabknight faf805f
PEP - remove unused code
gabknight a444eab
TST - add test for PFT
gabknight 4263ffc
RF - rename test file for tracking
gabknight 708ace2
DOC - add doc in the ConstrainedTissueClassifier class
gabknight d77f175
DOC - add PFT example
gabknight 5573a2f
DOC - remove unused code
gabknight 89e530b
DOC - update references
gabknight 65027ae
DOC - add PFT example to valid_examples.txt
gabknight 0e4b8ad
changed np.stack to np.dstack for backward compatibility
gabknight 5361aa6
MERGE following pr#1342
gabknight 31b0e1d
RF - name variable pft_nbr_particles to particle_count
gabknight 96e7b1d
RF - rename variable pft_nbr_particles to particle_count
gabknight 7785830
RF - replaced if statements with a cast to TissueClass type
gabknight ffa421c
Some quick fixes for @gabknight PR.
jchoude c6ed1e4
Merge pull request #4 from jchoude/fixes_gab_pr
gabknight e6264b7
RF - replaced 'grey' with 'gray'
gabknight 0606a20
RF - added elements to __all__ variable
gabknight 17a772d
STYLE - pep8 white space
gabknight 481ca12
RF - replaced for loops with copypoint(.)
gabknight bd59979
Merge branch 'NF_cmc_pft_merged' into NF_cmc_pft_merged2
gabknight ec692ec
RF - cython optimization folowing PR comments
gabknight a71c6f7
STYLE - PEP8 conformance, add ValueError msg, removed typos
gabknight 7bd66a7
TEST - added new tests for PFT
gabknight a8aed0b
DOC - changed fvtk to dipy.viz
gabknight cfd9881
RF - clarified pft steamline length return, reduced memory usage
gabknight 1191dea
BF/TEST - handle trilinear_interpolation4d ouside image error
gabknight 706bdc2
BF/TEST - ConstrainedTissueClassifier get_include/_exclude return 0 f…
gabknight 5d672dd
BF/TEST - fixed missing point for streamline with small maxlen
gabknight 223541c
BF - properly handle OUSIDEIMAGE TissueType in localtrack._pft_tracke…
gabknight a63ae09
TEST - all streamline points are within the image volume
gabknight 78e4eff
BF - remove nans from particle weights
gabknight 6167be6
TST - pft particle count
gabknight 14b4c5d
RF - split pft particle_states array into 2 arrays
gabknight a4e72ef
DOC - added figures to the PFT example
gabknight 498dd86
TEST - replaced assert_ with assert_equal
gabknight 3c95b3a
DOC - added ref
gabknight 14f4c76
DOC - updated exemple with the new standard
gabknight File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import numpy as np | ||
import numpy.testing as npt | ||
|
||
from dipy.core.sphere import HemiSphere, unit_octahedron | ||
from dipy.direction.pmf import SimplePmfGen, SHCoeffPmfGen | ||
|
||
|
||
def test_pmf_from_sh(): | ||
sphere = HemiSphere.from_sphere(unit_octahedron) | ||
pmfgen = SHCoeffPmfGen(np.ones([2, 2, 2, 28]), sphere, None) | ||
|
||
# Test that the pmf is greater than 0 for a valid point | ||
pmf = pmfgen.get_pmf(np.array([0, 0, 0], dtype='float')) | ||
npt.assert_equal(np.sum(pmf) > 0, True) | ||
|
||
# Test that the pmf is 0 for invalid Points | ||
npt.assert_array_equal(pmfgen.get_pmf(np.array([-1, 0, 0], dtype='float')), | ||
np.zeros(len(sphere.vertices))) | ||
npt.assert_array_equal(pmfgen.get_pmf(np.array([0, 0, 10], dtype='float')), | ||
np.zeros(len(sphere.vertices))) | ||
|
||
|
||
def test_pmf_from_array(): | ||
sphere = HemiSphere.from_sphere(unit_octahedron) | ||
pmfgen = SimplePmfGen(np.ones([2, 2, 2, len(sphere.vertices)])) | ||
|
||
# Test that the pmf is greater than 0 for a valid point | ||
pmf = pmfgen.get_pmf(np.array([0, 0, 0], dtype='float')) | ||
npt.assert_equal(np.sum(pmf) > 0, True) | ||
|
||
# Test that the pmf is 0 for invalid Points | ||
npt.assert_array_equal(pmfgen.get_pmf(np.array([-1, 0, 0], dtype='float')), | ||
np.zeros(len(sphere.vertices))) | ||
npt.assert_array_equal(pmfgen.get_pmf(np.array([0, 0, 10], dtype='float')), | ||
np.zeros(len(sphere.vertices))) | ||
|
||
npt.assert_raises( | ||
ValueError, | ||
lambda: SimplePmfGen(np.ones([2, 2, 2, len(sphere.vertices)])*-1)) | ||
|
||
|
||
if __name__ == '__main__': | ||
npt.run_module_suite() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
from .localtracking import LocalTracking | ||
from .tissue_classifier import ( | ||
ActTissueClassifier, BinaryTissueClassifier, ThresholdTissueClassifier, | ||
TissueClassifier) | ||
from .direction_getter import DirectionGetter | ||
from .localtracking import LocalTracking, ParticleFilteringTracking | ||
from .tissue_classifier import (ActTissueClassifier, | ||
BinaryTissueClassifier, | ||
CmcTissueClassifier, | ||
ConstrainedTissueClassifier, | ||
ThresholdTissueClassifier, | ||
TissueClassifier) | ||
|
||
from dipy.tracking import utils | ||
|
||
__all__ = ["ActTissueClassifier", "BinaryTissueClassifier", "LocalTracking", | ||
"ThresholdTissueClassifier"] | ||
__all__ = ["ActTissueClassifier", "BinaryTissueClassifier", | ||
"CmcTissueClassifier", "ConstrainedTissueClassifier", | ||
"DirectionGetter", "LocalTracking", "ParticleFilteringTracking", | ||
"ThresholdTissueClassifier", "TissueClassifier"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imported but never used. Is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to
__all__
. Thx