Announcement: scikit-image 0.19.0
We're happy to announce scikit-image v0.19.0!
scikit-image is an image processing toolbox for SciPy that includes algorithms for segmentation, geometric transformations, color space manipulation, analysis, filtering, morphology, feature detection, and more.
For more information, examples, and documentation, please visit our website: https://scikit-image.org
A highlight of this release is the addition of the popular scale-invariant feature transform (SIFT) feature detector and descriptor. This release also
introduces a perceptual blur metric, new pixel graph algorithms, and most functions now operate in single-precision when single-precision inputs are provided. Many other bug fixes, enhancements and performance improvements are detailed below.
A significant change in this release is in the treatment of multichannel images. The existing multichannel argument to functions has been deprecated in favor of a new channel_axis argument. channel_axis can be used to specify which axis of an array contains channel information (with channel_axis=None indicating a grayscale image).
scikit-image now uses "lazy loading", which enables users to access the functions from all skimage submodules without the overhead of eagerly importing all submodules. As a concrete example, after calling "import skimage" a user can directly call a function such as skimage.transform.warp whereas previously it would have been required to first "import skimage.transform".
An exciting change on the development side is the introduction of support for Pythran as an alternative to Cython for generating compiled code. We plan to keep Cython support as well going forward, so developers are free to use either one as appropriate. For those curious about Pythran, a good overview was given in the SciPy 2021 presentation, "Building SciPy Kernels with Pythran" (https://www.youtube.com/watch?v=6a9D9WL6ZjQ).
This release now supports 3.7-3.10. Apple M1 architecture (arm64) support is new to this release. MacOS 12 wheels are provided for Python 3.8-3.10.
New Features
- Added support for processing images with channels located along any array axis. This is in contrast to previous releases where channels were required to be the last axis of an image. See more info on the new
channel_axisargument under the API section of the release notes. - A no-reference measure of perceptual blur was added (
skimage.measure.blur_effect). - Non-local means (
skimage.restoration.denoise_nl_means) now supports 3D multichannel, 4D and 4D multichannel data whenfast_mode=True. - An n-dimensional Fourier-domain Butterworth filter (
skimage.filters.butterworth) was added. - Color conversion functions now have a new
channel_axiskeyword argument that allows specification of which axis of an array corresponds to channels. For backwards compatibility, this parameter defaults tochannel_axis=-1, indicating that channels are along the last axis. - Added a new keyword only parameter
random_statetomorphology.medial_axisandrestoration.unsupervised_wiener. - Seeding random number generators will not give the same results as the underlying generator was updated to use
numpy.random.Generator. - Added
saturationparameter toskimage.color.label2rgb - Added normalized mutual information metric
skimage.metrics.normalized_mutual_information - threshold_local now supports n-dimensional inputs and anisotropic block_size
- New
skimage.util.label_pointsfunction for assigning labels to points. - Added nD support to several geometric transform classes
- Added
skimage.metrics.hausdorff_pairto find points separated by the Hausdorff distance. - Additional colorspace
illuminantsandobserversparameter options were added toskimage.color.lab2rgb,skimage.color.rgb2lab,
skimage.color.xyz2lab,skimage.color.lab2xyz,skimage.color.xyz2luvandskimage.color.luv2xyz. skimage.filters.threshold_multiotsuhas a newhistkeyword argument to allow use with a user-supplied histogram. (gh-5543)skimage.restoration.denoise_bilateraladded support for images containing negative values. (gh-5527)- The
skimage.featurefunctionsblob_dog,blob_dohandblob_lognow support athreshold_relkeyword argument that can be used to specify a relative threshold (in range [0, 1]) rather than an absolute one. (gh-5517) - Implement lazy submodule importing (gh-5101)
- Implement weighted estimation of geometric transform matrices (gh-5601)
- Added new pixel graph algorithms in
skimage.graph:pixel_graphgenerates a graph (network) of pixels according to their adjacency, andcentral_pixelfinds the geodesic center of the pixels. (gh-5602) - scikit-image now supports use of Pythran in contributed code. (gh-3226)
Improvements
- Many more functions throughout the library now have single precision (float32) support.
- Biharmonic inpainting (
skimage.restoration.inpaint_biharmonic) was refactored and is orders of magnitude faster than before. - Salt-and-pepper noise generation with
skimage.util.random_noiseis now faster. - The performance of the SLIC superpixels algorithm (
skimage.segmentation.slice) was improved for the case where a mask is supplied by the user (gh-4903). The specific superpixels produced by masked SLIC will not be identical to those produced by prior releases. exposure.adjust_gammahas been accelerated foruint8images thanks to a LUT (gh-4966).measure.labelhas been accelerated for boolean input images, by usingscipy.ndimage's implementation for this case (gh-4945).util.apply_parallelnow works with multichannel data (gh-4927).skimage.feature.peak_local_maxsupports now any Minkowski distance.- Fast, non-Cython implementation for
skimage.filters.correlate_sparse. - For efficiency, the histogram is now precomputed within
skimage.filters.try_all_threshold. - Faster
skimage.filters.find_local_maxwhen given a finitenum_peaks. - All filters in the
skimage.filters.rankmodule now release the GIL, enabling multithreaded use. skimage.restoration.denoise_tv_bregmanand
skimage.restoration.denoise_bilateralnow release the GIL, enabling multithreaded use.- A
skimage.color.label2rgbperformance regression was addressed. - Improve numerical precision in
CircleModel.estimate. (gh-5190) - Add default keyword argument values to
skimage.restoration.denoise_tv_bregman,skimage.measure.block_reduce, andskimage.filters.threshold_local. (gh-5454) - Make matplotlib an optional dependency (gh-5990)
- single precision support in skimage.filters (gh-5354)
- Support nD images and labels in label2rgb (gh-5550)
- Regionprops table performance refactor (gh-5576)
- add regionprops benchmark script (gh-5579)
- remove use of apply_along_axes from greycomatrix & greycoprops (gh-5580)
- refactor gabor_kernel for efficiency (gh-5582)
- remove need for channel_as_last_axis decorator in skimage.filters (gh-5584)
- replace use of scipy.ndimage.gaussian_filter with skimage.filters.gaussian (gh-5872)
- add channel_axis argument to quickshift (gh-5987)
- add MacOS arm64 wheels (gh-6068)
API Changes
- The
multichannelboolean argument has been deprecated. All functions with multichannel support now use an integerchannel_axisto specify which axis corresponds to channels. Settingchannel_axisto None is used to indicate that the image is grayscale. Specifically, existing code withmultichannel=Trueshould be updated to usechannel_axis=-1and code withmultichannel=Falseshould now specifychannel_axis=None. - Most functions now return float32 images when the input has float32 dtype.
- A default value has been added to
measure.find_contours, corresponding to the half distance between the min and max values of the image (gh-4862). data.cathas been introduced as an alias ofdata.chelseafor a more descriptive name.- The
levelparameter ofmeasure.find_contoursis now a keyword argument, with a default value set to(max(image) - min(image)) / 2. p_normargument was added toskimage.feature.peak_local_maxto add support for Minkowski distances.skimage.transforms.integral_imagenow promotes floating point inputs to double precision by default (for accuracy). A newdtypekeyword argument can be used to override this behavior when desired.- Color conversion functions now have a new
channel_axiskeyword argument (see New Features section). - SLIC superpixel segmentation outputs may differ from previous versions for data that was not already scaled to [0, 1] range. There is now an automatic internal rescaling of the input to [0, 1] so that the
compactnessparameter has an effect that is independent of the input image's scaling. - A bug fix to the phase normalization applied within
skimage.register.phase_cross_correlationmay result in a different result as compared to prior releases. The prior behavior of "unnormalized" cross correlation is still available by explicitly settingnormalization=None. There is no change to the masked cross-correlation case, which uses a different algorithm.
Bugfixes
- Input
labelsargument renumbering inskimage.feature.peak_local_maxis avoided (gh-5047). - fix clip bug in resize when anti_aliasing is applied (gh-5202)
- Nonzero values at the image edge are no longer incorrectly marked as a boundary when using
find_bounarieswith mode='subpixel' (gh-5447). - Fix return dtype of
_label2rgb_avgfunction. - Ensure
skimage.color.separate_stainsdoes not return negative values. - Prevent integer overflow in
EllipseModel. - Fixed off-by one error in pixel bins in Hough line transform,
skimage.transform.hough_line. - Handle 1D arrays properly in
skimage.filters.gaussian. - Fix Laplacian matrix size bug in
skimage.segmentation.random_walker. - Regionprops table (
skimage.measure.regionprops_table) dtype bugfix. - Fix
skimage.transform.rescalewhen using a small scale factor. - Fix
skimage.measure.labelsegfault. - Watershed (
skimage.segmentation.watershed): consider connectivity when calculating markers. - Fix
skimage.transform.warpoutput dtype when order=0. - Fix multichannel
intensity_imageextra_properties in regionprops. - Fix error message for
skimage.metric.structural_similaritywhen image is too small. - Do not mark image edges in 'subpixel' mode of
skimage.segmentation.find_boundaries. - Fix behavior of
skimage.exposure.is_low_contrastfor boolean inputs. - Fix wrong syntax for the string argument of ValueError in
skimage.metric.structural_similarity. - Fixed NaN issue in
skimage.filters.threshold_otsu. - Fix
skimage.feature.blob_dogdocstring example and normalization. - Fix uint8 overflow in
skimage.exposure.adjust_gamma. - Work with pooch 1.5.0 for fetching data (gh-5529).
- The
offsetsattribute ofskimage.graph.MCPis now public. (gh-5547) - Fix io.imread behavior with pathlib.Path inputs (gh-5543)
- Make scikit-image imports from Pooch, compatible with pooch >= 1.5.0 (gh-5529)
- Fix several broken doctests and restore doctesting on GitHub Actions (gh-5505)
- Fix broken doctests in
skimage.exposure.histogramandskimage.measure.regionprops_table. (gh-5522) - Rescale image consistently during SLIC superpixel segmentation. (gh-5518)
- Correct phase correlation in
skimage.register.phase_cross_correlation. (gh-5461) - Fix hidden attribute 'offsets' in skimage.graph.MCP (gh-5551)
- fix phase_cross_correlation for 3D with reference masks (gh-5559)
- fix return shape of blob_log and blob_dog when no peaks are found (gh-5567)
- Fix find contours key error (gh-5577)
- Refactor measure.ransac and add warning when the estimated model is not valid (gh-5583)
- Restore integer image rescaling for edge filters (gh-5589)
- trainable_segmentation: re-raise in error case (gh-5600)
- allow regionprops_table to be called with deprecated property names (gh-5908)
- Fix weight calculation in fast mode of non-local means (gh-5923)
- fix for #5948: lower boundary 1 for kernel_size in equalize_adapthist (gh-5949)
- convert pathlib.Path to str in imsave (gh-5971)
- Fix slic spacing (gh-5974)
- Add small regularization to avoid zero-division in richardson_lucy (gh-5976)
- Fix benchmark suite (watershed function was moved) (gh-5982)
- catch QhullError and return empty array (
convex_hull) (gh-6008) - add property getters for all newly deprecated regionprops names (gh-6000)
- Fix the estimation of ellipsoid axis lengths in the 3D case (gh-6013)
- Fix peak local max segfault (gh-6035)
- Avoid circular import errors when EAGER_IMPORT=1 (gh-6042)
- remove all use of the deprecated distutils package (gh-6044)
- Backport PR #6061 on branch v0.19.x (remove use of deprecated np.int in SIFT) (gh-6062)
- Backport PR #6060 on branch v0.19.x (Fix test failures observed with numpy 1.22rc0) (gh-6063)
Completed Deprecations from Prior Releases
- In
measure.label, the deprecatedneighborsparameter has been removed (useconnectivityinstead). - The deprecated
skimage.color.rgb2greyandskimage.color.grey2rgbfunctions have been removed (useskimage.color.rgb2grayand
skimage.color.gray2rgbinstead). skimage.color.rgb2grayno longer allows grayscale or RGBA inputs.- The deprecated
alphaparameter ofskimage.color.gray2rgbhas now been removed. Useskimage.color.gray2rgbafor conversion to RGBA. - Attempting to warp a boolean image with
order > 0now raises a ValueError. - When warping or rescaling boolean images, setting
anti-aliasing=Truewill raise a ValueError. - The
bg_labelparameter ofskimage.color.label2rgbis now 0. - The deprecated
filterparameter ofskimage.transform.iradonhas now been removed (usefilter_nameinstead). - The deprecated
skimage.draw.circlefunction has been removed (useskimage.draw.diskinstead). - The deprecated
skimage.feature.register_translationfunction has been removed (useskimage.registration.phase_cross_correlationinstead). - The deprecated
skimage.feature.masked_register_translationfunction has been removed (useskimage.registration.phase_cross_correlationinstead). - The deprecated
skimage.measure.marching_cubes_classicfunction has been removed (useskimage.measure.marching_cubesinstead). - The deprecated
skimage.measure.marching_cubes_lewinerfunction has been removed (useskimage.measure.marching_cubesinstead). - The deprecated
skimage.segmentation.circle_level_setfunction has been removed (useskimage.segmentation.disk_level_setinstead). - The deprecated
inplaceparameter ofskimage.morphology.flood_fillhas been removed (usein_placeinstead). - The deprecated
skimage.util.padfunction has been removed (usenumpy.padinstead). - The default
modeinskimage.filters.hessianis now'reflect'. - The default boundary
modeinskimage.filters.satois now'reflect'. - The default boundary
modeinskimage.measure.profile_lineis now'reflect'. - The default value of
preserve_rangeinskimage.restoration.denoise_nl_meansis now False. - The default value of
start_labelinskimage.segmentation.slicis now 1.
Newly introduced deprecations:
-
The
multichannelargument is now deprecated throughout the library and will be removed in 1.0. The newchannel_axisargument should be used instead. Existing code withmultichannel=Trueshould be updated to usechannel_axis=-1and code withmultichannel=Falseshould now specifychannel_axis=None. -
skimage.feature.greycomatrixandskimage.feature.greycopropsare deprecated in favor ofskimage.feature.graycomatrixand
skimage.feature.graycoprops. -
The
skimage.morphology.greymodule has been renamedskimage.morphology.gray. The old name is deprecated. -
The
skimage.morphology.greyreconstructmodule has been renamedskimage.morphology.grayreconstruct. The old name is deprecated. -
see API Changes section regarding functions with deprecated argument names related to the number of iterations.
num_iterationsand
max_num_iterare now used throughout the library. -
see API Changes section on deprecation of the
selemargument in favor offootprintthroughout the library -
Deprecate
in_placein favor of the use of an explicitoutargument inskimage.morphology.remove_small_objects,
skimage.morphology.remove_small_holesandskimage.segmentation.clear_border -
The
inputargument ofskimage.measure.labelhas been renamedlabel_image. The old name is deprecated. -
standardize on
num_iterfor paramters describing the number of iterations andmax_num_iterfor parameters specifying an iteration limit. Functions where the old argument names have now been deprecated are::Function Name skimage.filters.threshold_minimum skimage.morphology.thin skimage.restoration.denoise_tv_bregman skimage.restoration.richardson_lucy skimage.segmentation.active_contour skimage.segmentation.chan_vese skimage.segmentation.morphological_chan_vese skimage.segmentation.morphological_geodesic_active_contour skimage.segmentation.slic -
The names of several parameters in
skimage.measure.regionprops
have been updated so that properties are better grouped by the first
word(s) of the name. The old names will continue to work for
backwards compatibility. The specific names that were updated are:Old Name New Name max_intensity intensity_max mean_intensity intensity_mean min_intensity intensity_min bbox_area area_bbox convex_area area_convex filled_area area_filled convex_image image_convex filled_image image_filled intensity_image image_intensity local_centroid centroid_local weighted_centroid centroid_weighted weighted_local_centroid centroid_weighted_local major_axis_length axis_major_length minor_axis_length axis_minor_length weighted_moments moments_weighted weighted_moments_central moments_weighted_central weighted_moments_hu moments_weighted_hu weighted_moments_normalized moments_weighted_normalized equivalent_diameter equivalent_diameter_area -
The
selemargument has been renamed tofootprintthroughout the library. Theselemargument is now deprecated.
Additional details at: https://raw.githubusercontent.com/scikit-image/scikit-image/v0.19.0/doc/release/release_0.19.rst