Skip to content

Commit

Permalink
Merge pull request #84 from multimeric/fix-63
Browse files Browse the repository at this point in the history
Better conversion from napari Shapes to Rois
  • Loading branch information
pr4deepr authored Oct 7, 2024
2 parents 061c94a + 88e210c commit e20ec1b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugin/napari_lattice/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,19 @@ def _enable_crop(self, enabled: bool) -> bool:

def _make_model(self) -> Optional[CropParams]:
import numpy as np
from lls_core.models.crop import Roi

if self.fields_enabled.value:
deskew = self._get_deskew()
rois = []
for shape_layer in self.shapes.value:
for x in shape_layer.data:
rois.append(Roi.from_array(x / deskew.dy))

return CropParams(
# Convert from the input image space to the deskewed image space
# We assume here that dx == dy which isn't ideal
roi_list=ShapesData([np.array(shape.data) / deskew.dy for shape in self.shapes.value if len(shape.data) > 0]),
roi_list=rois,
z_range=tuple(self.z_range.value),
)
return None
Expand Down

0 comments on commit e20ec1b

Please sign in to comment.