-
Notifications
You must be signed in to change notification settings - Fork 1
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 #2 from espdev/refactoring-and-docs
Refactoring and docs
- Loading branch information
Showing
19 changed files
with
1,168 additions
and
334 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
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,97 @@ | ||
.. _api: | ||
|
||
************* | ||
API Reference | ||
************* | ||
|
||
.. currentmodule:: skmpe | ||
|
||
API Summary | ||
=========== | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
|
||
InitialInfo | ||
PathInfo | ||
PathInfoResult | ||
|
||
TravelTimeOrder | ||
OdeSolverMethod | ||
Parameters | ||
parameters | ||
default_parameters | ||
|
||
MPEError | ||
ComputeTravelTimeError | ||
PathExtractionError | ||
EndPointNotReachedError | ||
|
||
PathExtractionResult | ||
MinimalPathExtractor | ||
mpe | ||
|
||
| | ||
Data and Models | ||
=============== | ||
|
||
.. autoclass:: InitialInfo | ||
:members: | ||
|
||
.. autoclass:: PathInfo | ||
:show-inheritance: | ||
|
||
.. autoclass:: PathInfoResult | ||
:show-inheritance: | ||
|
||
Parameters | ||
========== | ||
|
||
.. autoclass:: TravelTimeOrder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: OdeSolverMethod | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: Parameters | ||
:members: | ||
:undoc-members: | ||
|
||
.. autofunction:: parameters | ||
.. autofunction:: default_parameters | ||
|
||
Exceptions | ||
========== | ||
|
||
.. autoclass:: MPEError | ||
:show-inheritance: | ||
|
||
.. autoclass:: ComputeTravelTimeError | ||
:show-inheritance: | ||
|
||
.. autoclass:: PathExtractionError | ||
:members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: EndPointNotReachedError | ||
:members: | ||
:inherited-members: PathExtractionError | ||
:exclude-members: with_traceback | ||
:show-inheritance: | ||
|
||
Path Extraction | ||
=============== | ||
|
||
.. autoclass:: PathExtractionResult | ||
:show-inheritance: | ||
|
||
.. autoclass:: MinimalPathExtractor | ||
:members: | ||
:special-members: __call__ | ||
|
||
.. autofunction:: mpe |
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,77 @@ | ||
.. _examples: | ||
|
||
******** | ||
Examples | ||
******** | ||
|
||
Retina Vessels | ||
============== | ||
|
||
Extracting the minimal path through the retina vessels with additional way points. | ||
|
||
.. plot:: | ||
|
||
from skimage.data import retina | ||
from skimage.color import rgb2gray | ||
from skimage.transform import rescale | ||
from skimage.filters import sato | ||
|
||
from skmpe import mpe | ||
|
||
image = rescale(rgb2gray(retina()), 0.5) | ||
speed_image = sato(image) | ||
|
||
start_point = (76, 388) | ||
end_point = (611, 442) | ||
way_points = [(330, 98), (554, 203)] | ||
|
||
path_info = mpe(speed_image, start_point, end_point, way_points) | ||
|
||
px, py = path_info.path[:, 1], path_info.path[:, 0] | ||
|
||
plt.imshow(image, cmap='gray') | ||
plt.plot(px, py, '-r') | ||
plt.plot(*start_point[::-1], 'oy') | ||
plt.plot(*end_point[::-1], 'og') | ||
for p in way_points: | ||
plt.plot(*p[::-1], 'ob') | ||
plt.axis('off') | ||
|
||
Bricks | ||
====== | ||
|
||
Extracting the shortest paths through "bricks" image. | ||
|
||
.. plot:: | ||
|
||
from skimage.data import brick | ||
from skimage.transform import rescale | ||
from skimage.exposure import rescale_intensity, adjust_sigmoid | ||
|
||
from skmpe import parameters, mpe | ||
|
||
image = rescale(brick(), 0.5) | ||
speed_image = rescale_intensity( | ||
adjust_sigmoid(image, cutoff=0.5, gain=10).astype(np.float_), out_range=(0., 1.)) | ||
|
||
start_point = (44, 13) | ||
end_point = (233, 230) | ||
way_points = [(211, 59), (17, 164)] | ||
|
||
with parameters(integrate_max_step=1.0): | ||
path_info1 = mpe(speed_image, start_point, end_point) | ||
path_info2 = mpe(speed_image, start_point, end_point, way_points) | ||
|
||
px1, py1 = path_info1.path[:, 1], path_info1.path[:, 0] | ||
px2, py2 = path_info2.path[:, 1], path_info2.path[:, 0] | ||
|
||
plt.imshow(image, cmap='gray') | ||
plt.plot(px1, py1, '-r', linewidth=2) | ||
plt.plot(px2, py2, '--r', linewidth=2) | ||
|
||
plt.plot(*start_point[::-1], 'oy') | ||
plt.plot(*end_point[::-1], 'og') | ||
for p in way_points: | ||
plt.plot(*p[::-1], 'ob') | ||
plt.axis('off') |
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
Oops, something went wrong.