diff --git a/navipy/database/__init__.py b/navipy/database/__init__.py index 5f4141a2ce639dd3ec863134086d81775f5b2e0b..25809118fe1984ddae27b288ad5cfbdbeffb221f 100644 --- a/navipy/database/__init__.py +++ b/navipy/database/__init__.py @@ -376,7 +376,7 @@ database if rowid is np.nan: raise ValueError('rowid must not be nan') if (posorient is None) and (rowid is None): - Exception('posorient and rowid can not be both None') + raise Exception('posorient and rowid can not be both None') if posorient is not None: rowid = self.get_posid(posorient) # Read images @@ -466,6 +466,8 @@ database return toreturn def denormalise_image(self, image, cmaxminrange): + if not isinstance(image,np.ndarray): + raise TypeError('image must be np.array') if len(image.shape) != 3: raise Exception('image should be 3D array') if image.shape[2] != len(self.channels): @@ -473,7 +475,7 @@ database number of channels {}'.format( len(self.channels))) if not isinstance(cmaxminrange, pd.Series): - raise Exception('cmaxminrange should be a pandas Series') + raise TypeError('cmaxminrange should be a pandas Series') if cmaxminrange.empty: raise Exception('cmaxminrange must not be empty') for chan_n in self.channels: