Skip to content

Commit

Permalink
Image preprocessing helper: transform_image get image in YX order
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Oct 1, 2024
1 parent cbf6cef commit 8533073
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions orangecontrib/snom/preprocess/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __call__(self, data, image_opts):
data.X[:, 0] = odata.get_column(image_opts["attr_value"], copy=True)
try:
hypercube, _, indices = get_ndim_hyperspec(
data, (image_opts["attr_x"], image_opts["attr_y"])
data, (self.image_opts["attr_y"], self.image_opts["attr_x"])
)
image = hypercube[:, :, 0]
transformed = self.transform_image(image)
Expand All @@ -56,6 +56,9 @@ def __call__(self, data, image_opts):
return data

def transform_image(self, image):
"""
image: a numpy 2D array where image[y,x] is the value in image row y and column x
"""
raise NotImplementedError


Expand Down Expand Up @@ -113,7 +116,7 @@ def __call__(self, data):
data = data.transform(ndom)
try:
hypercube, _, indices = get_ndim_hyperspec(
data, (self.image_opts["attr_x"], self.image_opts["attr_y"])
data, (self.image_opts["attr_y"], self.image_opts["attr_x"])
)
image = hypercube[:, :, 0]
transformed = self.transform_image(image)
Expand All @@ -123,4 +126,7 @@ def __call__(self, data):
return self.transformed(data)

def transform_image(self, image):
"""
image: a numpy 2D array where image[y,x] is the value in image row y and column x
"""
raise NotImplementedError

0 comments on commit 8533073

Please sign in to comment.