Commit 8fdf136f authored by Istvan N Huszar's avatar Istvan N Huszar
Browse files

Partial bugfix for TIRLFile object ID redundancy problem.

parents e6988a71 254f007b
.idea/
/tests/report/
/build/
/dist/
/src/tirl/cmodules/finv.c
/src/tirl/cmodules/fslinterpolator.cpp
/src/tirl/cmodules/*.a
/src/tirl/cmodules/*.so
/tirl.egg-info/
*__pycache__
.*
/pdf/
\ No newline at end of file
File added
......@@ -1819,19 +1819,28 @@ class TImage(TField):
if self.mask is not None:
mask = mask.reshape(target_domain.shape)
<<<<<<< HEAD
# Bugfix: the voxel shape might change upon evaluation (2D/3D case!)
if self.order == TENSOR_MAJOR:
taxes = tuple(range(self.tdim))
else:
taxes = tuple(range(data.ndim - self.tdim, data.ndim))
=======
>>>>>>> 254f007b0827c68168480bd669bfea8b135a97e7
# Mask points that are outside the voxel grid
# Added on 13 August 2020
if ts.TIMAGE_MASK_MISSING_DATA:
if mask is None:
mask = np.ones(target_domain.shape, dtype=np.float32)
<<<<<<< HEAD
if taxes:
indices = np.flatnonzero(np.all(data == np.inf, axis=taxes))
=======
if self.taxes:
indices = np.flatnonzero(np.all(
data == np.inf, axis=self.taxes))
>>>>>>> 254f007b0827c68168480bd669bfea8b135a97e7
else:
indices = np.flatnonzero(data == np.inf)
data[data == np.inf] = ts.FILL_VALUE
......@@ -1849,6 +1858,14 @@ class TImage(TField):
# Create new TImage
new_name = "%s.%s" % (self.name, target_domain.name)
<<<<<<< HEAD
=======
# Bugfix: the voxel shape might change upon evaluation (2D/3D case!)
if self.order == TENSOR_MAJOR:
taxes = tuple(range(self.tdim))
else:
taxes = tuple(range(data.ndim - self.tdim, data.ndim))
>>>>>>> 254f007b0827c68168480bd669bfea8b135a97e7
# ipc = self.interpolator.__class__
# ip = self.interpolator
# interpolator = ipc(data, ip.threads, ip.verbose, **ip.kwargs)
......
......@@ -138,16 +138,28 @@ class TIRLObject(object, metaclass=InstanceCounterMeta):
if isinstance(node, dict):
iterator = ((key, node[key]) for key in sorted(node.keys()))
for key, item in iterator:
<<<<<<< HEAD
=======
# for key, item in node.items():
>>>>>>> 254f007b0827c68168480bd669bfea8b135a97e7
res = TIRLObject.hload(item, objects)
if isinstance(res, TIRLObject):
node[key] = res
if ("type" in node.keys()) and ("id" in node.keys()):
<<<<<<< HEAD
obj = getattr(locate(node["type"]), "_load")(node)
if node["id"] not in objects.keys():
objects.update({node["id"]: obj})
return objects[node["id"]]
else:
return obj
=======
if node["id"] not in objects.keys():
# obj = locate(node["type"])._load(node)
obj = getattr(locate(node["type"]), "_load")(node)
objects.update({node["id"]: obj})
return objects[node["id"]]
>>>>>>> 254f007b0827c68168480bd669bfea8b135a97e7
elif isinstance(node, list):
for key, item in enumerate(node):
res = TIRLObject.hload(item, objects)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment