Skip to content
Snippets Groups Projects
Commit 5e2d2a6e authored by Alán Muñoz's avatar Alán Muñoz
Browse files

drift bugfix

parent f5285e41
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ class Trap: ...@@ -53,7 +53,7 @@ class Trap:
def at_time(self, tp): def at_time(self, tp):
"""Return trap centre at time tp""" """Return trap centre at time tp"""
drifts = self.parent.drifts drifts = self.parent.drifts
return self.centre - np.sum(drifts[:tp], axis=0) return self.centre - np.sum(drifts[: tp + 1], axis=0)
def as_tile(self, tp): def as_tile(self, tp):
"""Return trap in the OMERO tile format of x, y, w, h """Return trap in the OMERO tile format of x, y, w, h
...@@ -155,28 +155,27 @@ class Tiler(ProcessABC): ...@@ -155,28 +155,27 @@ class Tiler(ProcessABC):
image, image,
metadata, metadata,
parameters: TilerParameters, parameters: TilerParameters,
trap_locs=None,
): ):
super().__init__(parameters) super().__init__(parameters)
self.image = image self.image = image
self.channels = metadata["channels"] self.channels = metadata["channels"]
self.ref_channel = self.get_channel_index(parameters.ref_channel) self.ref_channel = self.get_channel_index(parameters.ref_channel)
self.trap_locs = trap_locs
@classmethod @classmethod
def from_image(cls, image, parameters: TilerParameters): def from_image(cls, image, parameters: TilerParameters):
return cls(image.data, image.metadata, parameters) return cls(image.data, image.metadata, parameters)
@classmethod @classmethod
def from_hdf5(cls, image, filepath, tile_size=None): def from_hdf5(cls, image, filepath):
trap_locs = TrapLocations.read_hdf5(filepath) trap_locs = TrapLocations.read_hdf5(filepath)
metadata = load_attributes(filepath) metadata = load_attributes(filepath)
metadata["channels"] = metadata["channels/channel"].tolist() metadata["channels"] = metadata["channels/channel"].tolist()
if tile_size is None: return cls(
tile_size = trap_locs.tile_size image.data,
return Tiler( metadata,
image=image, TilerParameters.default(),
metadata=metadata,
template=None,
tile_size=tile_size,
trap_locs=trap_locs, trap_locs=trap_locs,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment