From 515abcc1871ab5d78ae69efa0fa53fe26d73ce6a Mon Sep 17 00:00:00 2001 From: "Hannes F. Kuchelmeister" Date: Thu, 22 Jul 2021 11:38:38 +0200 Subject: [PATCH] add documentation for transformation --- situr/transformation/transformation.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/situr/transformation/transformation.py b/situr/transformation/transformation.py index f2c11f3..a79688a 100644 --- a/situr/transformation/transformation.py +++ b/situr/transformation/transformation.py @@ -2,7 +2,10 @@ import abc import numpy as np import scipy + class Transform: + """Abstract class representing a transformatio that can be performed on an image. + """ __metaclass__ = abc.ABCMeta @abc.abstractmethod @@ -12,13 +15,21 @@ class Transform: class IdentityTransform(Transform): + """A transformation that does not change the image. + It inherits from Transform. + """ + def apply_tranformation(self, img: np.ndarray) -> np.ndarray: return img class ScaleRotateTranslateTransform(Transform): - def __init__(self, transform_matrix: np.ndarray, scale: int = 1, offset: np.array = np.array([0, 0])): - """Constructor for a Transformation that supports rotation, translation and scaling on an image + def __init__(self, + transform_matrix: np.ndarray, + scale: int = 1, + offset: np.array = np.array([0, 0])): + """Constructor for a Transformation that supports rotation, translation and scaling on an + image Args: transform_matrix (np.ndarray): A matrix of shape (2,2)