We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a80a16e commit 124d86bCopy full SHA for 124d86b
diffpy/srxplanar/loadimage.py
@@ -19,17 +19,20 @@
19
import fnmatch
20
import sys
21
from diffpy.srxplanar.srxplanarconfig import _configPropertyR
22
-
23
-try:
24
- import fabio
25
- def openImage(im):
26
- rv = fabio.openimage.openimage(im)
27
- return rv.data
28
-except:
29
- import tifffile
30
+import tifffile
+import subprocess
+
+def openImage(im):
+ try:
+ code = 'import numpy; import fabio; numpy.save("temp.npy", fabio.openimage.openimage("%s").data)' % im
+ cmd = [sys.executable, '-c', "'" + code + "'"]
+ p = subprocess.Popen(cmd)
+ p.wait()
31
+ rv = np.load('temp.npy')
32
+ os.remove('temp.npy')
33
+ except:
34
rv = tifffile.imread(im)
- return rv
35
+ return rv
36
37
class LoadImage(object):
38
'''
0 commit comments