From fdb4a83695771da201ba603d6949bd5b11952fad Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Sun, 17 Apr 2022 20:55:58 -0500 Subject: [PATCH] Add a gaussian laplace op to ProcessedImageSeries This performs a gaussian laplace filter on the data. Note that in my testing of this, it seems to be a time-consuming operation to perform. Signed-off-by: Patrick Avery --- hexrd/imageseries/process.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hexrd/imageseries/process.py b/hexrd/imageseries/process.py index 112324bcc..582bbb0f5 100644 --- a/hexrd/imageseries/process.py +++ b/hexrd/imageseries/process.py @@ -2,6 +2,7 @@ import copy import numpy as np +import scipy from .baseclass import ImageSeries @@ -12,6 +13,7 @@ class ProcessedImageSeries(ImageSeries): DARK = 'dark' RECT = 'rectangle' ADD = 'add' + GAUSS_LAPLACE = 'gauss_laplace' def __init__(self, imser, oplist, **kwargs): """imsageseries based on existing one with image processing options @@ -36,6 +38,7 @@ def __init__(self, imser, oplist, **kwargs): self.addop(self.FLIP, self._flip) self.addop(self.RECT, self._rectangle) self.addop(self.ADD, self._add) + self.addop(self.GAUSS_LAPLACE, self._gauss_laplace) def __getitem__(self, key): return self._process_frame(self._get_index(key)) @@ -103,6 +106,9 @@ def _add(self, img, addend): img = img.astype(np.float32) return img + addend + def _gauss_laplace(self, img, sigma): + return scipy.ndimage.gaussian_laplace(img, sigma) + # # ==================== API #