Skip to content

Commit 0890e0e

Browse files
author
joeljonsson
committed
final touches to python examples and test
1 parent b56935a commit 0890e0e

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ Example usage of the available functionality:
129129
| [Example_get_apr_from_file](./examples/python_examples/Example_get_apr_from_file.py) | create an APR from a TIFF and store as hdf5. |
130130
| [Example_reconstruct_image](./examples/python_examples/Example_reconstruct_image.py) | read in an APR and reconstruct a pixel image |
131131

132+
Note that you may have to manually change the `sys.path.insert()` statements before `import pyApr` in these scripts to insert your build folder.
133+
132134
## Coming soon
133135

134136
* more examples for APR-based filtering and segmentation

examples/python_examples/Example_get_apr_from_array.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Joel Jonsson, 2018
2+
13
import os, sys
24
import argparse
35
import numpy as np

examples/python_examples/Example_get_apr_from_file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# Joel Jonsson, 2018
2+
13
import os, sys
24
import argparse
35

4-
56
sys.path.insert(0, "../../cmake-build-release") #change this to your build folder
67
import pyApr
78

examples/python_examples/Example_reconstruct_image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Joel Jonsson, 2018
2+
13
import os, sys
24
import argparse
35
import numpy as np

examples/python_examples/TIFFreadwrite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def writeTiff(fileName, array, compression=None):
2828

2929
def readTiff(fileName):
3030
"""
31-
Read a tiff file into a ndarray
32-
Usage: zstack = readTiff(inFileName)
31+
Read a tiff file into a numpy array
32+
Usage: img = readTiff(fileName)
3333
"""
3434
tiff = TIFFfile(fileName)
3535
samples, sample_names = tiff.get_samples()

test/pythonTest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# Joel Jonsson, 2018
2+
# Basic test of python functionality
3+
14
# Find path to script - all test files are kept there
25
import os, sys
36
myPath = os.path.dirname(os.path.abspath(__file__))
47

5-
# The test is run from the build folder, which is where the pyApr module is located
8+
# The script has to be run from the build folder, which is where the pyApr module is located
69
sys.path.insert(0, os.getcwd())
710
import pyApr
811

@@ -142,6 +145,7 @@ def main():
142145
print("**** failed ****")
143146

144147
print('PASSED {}/8 TESTS'.format(successes))
148+
assert successes == 8
145149

146150

147151
if __name__ == '__main__':

0 commit comments

Comments
 (0)