diff --git a/spacer/tasks.py b/spacer/tasks.py index 94ee2e3..9baee20 100644 --- a/spacer/tasks.py +++ b/spacer/tasks.py @@ -3,8 +3,7 @@ """ import time import traceback -from logging import getLogger - +from typing import Callable from spacer import config from spacer.data_classes import ImageFeatures from spacer.messages import \ @@ -28,8 +27,14 @@ def extract_features(msg: ExtractFeaturesMsg) -> ExtractFeaturesReturnMsg: check_extract_inputs(img, msg.rowcols, msg.image_loc.key) + check_rowcols(msg.rowcols, img) + if not isinstance(msg.extractor, Callable): + raise TypeError("msg.extractor must be callable") + with config.log_entry_and_exit('actual extraction'): features, return_msg = msg.extractor(img, msg.rowcols) + if not hasattr(features, 'store'): + raise TypeError("features object must have a store method") with config.log_entry_and_exit('storing features'): features.store(msg.feature_loc)