diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-15 15:11:30 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-04-15 15:11:30 +0100 |
commit | 617f2e71dd34b3c1fe2997ffbaeefd7f030ec3aa (patch) | |
tree | 13db5f18d1e9b1964e76ec9651adde0a23feffff | |
parent | f1e095e530c0e06007344fbd3f40bf4dcad9686c (diff) | |
download | framework-617f2e71dd34b3c1fe2997ffbaeefd7f030ec3aa.tar.gz framework-617f2e71dd34b3c1fe2997ffbaeefd7f030ec3aa.tar.bz2 framework-617f2e71dd34b3c1fe2997ffbaeefd7f030ec3aa.tar.xz framework-617f2e71dd34b3c1fe2997ffbaeefd7f030ec3aa.zip |
fixed load method
-rw-r--r-- | Wrappers/Python/ccpi/io/reader.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Wrappers/Python/ccpi/io/reader.py b/Wrappers/Python/ccpi/io/reader.py index 856f5e0..07e3bf9 100644 --- a/Wrappers/Python/ccpi/io/reader.py +++ b/Wrappers/Python/ccpi/io/reader.py @@ -241,26 +241,37 @@ class NexusReader(object): pass
dims = file[self.data_path].shape
if ymin is None and ymax is None:
- data = np.array(file[self.data_path])
+
+ try:
+ image_keys = self.get_image_keys()
+ print ("image_keys", image_keys)
+ projections = np.array(file[self.data_path])
+ data = projections[image_keys==0]
+ except KeyError as ke:
+ print (ke)
+ data = np.array(file[self.data_path])
+
else:
+ image_keys = self.get_image_keys()
+ print ("image_keys", image_keys)
+ projections = np.array(file[self.data_path])[image_keys==0]
if ymin is None:
ymin = 0
if ymax > dims[1]:
raise ValueError('ymax out of range')
- data = np.array(file[self.data_path][:,:ymax,:])
+ data = projections[:,:ymax,:]
elif ymax is None:
ymax = dims[1]
if ymin < 0:
raise ValueError('ymin out of range')
- data = np.array(file[self.data_path][:,ymin:,:])
+ data = projections[:,ymin:,:]
else:
if ymax > dims[1]:
raise ValueError('ymax out of range')
if ymin < 0:
raise ValueError('ymin out of range')
- data = np.array(file[self.data_path]
- [: , ymin:ymax , :] )
+ data = projections[: , ymin:ymax , :]
except:
print("Error reading nexus file")
|