IndexError Traceback (most recent call last) Input In [20], in () 17 slice2_array = temp_img[mid_slice_index] 18 #slice3_array = temp_img[mid_slice_index+1] ---> 21 slice2_normalized = hist_match(slice2_array,patient) 23 #slice1_reshape = np.squeeze(slice1_array) 24 slice2_reshape = np.squeeze(slice2_normalized) Input In [18], in hist_match(data_path, patient) 8 #image_array = sitk.GetArrayFromImage(image) 9 background = get_background(image_array) ---> 10 normalized = hist_match_norm(image_array[24], background[24], modality=Modality.T1) 11 return(normalized) File ~\.conda\envs\py39\lib\site-packages\intensity_normalization\normalize\base.py:49, in NormalizeMixin.__call__(self, image, mask, modality, **kwargs) 40 def __call__( 41 self, 42 image: intnormt.ImageLike, (...) 47 **kwargs: typing.Any, 48 ) -> intnormt.ImageLike: ---> 49 return self.normalize_image(image, mask, modality=modality) File ~\.conda\envs\py39\lib\site-packages\intensity_normalization\normalize\nyul.py:73, in NyulNormalize.normalize_image(self, image, mask, modality) 64 def normalize_image( 65 self, 66 image: intnormt.ImageLike, (...) 70 modality: intnormt.Modality = intnormt.Modality.T1, 71 ) -> intnormt.ImageLike: 72 voi = self._get_voi(image, mask, modality=modality) ---> 73 landmarks = self.get_landmarks(voi) 74 if self.standard_scale is None: 75 msg = "This class must be fit before being called." File ~\.conda\envs\py39\lib\site-packages\intensity_normalization\normalize\nyul.py:95, in NyulNormalize.get_landmarks(self, image) 94 def get_landmarks(self, image: intnormt.ImageLike, /) -> npt.NDArray: ---> 95 landmarks = np.percentile(image, self.percentiles) 96 return landmarks File <__array_function__ internals>:180, in percentile(*args, **kwargs) File ~\.conda\envs\py39\lib\site-packages\numpy\lib\function_base.py:4166, in percentile(a, q, axis, out, overwrite_input, method, keepdims, interpolation) 4164 if not _quantile_is_valid(q): 4165 raise ValueError("Percentiles must be in the range [0, 100]") -> 4166 return _quantile_unchecked( 4167 a, q, axis, out, overwrite_input, method, keepdims) File ~\.conda\envs\py39\lib\site-packages\numpy\lib\function_base.py:4424, in _quantile_unchecked(a, q, axis, out, overwrite_input, method, keepdims) 4416 def _quantile_unchecked(a, 4417 q, 4418 axis=None, (...) 4421 method="linear", 4422 keepdims=False): 4423 """Assumes that q is in [0, 1], and is an ndarray""" -> 4424 r, k = _ureduce(a, 4425 func=_quantile_ureduce_func, 4426 q=q, 4427 axis=axis, 4428 out=out, 4429 overwrite_input=overwrite_input, 4430 method=method) 4431 if keepdims: 4432 return r.reshape(q.shape + k) File ~\.conda\envs\py39\lib\site-packages\numpy\lib\function_base.py:3725, in _ureduce(a, func, **kwargs) 3722 else: 3723 keepdim = (1,) * a.ndim -> 3725 r = func(a, **kwargs) 3726 return r, keepdim File ~\.conda\envs\py39\lib\site-packages\numpy\lib\function_base.py:4593, in _quantile_ureduce_func(a, q, axis, out, overwrite_input, method) 4591 else: 4592 arr = a.copy() -> 4593 result = _quantile(arr, 4594 quantiles=q, 4595 axis=axis, 4596 method=method, 4597 out=out) 4598 return result File ~\.conda\envs\py39\lib\site-packages\numpy\lib\function_base.py:4704, in _quantile(arr, quantiles, axis, method, out) 4702 slices_having_nans = None 4703 # --- Get values from indexes -> 4704 previous = np.take(arr, previous_indexes, axis=DATA_AXIS) 4705 next = np.take(arr, next_indexes, axis=DATA_AXIS) 4706 # --- Linear interpolation File <__array_function__ internals>:180, in take(*args, **kwargs) File ~\.conda\envs\py39\lib\site-packages\numpy\core\fromnumeric.py:190, in take(a, indices, axis, out, mode) 93 @array_function_dispatch(_take_dispatcher) 94 def take(a, indices, axis=None, out=None, mode='raise'): 95 """ 96 Take elements from an array along an axis. 97 (...) 188 [5, 7]]) 189 """ --> 190 return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode) File ~\.conda\envs\py39\lib\site-packages\numpy\core\fromnumeric.py:57, in _wrapfunc(obj, method, *args, **kwds) 54 return _wrapit(obj, method, *args, **kwds) 56 try: ---> 57 return bound(*args, **kwds) 58 except TypeError: 59 # A TypeError occurs if the object does have such a method in its 60 # class, but its signature is not identical to that of NumPy's. This (...) 64 # Call _wrapit from within the except clause to ensure a potential 65 # exception has a traceback chain. 66 return _wrapit(obj, method, *args, **kwds) IndexError: cannot do a non-empty take from an empty axes.