updated task for making plots
@@ -69,7 +69,7 @@ class IndexTracker:
class PatchShowTask(EOTask):
""" Task to display sequence of 2D images """
- def __init__(self, feature_type=FeatureType.DATA, feature_name='TRUE_COLOR', indices=None):
+ def __init__(self, feature, indices=None):
""" This task allows to visualise and slice through an eopatch along the temporal dimension.
The data to display is supposed to have the following dimensions: n_timeframes x n_rows x n_cols (x n_chan).
@@ -77,16 +77,13 @@ class PatchShowTask(EOTask):
If the array is 4D, the last dimension is either equal to 3 (RGB) or the length of indices must be equal to 1
or 3.
- :param feature_type: Type of feature to display from eopatch. Default is `Featuretype.DATA`
- :type feature_type: FeatureType
- :param feature_name: Name of feature to display. Default is `TRUE_COLOR`
- :type feature_name: str
+ :param feature: A feature to be plotted
+ :type feature: str or (FeatureType, str)
:param indices: Indices of channels to be displayed in multi-channel EOPatches. Length of indices must be either
1 or 3. Default is `None`
:type indices: list
"""
- self.feature_type = feature_type
- self.feature_name = feature_name
+ self.feature = self._parse_features(feature)
self.indices = indices
def _get_data_to_display(self, eopatch):
@@ -95,7 +92,9 @@ class PatchShowTask(EOTask):
:param eopatch: Input eopatch
:return: Array to display and whether it is single channel or not
"""
- image_seq = eopatch[self.feature_type.value][self.feature_name]
+ feature_type, feature_name = next(self.feature(eopatch))
+
+ image_seq = eopatch[feature_type][feature_name]
single_channel = False
if image_seq.ndim == 3:
# single channel
