2D Demo fails with scipy V1.7
Thanks for a great package! Small note, I tried running the demo code to get all 2D feautres form the RGB image with `scipy` v1.7.3 but it fails: **Code** ``` from skimage import io, morphology, draw import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt img2 = io.imread('./weee1.png')/255. # transform to grayscale img_gray2 = np.max(img2, axis=2) # segment with thresholding threshold = 0.1 # you may adjust here depending on the actual image bw_org2 = img_gray2 > threshold min_size = 300 # you may adjust here depending on the actual image bw_smallobjects_removed = morphology.remove_small_objects(bw_org2, min_size=min_size) area_threshold = 300 # you may adjust here depending on the actual image bw_smallholes_filled = morphology.remove_small_holes(bw_smallobjects_removed, area_threshold=area_threshold) bw2 = bw_smallholes_filled spatial_resolution_xy=0.2860548271752086 df = imea.shape_measurements_2d(bw2, spatial_resolution_xy) ``` **Error**: ``` --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Input In [17], in <cell line: 24>() 21 bw2 = bw_smallholes_filled 23 spatial_resolution_xy=0.2860548271752086 ---> 24 df = imea.shape_measurements_2d(bw2, spatial_resolution_xy) File ~/anaconda3/lib/python3.9/site-packages/imea/extract.py:155, in shape_measurements_2d(bw, spatial_resolution_xy, dalpha, return_statistical_lengths, return_all_chords) 151 bw_single = np.zeros_like(bw) 152 bw_single[labels == i] = True 154 shape_measurements_i, statistical_lengths_i, \ --> 155 all_chords_i = _shape_measurements_2d_single_object(bw_single, 156 spatial_resolution_xy, 157 dalpha) 159 df_2d.append(shape_measurements_i) 160 statistical_lengths.append(statistical_lengths_i) File ~/anaconda3/lib/python3.9/site-packages/imea/extract.py:305, in _shape_measurements_2d_single_object(bw, spatial_resolution_xy, dalpha) 299 # Statistical lengths 300 feret_diameters, martin_diameters, nassenstein_diameters, maxchords, allchords,\ 301 measured_angles = measure_2d.statistical_length.compute_statistical_lengths( 302 bw_cropped, daplha=dalpha) 304 feret_max, feret_min, feret_median, feret_mean, \ --> 305 feret_mode, feret_std = measure_2d.statistical_length.distribution_parameters( 306 feret_diameters) 308 martin_max, martin_min, martin_median, martin_mean, \ 309 martin_mode, martin_std = measure_2d.statistical_length.distribution_parameters( 310 martin_diameters) 312 nassenstein_max, nassenstein_min, nassenstein_median, nassenstein_mean, \ 313 nassenstein_mode, nassenstein_std = measure_2d.statistical_length.distribution_parameters( 314 nassenstein_diameters) File ~/anaconda3/lib/python3.9/site-packages/imea/measure_2d/statistical_length.py:465, in distribution_parameters(distribution) 463 median_value = np.median(distribution) 464 mean_value = np.mean(distribution) --> 465 mode, _ = stats.mode(distribution, axis=None, keepdims=False) 466 std = np.std(distribution) 468 return max_value, min_value, median_value, mean_value, mode, std TypeError: mode() got an unexpected keyword argument 'keepdims' ``` It works with `scipy` v1.10.1 so it might be worth adding this as a requirement. Alan.
issue