Commit 8283ae8c authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Set linear shift if shift is bigger than 1

parent cc759976
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
__authors__ = ["J. Garriga"] __authors__ = ["J. Garriga"]
__license__ = "MIT" __license__ = "MIT"
__date__ = "16/06/2021" __date__ = "05/07/2021"
import copy import copy
import glob import glob
...@@ -737,7 +737,7 @@ class Dataset(): ...@@ -737,7 +737,7 @@ class Dataset():
return Dataset(_dir=roi_dir, data=new_data, dims=self.__dims, transformation=transformation, return Dataset(_dir=roi_dir, data=new_data, dims=self.__dims, transformation=transformation,
in_memory=self._in_memory) in_memory=self._in_memory)
def find_shift(self, dimension=None, steps=100, indices=None): def find_shift(self, dimension=None, steps=50, indices=None):
""" """
Find shift of the data or part of it. Find shift of the data or part of it.
...@@ -797,6 +797,8 @@ class Dataset(): ...@@ -797,6 +797,8 @@ class Dataset():
if not self.operations_state[Operation.SHIFT]: if not self.operations_state[Operation.SHIFT]:
return return
filename = _dir + "/data" + str(i).zfill(4) + ".npy" filename = _dir + "/data" + str(i).zfill(4) + ".npy"
if shift[:, i] > 1:
shift_approach = "linear"
img = apply_shift(data[i], shift[:, i], shift_approach) img = apply_shift(data[i], shift[:, i], shift_approach)
numpy.save(filename, img) numpy.save(filename, img)
urls.append(DataUrl(file_path=filename, scheme='fabio')) urls.append(DataUrl(file_path=filename, scheme='fabio'))
...@@ -828,6 +830,8 @@ class Dataset(): ...@@ -828,6 +830,8 @@ class Dataset():
if not self.operations_state[Operation.SHIFT]: if not self.operations_state[Operation.SHIFT]:
return return
filename = _dir + "/data" + str(i).zfill(4) + ".npy" filename = _dir + "/data" + str(i).zfill(4) + ".npy"
if shift[:, i] > 1:
shift_approach = "linear"
img = apply_shift(data[i], shift[:, i], shift_approach) img = apply_shift(data[i], shift[:, i], shift_approach)
numpy.save(filename, img) numpy.save(filename, img)
urls.append(DataUrl(file_path=filename, scheme='fabio')) urls.append(DataUrl(file_path=filename, scheme='fabio'))
......
Markdown is supported
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