-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1384 from gabknight/NF_cmc_pft_merged
NF - Particle Filtering Tractography (merge)
- Loading branch information
Showing
13 changed files
with
1,127 additions
and
130 deletions.
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.