diff --git a/emerald/__init__.py b/emerald/__init__.py index ea5e3f7..a1acbc9 100644 --- a/emerald/__init__.py +++ b/emerald/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.2.1' +__version__ = '0.2.2' DISPLAY_TITLE = r""" _ _ _ diff --git a/emerald/emerald.py b/emerald/emerald.py index 93ccefd..c183fa7 100644 --- a/emerald/emerald.py +++ b/emerald/emerald.py @@ -1,5 +1,6 @@ from pathlib import Path from typing import Optional, List, Tuple +import logging import cv2 import numpy as np @@ -10,6 +11,8 @@ from emerald.model import Unet +logger = logging.getLogger(__name__) + def getImageData(fname): @@ -119,6 +122,11 @@ def emerald(model: Unet, input_path: str, mask_path: Optional[Path], brain_paths # jennings to sofia: why np.float32 instead of uint8? res = __resizeData(res.astype(np.float32), target = original_shape) + # some type duct tape + if str(res.dtype) == 'bool': + logger.warning(f'Brain not found in {input_path}') + res = res.astype(np.float32) + #remove extra dimension res = np.squeeze(res)