-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to load transformations from a file (#84)
Partially addresses #17. --------- Co-authored-by: Juan Nunez-Iglesias <[email protected]>
- Loading branch information
1 parent
40370a1
commit e9bd67c
Showing
4 changed files
with
44 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
from magicgui import magic_factory | ||
|
||
|
||
@magic_factory(call_button='Load', affine={'mode': 'r'}) | ||
def load_affine(layer: 'napari.layers.Layer', affine: Path): | ||
"""Load affine matrix from a file. | ||
Parameters | ||
---------- | ||
layer : napari.layers.Layer | ||
Layer to load affine to. | ||
affine : string or path | ||
Path to the file containing affine matrix. Must be | ||
comma-delimited txt. | ||
""" | ||
affine = np.loadtxt(affine, delimiter=',') | ||
layer.affine = affine |
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