diff --git a/README.md b/README.md index 3c13413..44b425c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -[![Build Status](https://github.com/clEsperanto/clesperantoj_prototype/actions/workflows/build.yml/badge.svg)](https://github.com/clEsperanto/clesperantoj_prototype/actions/workflows/build.yml) - - +[![Build Status](https://github.com/clEsperanto/clesperantoj_prototype/actions/workflows/build.yaml/badge.svg)](https://github.com/clEsperanto/clesperantoj_prototype/actions/workflows/build.yaml) +[![GitHub stars](https://img.shields.io/github/stars/clEsperanto/clesperantoj_prototype?style=social)](https://github.com/clEsperanto/clesperantoj_prototype) +[![GitHub forks](https://img.shields.io/github/forks/clEsperanto/clesperantoj_prototype?style=social)](https://github.com/clEsperanto/clesperantoj_prototype) +[![Image.sc Forum](https://img.shields.io/badge/dynamic/json.svg?label=forum&url=https%3A%2F%2Fforum.image.sc%2Ftags%2Fclesperanto.json&query=%24.topic_list.tags.0.topic_count&colorB=green&&suffix=%20topics&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABPklEQVR42m3SyyqFURTA8Y2BER0TDyExZ+aSPIKUlPIITFzKeQWXwhBlQrmFgUzMMFLKZeguBu5y+//17dP3nc5vuPdee6299gohUYYaDGOyyACq4JmQVoFujOMR77hNfOAGM+hBOQqB9TjHD36xhAa04RCuuXeKOvwHVWIKL9jCK2bRiV284QgL8MwEjAneeo9VNOEaBhzALGtoRy02cIcWhE34jj5YxgW+E5Z4iTPkMYpPLCNY3hdOYEfNbKYdmNngZ1jyEzw7h7AIb3fRTQ95OAZ6yQpGYHMMtOTgouktYwxuXsHgWLLl+4x++Kx1FJrjLTagA77bTPvYgw1rRqY56e+w7GNYsqX6JfPwi7aR+Y5SA+BXtKIRfkfJAYgj14tpOF6+I46c4/cAM3UhM3JxyKsxiOIhH0IO6SH/A1Kb1WBeUjbkAAAAAElFTkSuQmCC)](https://forum.image.sc/tag/clesperanto) # clEsperantoJ -clEsperantoJ is the Java package of [clEsperanto] - a multi-language framework for GPU-accelerated image processing. It relies on a familly of [OpenCL kernels] originated from [CLIJ]. This package is developped in Java and C++ wrapped using JavaCPP, and uses the C++ [CLIc] library as a processing backend. +clEsperantoJ is the Java library of [clEsperanto] - a multi-language framework for GPU-accelerated image processing. +It relies on a familly of [OpenCL kernels] originated from [CLIJ], and rely on the C++ [CLIc] library as a processing backend. ## How to Build from source diff --git a/native/clesperantoj/include/kernelj.hpp b/native/clesperantoj/include/kernelj.hpp index 2cccec7..acc37ed 100644 --- a/native/clesperantoj/include/kernelj.hpp +++ b/native/clesperantoj/include/kernelj.hpp @@ -12,7 +12,7 @@ class Tier1 { public: static ArrayJ absolute(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ add_images_weighted(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, float factor0, float factor1); + static ArrayJ add_images_weighted(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, float factor1, float factor2); static ArrayJ add_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); static ArrayJ binary_and(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ binary_edge_detection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); @@ -25,26 +25,28 @@ class Tier1 static ArrayJ block_enumerate(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, int blocksize); static ArrayJ convolve(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ copy(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ copy_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice); - static ArrayJ copy_horizontal_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice); - static ArrayJ copy_vertical_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice); + static ArrayJ copy_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index); + static ArrayJ copy_horizontal_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index); + static ArrayJ copy_vertical_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index); static ArrayJ crop(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int start_x, int start_y, int start_z, int width, int height, int depth); static ArrayJ cubic_root(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ detect_label_edges(DeviceJ * device, ArrayJ * src, ArrayJ * dst); + static ArrayJ dilation(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst); static ArrayJ dilate_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ dilate_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string connectivity); - static ArrayJ divide_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); + static ArrayJ binary_dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ divide_images(DeviceJ * device, ArrayJ * dividend, ArrayJ * divisor, ArrayJ * dst); static ArrayJ divide_scalar_by_image(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); static ArrayJ equal(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ equal_constant(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); + static ArrayJ erosion(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst); static ArrayJ erode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ erode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string connectivity); + static ArrayJ binary_erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ exponential(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ flip(DeviceJ * device, ArrayJ * src, ArrayJ * dst, bool flip_x, bool flip_y, bool flip_z); static ArrayJ gaussian_blur(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float sigma_x, float sigma_y, float sigma_z); - static ArrayJ generate_distance_matrix(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); + static ArrayJ generate_distance_matrix(DeviceJ * device, ArrayJ * coordinate_list1, ArrayJ * coordinate_list2, ArrayJ * distance_matrix_destination); static ArrayJ gradient_x(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ gradient_y(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ gradient_z(DeviceJ * device, ArrayJ * src, ArrayJ * dst); @@ -56,36 +58,38 @@ class Tier1 static ArrayJ laplace_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ laplace_diamond(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ laplace(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string connectivity); - static ArrayJ local_cross_correlation(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); + static ArrayJ local_cross_correlation(DeviceJ * device, ArrayJ * src, ArrayJ * kernel, ArrayJ * dst); static ArrayJ logarithm(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ mask(DeviceJ * device, ArrayJ * src, ArrayJ * mask, ArrayJ * dst); static ArrayJ mask_label(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, float label); static ArrayJ maximum_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); static ArrayJ maximum_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); - static ArrayJ maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ maximum(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ maximum_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ grayscale_dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ maximum_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ maximum_y_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ maximum_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ mean_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ mean_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ mean(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ mean_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ mean_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ mean_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ mean_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ mean_y_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ mean_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ median_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ median_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ median(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); - static ArrayJ minimum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ minimum(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ median_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ median_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ median(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ minimum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ minimum_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ grayscale_erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ minimum_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); static ArrayJ minimum_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ minimum_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ minimum_y_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ minimum_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ mode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ mode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ mode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ mode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ mode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ mode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ modulo_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ multiply_image_and_position(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int dimension); static ArrayJ multiply_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); @@ -99,30 +103,30 @@ class Tier1 static ArrayJ nonzero_minimum(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1, std::string connectivity); static ArrayJ not_equal(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ not_equal_constant(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); - static ArrayJ paste(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int index_x, int index_y, int index_z); - static ArrayJ onlyzero_overwrite_maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1); - static ArrayJ onlyzero_overwrite_maximum_diamond(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1); - static ArrayJ onlyzero_overwrite_maximum(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1, std::string connectivity); + static ArrayJ paste(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int destination_x, int destination_y, int destination_z); + static ArrayJ onlyzero_overwrite_maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst); + static ArrayJ onlyzero_overwrite_maximum_diamond(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst); + static ArrayJ onlyzero_overwrite_maximum(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst, std::string connectivity); static ArrayJ power(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar); static ArrayJ power_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ range(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int start_x, int stop_x, int step_x, int start_y, int stop_y, int step_y, int start_z, int stop_z, int step_z); static ArrayJ read_values_from_positions(DeviceJ * device, ArrayJ * src, ArrayJ * list, ArrayJ * dst); static ArrayJ replace_values(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); - static ArrayJ replace_value(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar0, float scalar1); - static ArrayJ replace_intensity(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar0, float scalar1); + static ArrayJ replace_value(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float value_to_replace, float value_replacement); + static ArrayJ replace_intensity(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float value_to_replace, float value_replacement); static ArrayJ replace_intensities(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ maximum_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ minimum_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); - static ArrayJ multiply_matrix(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); + static ArrayJ multiply_matrix(DeviceJ * device, ArrayJ * matrix1, ArrayJ * matrix2, ArrayJ * matrix_destination); static ArrayJ reciprocal(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ set(DeviceJ * device, ArrayJ * src, float scalar); - static ArrayJ set_column(DeviceJ * device, ArrayJ * src, int column, float value); + static ArrayJ set_column(DeviceJ * device, ArrayJ * src, int column_index, float value); static ArrayJ set_image_borders(DeviceJ * device, ArrayJ * src, float value); - static ArrayJ set_plane(DeviceJ * device, ArrayJ * src, int plane, float value); + static ArrayJ set_plane(DeviceJ * device, ArrayJ * src, int plane_index, float value); static ArrayJ set_ramp_x(DeviceJ * device, ArrayJ * src); static ArrayJ set_ramp_y(DeviceJ * device, ArrayJ * src); static ArrayJ set_ramp_z(DeviceJ * device, ArrayJ * src); - static ArrayJ set_row(DeviceJ * device, ArrayJ * src, int row, float value); + static ArrayJ set_row(DeviceJ * device, ArrayJ * src, int row_index, float value); static ArrayJ set_nonzero_pixels_to_pixelindex(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int offset); static ArrayJ set_where_x_equals_y(DeviceJ * device, ArrayJ * src, float value); static ArrayJ set_where_x_greater_than_y(DeviceJ * device, ArrayJ * src, float value); @@ -144,9 +148,9 @@ class Tier1 static ArrayJ transpose_xz(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ transpose_yz(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ undefined_to_zero(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ variance_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ variance_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ variance(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ variance_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ variance_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ variance_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ write_values_to_positions(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ x_position_of_maximum_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ x_position_of_minimum_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst); @@ -162,24 +166,26 @@ class Tier2 public: static ArrayJ absolute_difference(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ add_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); - static ArrayJ bottom_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); + static ArrayJ bottom_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ bottom_hat_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ bottom_hat(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ clip(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float min_intensity, float max_intensity); static ArrayJ closing_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ closing_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ closing_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ grayscale_closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ closing(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst); + static ArrayJ binary_closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ concatenate_along_x(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ concatenate_along_y(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ concatenate_along_z(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); - static ArrayJ count_touching_neighbors(DeviceJ * device, ArrayJ * src, ArrayJ * dst, bool ignore_background); + static ArrayJ count_touching_neighbors(DeviceJ * device, ArrayJ * touch_matrix, ArrayJ * touching_neighbors_count_destination, bool ignore_background); static ArrayJ crop_border(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int border_size); static ArrayJ divide_by_gaussian_background(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float sigma_x, float sigma_y, float sigma_z); static ArrayJ degrees_to_radians(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ detect_maxima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ detect_maxima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); - static ArrayJ detect_minima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ detect_minima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ detect_maxima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ detect_maxima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ detect_minima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ detect_minima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ difference_of_gaussian(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float sigma1_x, float sigma1_y, float sigma1_z, float sigma2_x, float sigma2_y, float sigma2_z); static ArrayJ extend_labeling_via_voronoi(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ invert(DeviceJ * device, ArrayJ * src, ArrayJ * dst); @@ -188,23 +194,25 @@ class Tier2 static float maximum_of_all_pixels(DeviceJ * device, ArrayJ * src); static float minimum_of_all_pixels(DeviceJ * device, ArrayJ * src); static float minimum_of_masked_pixels(DeviceJ * device, ArrayJ * src, ArrayJ * mask); - static ArrayJ opening_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); + static ArrayJ opening_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ opening_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); - static ArrayJ opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ grayscale_opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); + static ArrayJ opening(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst); + static ArrayJ binary_opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ radians_to_degrees(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ reduce_labels_to_label_edges(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ small_hessian_eigenvalue(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ square(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ squared_difference(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); - static ArrayJ standard_deviation_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ standard_deviation_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); - static ArrayJ standard_deviation(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity); + static ArrayJ standard_deviation_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ standard_deviation_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); + static ArrayJ standard_deviation(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); static ArrayJ subtract_gaussian_background(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float sigma_x, float sigma_y, float sigma_z); static ArrayJ subtract_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ sub_stack(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int start_z, int end_z); static ArrayJ reduce_stack(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int reduction_factor, int offset); static float sum_of_all_pixels(DeviceJ * device, ArrayJ * src); - static ArrayJ top_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z); + static ArrayJ top_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ top_hat_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z); static ArrayJ top_hat(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity); }; @@ -223,15 +231,15 @@ class Tier3 static ArrayJ gamma_correction(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float gamma); static ArrayJ generate_binary_overlap_matrix(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst); static ArrayJ generate_touch_matrix(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ histogram(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int nbins, float min, float max); + static ArrayJ histogram(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int num_bins, float minimum_intensity, float maximum_intensity); static float jaccard_index(DeviceJ * device, ArrayJ * src0, ArrayJ * src1); - static ArrayJ labelled_spots_to_pointlist(DeviceJ * device, ArrayJ * src, ArrayJ * dst); + static ArrayJ labelled_spots_to_pointlist(DeviceJ * device, ArrayJ * label, ArrayJ * pointlist); static std::vector maximum_position(DeviceJ * device, ArrayJ * src); static float mean_of_all_pixels(DeviceJ * device, ArrayJ * src); static std::vector minimum_position(DeviceJ * device, ArrayJ * src); static ArrayJ morphological_chan_vese(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int num_iter, int smoothing, float lambda1, float lambda2); - static std::unordered_map> statistics_of_labelled_pixels(DeviceJ * device, ArrayJ * label, ArrayJ * intensity); - static std::unordered_map> statistics_of_background_and_labelled_pixels(DeviceJ * device, ArrayJ * label, ArrayJ * intensity); + static std::unordered_map> statistics_of_labelled_pixels(DeviceJ * device, ArrayJ * intensity, ArrayJ * label); + static std::unordered_map> statistics_of_background_and_labelled_pixels(DeviceJ * device, ArrayJ * intensity, ArrayJ * label); }; @@ -243,13 +251,14 @@ class Tier4 static ArrayJ spots_to_pointlist(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ relabel_sequential(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int blocksize); static ArrayJ threshold_otsu(DeviceJ * device, ArrayJ * src, ArrayJ * dst); + static ArrayJ mean_intensity_map(DeviceJ * device, ArrayJ * src, ArrayJ * labels, ArrayJ * dst); static ArrayJ pixel_count_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst); static ArrayJ label_pixel_count_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst); - static ArrayJ centroids_of_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, bool withBG); + static ArrayJ centroids_of_labels(DeviceJ * device, ArrayJ * label_image, ArrayJ * centroids_coordinates, bool include_background); static ArrayJ remove_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value, float max_value); static ArrayJ remove_labels_with_map_values_within_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value, float max_value); - static ArrayJ exclude_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value_range, float max_value_range); - static ArrayJ exclude_labels_with_map_values_within_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value_range, float max_value_range); + static ArrayJ exclude_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * values_map, ArrayJ * label_map_input, ArrayJ * dst, float minimum_value_range, float maximum_value_range); + static ArrayJ exclude_labels_with_map_values_within_range(DeviceJ * device, ArrayJ * values_map, ArrayJ * label_map_input, ArrayJ * dst, float minimum_value_range, float maximum_value_range); static ArrayJ extension_ratio_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst); }; @@ -274,7 +283,7 @@ class Tier6 static ArrayJ erode_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius, bool relabel); static ArrayJ gauss_otsu_labeling(DeviceJ * device, ArrayJ * src0, ArrayJ * dst, float outline_sigma); static ArrayJ masked_voronoi_labeling(DeviceJ * device, ArrayJ * src, ArrayJ * mask, ArrayJ * dst); - static ArrayJ voronoi_labeling(DeviceJ * device, ArrayJ * src, ArrayJ * dst); + static ArrayJ voronoi_labeling(DeviceJ * device, ArrayJ * input_binary, ArrayJ * output_labels); static ArrayJ remove_small_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float minimum_size); static ArrayJ exclude_small_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float maximum_size); static ArrayJ remove_large_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float maximum_size); diff --git a/native/clesperantoj/src/tier1j.cpp b/native/clesperantoj/src/tier1j.cpp index 7df8b13..e54f016 100644 --- a/native/clesperantoj/src/tier1j.cpp +++ b/native/clesperantoj/src/tier1j.cpp @@ -10,9 +10,9 @@ ArrayJ Tier1::absolute(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::absolute_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::add_images_weighted(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, float factor0, float factor1) +ArrayJ Tier1::add_images_weighted(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst, float factor1, float factor2) { - return ArrayJ{cle::tier1::add_images_weighted_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get(), factor0, factor1)}; + return ArrayJ{cle::tier1::add_images_weighted_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get(), factor1, factor2)}; } ArrayJ Tier1::add_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar) @@ -75,19 +75,19 @@ ArrayJ Tier1::copy(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::copy_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::copy_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice) +ArrayJ Tier1::copy_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index) { - return ArrayJ{cle::tier1::copy_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice)}; + return ArrayJ{cle::tier1::copy_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice_index)}; } -ArrayJ Tier1::copy_horizontal_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice) +ArrayJ Tier1::copy_horizontal_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index) { - return ArrayJ{cle::tier1::copy_horizontal_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice)}; + return ArrayJ{cle::tier1::copy_horizontal_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice_index)}; } -ArrayJ Tier1::copy_vertical_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice) +ArrayJ Tier1::copy_vertical_slice(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int slice_index) { - return ArrayJ{cle::tier1::copy_vertical_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice)}; + return ArrayJ{cle::tier1::copy_vertical_slice_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), slice_index)}; } ArrayJ Tier1::crop(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int start_x, int start_y, int start_z, int width, int height, int depth) @@ -105,6 +105,11 @@ ArrayJ Tier1::detect_label_edges(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::detect_label_edges_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } +ArrayJ Tier1::dilation(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst) +{ + return ArrayJ{cle::tier1::dilation_func(device->get(), src->get(), footprint->get(), dst == nullptr ? nullptr : dst->get())}; +} + ArrayJ Tier1::dilate_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst) { return ArrayJ{cle::tier1::dilate_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; @@ -115,14 +120,14 @@ ArrayJ Tier1::dilate_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::dilate_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string connectivity) +ArrayJ Tier1::binary_dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::dilate_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), connectivity)}; + return ArrayJ{cle::tier1::binary_dilate_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } -ArrayJ Tier1::divide_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) +ArrayJ Tier1::divide_images(DeviceJ * device, ArrayJ * dividend, ArrayJ * divisor, ArrayJ * dst) { - return ArrayJ{cle::tier1::divide_images_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier1::divide_images_func(device->get(), dividend->get(), divisor->get(), dst == nullptr ? nullptr : dst->get())}; } ArrayJ Tier1::divide_scalar_by_image(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar) @@ -140,6 +145,11 @@ ArrayJ Tier1::equal_constant(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float return ArrayJ{cle::tier1::equal_constant_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), scalar)}; } +ArrayJ Tier1::erosion(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst) +{ + return ArrayJ{cle::tier1::erosion_func(device->get(), src->get(), footprint->get(), dst == nullptr ? nullptr : dst->get())}; +} + ArrayJ Tier1::erode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst) { return ArrayJ{cle::tier1::erode_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; @@ -150,9 +160,9 @@ ArrayJ Tier1::erode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::erode_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string connectivity) +ArrayJ Tier1::binary_erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::erode_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), connectivity)}; + return ArrayJ{cle::tier1::binary_erode_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier1::exponential(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -170,9 +180,9 @@ ArrayJ Tier1::gaussian_blur(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float return ArrayJ{cle::tier1::gaussian_blur_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), sigma_x, sigma_y, sigma_z)}; } -ArrayJ Tier1::generate_distance_matrix(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) +ArrayJ Tier1::generate_distance_matrix(DeviceJ * device, ArrayJ * coordinate_list1, ArrayJ * coordinate_list2, ArrayJ * distance_matrix_destination) { - return ArrayJ{cle::tier1::generate_distance_matrix_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier1::generate_distance_matrix_func(device->get(), coordinate_list1->get(), coordinate_list2->get(), distance_matrix_destination == nullptr ? nullptr : distance_matrix_destination->get())}; } ArrayJ Tier1::gradient_x(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -230,9 +240,9 @@ ArrayJ Tier1::laplace(DeviceJ * device, ArrayJ * src, ArrayJ * dst, std::string return ArrayJ{cle::tier1::laplace_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), connectivity)}; } -ArrayJ Tier1::local_cross_correlation(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) +ArrayJ Tier1::local_cross_correlation(DeviceJ * device, ArrayJ * src, ArrayJ * kernel, ArrayJ * dst) { - return ArrayJ{cle::tier1::local_cross_correlation_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier1::local_cross_correlation_func(device->get(), src->get(), kernel->get(), dst == nullptr ? nullptr : dst->get())}; } ArrayJ Tier1::logarithm(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -260,14 +270,19 @@ ArrayJ Tier1::maximum_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, Arr return ArrayJ{cle::tier1::maximum_images_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::maximum_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::maximum(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::maximum_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::maximum_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier1::maximum_filter_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; +} + +ArrayJ Tier1::grayscale_dilate(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) +{ + return ArrayJ{cle::tier1::grayscale_dilate_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier1::maximum_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -285,19 +300,19 @@ ArrayJ Tier1::maximum_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::maximum_z_projection_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::mean_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::mean_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::mean_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::mean_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::mean_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::mean_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::mean(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::mean_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::mean_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier1::mean_filter_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier1::mean_x_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -315,29 +330,34 @@ ArrayJ Tier1::mean_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::mean_z_projection_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::median_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::median_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::median_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::median_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::median_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::median_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::median(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::median(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { return ArrayJ{cle::tier1::median_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } -ArrayJ Tier1::minimum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::minimum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::minimum_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::minimum(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::minimum_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) +{ + return ArrayJ{cle::tier1::minimum_filter_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; +} + +ArrayJ Tier1::grayscale_erode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::minimum_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier1::grayscale_erode_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier1::minimum_image_and_scalar(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar) @@ -365,17 +385,17 @@ ArrayJ Tier1::minimum_z_projection(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::minimum_z_projection_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::mode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::mode_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::mode_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::mode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::mode_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::mode_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::mode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::mode(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { return ArrayJ{cle::tier1::mode_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } @@ -445,24 +465,24 @@ ArrayJ Tier1::not_equal_constant(DeviceJ * device, ArrayJ * src, ArrayJ * dst, f return ArrayJ{cle::tier1::not_equal_constant_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), scalar)}; } -ArrayJ Tier1::paste(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int index_x, int index_y, int index_z) +ArrayJ Tier1::paste(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int destination_x, int destination_y, int destination_z) { - return ArrayJ{cle::tier1::paste_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), index_x, index_y, index_z)}; + return ArrayJ{cle::tier1::paste_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), destination_x, destination_y, destination_z)}; } -ArrayJ Tier1::onlyzero_overwrite_maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1) +ArrayJ Tier1::onlyzero_overwrite_maximum_box(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst) { - return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_box_func(device->get(), src->get(), dst0->get(), dst1 == nullptr ? nullptr : dst1->get())}; + return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_box_func(device->get(), src->get(), flag->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::onlyzero_overwrite_maximum_diamond(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1) +ArrayJ Tier1::onlyzero_overwrite_maximum_diamond(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst) { - return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_diamond_func(device->get(), src->get(), dst0->get(), dst1 == nullptr ? nullptr : dst1->get())}; + return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_diamond_func(device->get(), src->get(), flag->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::onlyzero_overwrite_maximum(DeviceJ * device, ArrayJ * src, ArrayJ * dst0, ArrayJ * dst1, std::string connectivity) +ArrayJ Tier1::onlyzero_overwrite_maximum(DeviceJ * device, ArrayJ * src, ArrayJ * flag, ArrayJ * dst, std::string connectivity) { - return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_func(device->get(), src->get(), dst0->get(), dst1 == nullptr ? nullptr : dst1->get(), connectivity)}; + return ArrayJ{cle::tier1::onlyzero_overwrite_maximum_func(device->get(), src->get(), flag->get(), dst == nullptr ? nullptr : dst->get(), connectivity)}; } ArrayJ Tier1::power(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar) @@ -490,14 +510,14 @@ ArrayJ Tier1::replace_values(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, Arr return ArrayJ{cle::tier1::replace_values_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::replace_value(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar0, float scalar1) +ArrayJ Tier1::replace_value(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float value_to_replace, float value_replacement) { - return ArrayJ{cle::tier1::replace_value_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), scalar0, scalar1)}; + return ArrayJ{cle::tier1::replace_value_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), value_to_replace, value_replacement)}; } -ArrayJ Tier1::replace_intensity(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float scalar0, float scalar1) +ArrayJ Tier1::replace_intensity(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float value_to_replace, float value_replacement) { - return ArrayJ{cle::tier1::replace_intensity_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), scalar0, scalar1)}; + return ArrayJ{cle::tier1::replace_intensity_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), value_to_replace, value_replacement)}; } ArrayJ Tier1::replace_intensities(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) @@ -515,9 +535,9 @@ ArrayJ Tier1::minimum_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float return ArrayJ{cle::tier1::minimum_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::multiply_matrix(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) +ArrayJ Tier1::multiply_matrix(DeviceJ * device, ArrayJ * matrix1, ArrayJ * matrix2, ArrayJ * matrix_destination) { - return ArrayJ{cle::tier1::multiply_matrix_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier1::multiply_matrix_func(device->get(), matrix1->get(), matrix2->get(), matrix_destination == nullptr ? nullptr : matrix_destination->get())}; } ArrayJ Tier1::reciprocal(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -530,9 +550,9 @@ ArrayJ Tier1::set(DeviceJ * device, ArrayJ * src, float scalar) return ArrayJ{cle::tier1::set_func(device->get(), src->get(), scalar)}; } -ArrayJ Tier1::set_column(DeviceJ * device, ArrayJ * src, int column, float value) +ArrayJ Tier1::set_column(DeviceJ * device, ArrayJ * src, int column_index, float value) { - return ArrayJ{cle::tier1::set_column_func(device->get(), src->get(), column, value)}; + return ArrayJ{cle::tier1::set_column_func(device->get(), src->get(), column_index, value)}; } ArrayJ Tier1::set_image_borders(DeviceJ * device, ArrayJ * src, float value) @@ -540,9 +560,9 @@ ArrayJ Tier1::set_image_borders(DeviceJ * device, ArrayJ * src, float value) return ArrayJ{cle::tier1::set_image_borders_func(device->get(), src->get(), value)}; } -ArrayJ Tier1::set_plane(DeviceJ * device, ArrayJ * src, int plane, float value) +ArrayJ Tier1::set_plane(DeviceJ * device, ArrayJ * src, int plane_index, float value) { - return ArrayJ{cle::tier1::set_plane_func(device->get(), src->get(), plane, value)}; + return ArrayJ{cle::tier1::set_plane_func(device->get(), src->get(), plane_index, value)}; } ArrayJ Tier1::set_ramp_x(DeviceJ * device, ArrayJ * src) @@ -560,9 +580,9 @@ ArrayJ Tier1::set_ramp_z(DeviceJ * device, ArrayJ * src) return ArrayJ{cle::tier1::set_ramp_z_func(device->get(), src->get())}; } -ArrayJ Tier1::set_row(DeviceJ * device, ArrayJ * src, int row, float value) +ArrayJ Tier1::set_row(DeviceJ * device, ArrayJ * src, int row_index, float value) { - return ArrayJ{cle::tier1::set_row_func(device->get(), src->get(), row, value)}; + return ArrayJ{cle::tier1::set_row_func(device->get(), src->get(), row_index, value)}; } ArrayJ Tier1::set_nonzero_pixels_to_pixelindex(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int offset) @@ -670,19 +690,19 @@ ArrayJ Tier1::undefined_to_zero(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier1::undefined_to_zero_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier1::variance_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::variance_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::variance_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::variance_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier1::variance_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier1::variance_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier1::variance(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier1::variance_filter(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier1::variance_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier1::variance_filter_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier1::write_values_to_positions(DeviceJ * device, ArrayJ * src, ArrayJ * dst) diff --git a/native/clesperantoj/src/tier2j.cpp b/native/clesperantoj/src/tier2j.cpp index c40fa7d..66ac325 100644 --- a/native/clesperantoj/src/tier2j.cpp +++ b/native/clesperantoj/src/tier2j.cpp @@ -15,7 +15,7 @@ ArrayJ Tier2::add_images(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ return ArrayJ{cle::tier2::add_images_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier2::bottom_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::bottom_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::bottom_hat_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } @@ -40,14 +40,24 @@ ArrayJ Tier2::closing_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radi return ArrayJ{cle::tier2::closing_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::closing_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::closing_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::closing_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier2::grayscale_closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier2::closing_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier2::grayscale_closing_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; +} + +ArrayJ Tier2::closing(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst) +{ + return ArrayJ{cle::tier2::closing_func(device->get(), src->get(), footprint->get(), dst == nullptr ? nullptr : dst->get())}; +} + +ArrayJ Tier2::binary_closing(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) +{ + return ArrayJ{cle::tier2::binary_closing_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier2::concatenate_along_x(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, ArrayJ * dst) @@ -65,9 +75,9 @@ ArrayJ Tier2::concatenate_along_z(DeviceJ * device, ArrayJ * src0, ArrayJ * src1 return ArrayJ{cle::tier2::concatenate_along_z_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier2::count_touching_neighbors(DeviceJ * device, ArrayJ * src, ArrayJ * dst, bool ignore_background) +ArrayJ Tier2::count_touching_neighbors(DeviceJ * device, ArrayJ * touch_matrix, ArrayJ * touching_neighbors_count_destination, bool ignore_background) { - return ArrayJ{cle::tier2::count_touching_neighbors_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), ignore_background)}; + return ArrayJ{cle::tier2::count_touching_neighbors_func(device->get(), touch_matrix->get(), touching_neighbors_count_destination == nullptr ? nullptr : touching_neighbors_count_destination->get(), ignore_background)}; } ArrayJ Tier2::crop_border(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int border_size) @@ -85,22 +95,22 @@ ArrayJ Tier2::degrees_to_radians(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier2::degrees_to_radians_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier2::detect_maxima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::detect_maxima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::detect_maxima_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::detect_maxima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier2::detect_maxima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { return ArrayJ{cle::tier2::detect_maxima_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } -ArrayJ Tier2::detect_minima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::detect_minima_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::detect_minima_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::detect_minima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier2::detect_minima(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { return ArrayJ{cle::tier2::detect_minima_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } @@ -145,7 +155,7 @@ float Tier2::minimum_of_masked_pixels(DeviceJ * device, ArrayJ * src, ArrayJ * m return cle::tier2::minimum_of_masked_pixels_func(device->get(), src->get(), mask->get()); } -ArrayJ Tier2::opening_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::opening_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::opening_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } @@ -155,9 +165,19 @@ ArrayJ Tier2::opening_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float return ArrayJ{cle::tier2::opening_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) +ArrayJ Tier2::grayscale_opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) +{ + return ArrayJ{cle::tier2::grayscale_opening_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; +} + +ArrayJ Tier2::opening(DeviceJ * device, ArrayJ * src, ArrayJ * footprint, ArrayJ * dst) +{ + return ArrayJ{cle::tier2::opening_func(device->get(), src->get(), footprint->get(), dst == nullptr ? nullptr : dst->get())}; +} + +ArrayJ Tier2::binary_opening(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { - return ArrayJ{cle::tier2::opening_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; + return ArrayJ{cle::tier2::binary_opening_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } ArrayJ Tier2::radians_to_degrees(DeviceJ * device, ArrayJ * src, ArrayJ * dst) @@ -185,17 +205,17 @@ ArrayJ Tier2::squared_difference(DeviceJ * device, ArrayJ * src0, ArrayJ * src1, return ArrayJ{cle::tier2::squared_difference_func(device->get(), src0->get(), src1->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier2::standard_deviation_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::standard_deviation_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::standard_deviation_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::standard_deviation_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::standard_deviation_sphere(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::standard_deviation_sphere_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } -ArrayJ Tier2::standard_deviation(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z, std::string connectivity) +ArrayJ Tier2::standard_deviation(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z, std::string connectivity) { return ArrayJ{cle::tier2::standard_deviation_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z, connectivity)}; } @@ -225,7 +245,7 @@ float Tier2::sum_of_all_pixels(DeviceJ * device, ArrayJ * src) return cle::tier2::sum_of_all_pixels_func(device->get(), src == nullptr ? nullptr : src->get()); } -ArrayJ Tier2::top_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int radius_x, int radius_y, int radius_z) +ArrayJ Tier2::top_hat_box(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float radius_x, float radius_y, float radius_z) { return ArrayJ{cle::tier2::top_hat_box_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), radius_x, radius_y, radius_z)}; } diff --git a/native/clesperantoj/src/tier3j.cpp b/native/clesperantoj/src/tier3j.cpp index ae450d3..94f8cc0 100644 --- a/native/clesperantoj/src/tier3j.cpp +++ b/native/clesperantoj/src/tier3j.cpp @@ -55,9 +55,9 @@ ArrayJ Tier3::generate_touch_matrix(DeviceJ * device, ArrayJ * src, ArrayJ * dst return ArrayJ{cle::tier3::generate_touch_matrix_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier3::histogram(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int nbins, float min, float max) +ArrayJ Tier3::histogram(DeviceJ * device, ArrayJ * src, ArrayJ * dst, int num_bins, float minimum_intensity, float maximum_intensity) { - return ArrayJ{cle::tier3::histogram_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), nbins, min, max)}; + return ArrayJ{cle::tier3::histogram_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), num_bins, minimum_intensity, maximum_intensity)}; } float Tier3::jaccard_index(DeviceJ * device, ArrayJ * src0, ArrayJ * src1) @@ -65,9 +65,9 @@ float Tier3::jaccard_index(DeviceJ * device, ArrayJ * src0, ArrayJ * src1) return cle::tier3::jaccard_index_func(device->get(), src0->get(), src1->get()); } -ArrayJ Tier3::labelled_spots_to_pointlist(DeviceJ * device, ArrayJ * src, ArrayJ * dst) +ArrayJ Tier3::labelled_spots_to_pointlist(DeviceJ * device, ArrayJ * label, ArrayJ * pointlist) { - return ArrayJ{cle::tier3::labelled_spots_to_pointlist_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier3::labelled_spots_to_pointlist_func(device->get(), label->get(), pointlist == nullptr ? nullptr : pointlist->get())}; } std::vector Tier3::maximum_position(DeviceJ * device, ArrayJ * src) @@ -90,13 +90,13 @@ ArrayJ Tier3::morphological_chan_vese(DeviceJ * device, ArrayJ * src, ArrayJ * d return ArrayJ{cle::tier3::morphological_chan_vese_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), num_iter, smoothing, lambda1, lambda2)}; } -std::unordered_map> Tier3::statistics_of_labelled_pixels(DeviceJ * device, ArrayJ * label, ArrayJ * intensity) +std::unordered_map> Tier3::statistics_of_labelled_pixels(DeviceJ * device, ArrayJ * intensity, ArrayJ * label) { - return cle::tier3::statistics_of_labelled_pixels_func(device->get(), label->get(), intensity == nullptr ? nullptr : intensity->get()); + return cle::tier3::statistics_of_labelled_pixels_func(device->get(), intensity == nullptr ? nullptr : intensity->get(), label == nullptr ? nullptr : label->get()); } -std::unordered_map> Tier3::statistics_of_background_and_labelled_pixels(DeviceJ * device, ArrayJ * label, ArrayJ * intensity) +std::unordered_map> Tier3::statistics_of_background_and_labelled_pixels(DeviceJ * device, ArrayJ * intensity, ArrayJ * label) { - return cle::tier3::statistics_of_background_and_labelled_pixels_func(device->get(), label->get(), intensity == nullptr ? nullptr : intensity->get()); + return cle::tier3::statistics_of_background_and_labelled_pixels_func(device->get(), intensity == nullptr ? nullptr : intensity->get(), label == nullptr ? nullptr : label->get()); } diff --git a/native/clesperantoj/src/tier4j.cpp b/native/clesperantoj/src/tier4j.cpp index ae38b66..e1262f8 100644 --- a/native/clesperantoj/src/tier4j.cpp +++ b/native/clesperantoj/src/tier4j.cpp @@ -30,6 +30,11 @@ ArrayJ Tier4::threshold_otsu(DeviceJ * device, ArrayJ * src, ArrayJ * dst) return ArrayJ{cle::tier4::threshold_otsu_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } +ArrayJ Tier4::mean_intensity_map(DeviceJ * device, ArrayJ * src, ArrayJ * labels, ArrayJ * dst) +{ + return ArrayJ{cle::tier4::mean_intensity_map_func(device->get(), src->get(), labels->get(), dst == nullptr ? nullptr : dst->get())}; +} + ArrayJ Tier4::pixel_count_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst) { return ArrayJ{cle::tier4::pixel_count_map_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; @@ -40,9 +45,9 @@ ArrayJ Tier4::label_pixel_count_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst return ArrayJ{cle::tier4::label_pixel_count_map_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier4::centroids_of_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, bool withBG) +ArrayJ Tier4::centroids_of_labels(DeviceJ * device, ArrayJ * label_image, ArrayJ * centroids_coordinates, bool include_background) { - return ArrayJ{cle::tier4::centroids_of_labels_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get(), withBG)}; + return ArrayJ{cle::tier4::centroids_of_labels_func(device->get(), label_image->get(), centroids_coordinates->get(), include_background)}; } ArrayJ Tier4::remove_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value, float max_value) @@ -55,14 +60,14 @@ ArrayJ Tier4::remove_labels_with_map_values_within_range(DeviceJ * device, Array return ArrayJ{cle::tier4::remove_labels_with_map_values_within_range_func(device->get(), src->get(), values->get(), dst == nullptr ? nullptr : dst->get(), min_value, max_value)}; } -ArrayJ Tier4::exclude_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value_range, float max_value_range) +ArrayJ Tier4::exclude_labels_with_map_values_out_of_range(DeviceJ * device, ArrayJ * values_map, ArrayJ * label_map_input, ArrayJ * dst, float minimum_value_range, float maximum_value_range) { - return ArrayJ{cle::tier4::exclude_labels_with_map_values_out_of_range_func(device->get(), src->get(), values->get(), dst == nullptr ? nullptr : dst->get(), min_value_range, max_value_range)}; + return ArrayJ{cle::tier4::exclude_labels_with_map_values_out_of_range_func(device->get(), values_map->get(), label_map_input->get(), dst == nullptr ? nullptr : dst->get(), minimum_value_range, maximum_value_range)}; } -ArrayJ Tier4::exclude_labels_with_map_values_within_range(DeviceJ * device, ArrayJ * src, ArrayJ * values, ArrayJ * dst, float min_value_range, float max_value_range) +ArrayJ Tier4::exclude_labels_with_map_values_within_range(DeviceJ * device, ArrayJ * values_map, ArrayJ * label_map_input, ArrayJ * dst, float minimum_value_range, float maximum_value_range) { - return ArrayJ{cle::tier4::exclude_labels_with_map_values_within_range_func(device->get(), src->get(), values->get(), dst == nullptr ? nullptr : dst->get(), min_value_range, max_value_range)}; + return ArrayJ{cle::tier4::exclude_labels_with_map_values_within_range_func(device->get(), values_map->get(), label_map_input->get(), dst == nullptr ? nullptr : dst->get(), minimum_value_range, maximum_value_range)}; } ArrayJ Tier4::extension_ratio_map(DeviceJ * device, ArrayJ * src, ArrayJ * dst) diff --git a/native/clesperantoj/src/tier6j.cpp b/native/clesperantoj/src/tier6j.cpp index 9b8c06a..abc20c6 100644 --- a/native/clesperantoj/src/tier6j.cpp +++ b/native/clesperantoj/src/tier6j.cpp @@ -25,9 +25,9 @@ ArrayJ Tier6::masked_voronoi_labeling(DeviceJ * device, ArrayJ * src, ArrayJ * m return ArrayJ{cle::tier6::masked_voronoi_labeling_func(device->get(), src->get(), mask->get(), dst == nullptr ? nullptr : dst->get())}; } -ArrayJ Tier6::voronoi_labeling(DeviceJ * device, ArrayJ * src, ArrayJ * dst) +ArrayJ Tier6::voronoi_labeling(DeviceJ * device, ArrayJ * input_binary, ArrayJ * output_labels) { - return ArrayJ{cle::tier6::voronoi_labeling_func(device->get(), src->get(), dst == nullptr ? nullptr : dst->get())}; + return ArrayJ{cle::tier6::voronoi_labeling_func(device->get(), input_binary->get(), output_labels == nullptr ? nullptr : output_labels->get())}; } ArrayJ Tier6::remove_small_labels(DeviceJ * device, ArrayJ * src, ArrayJ * dst, float minimum_size) diff --git a/pom.xml b/pom.xml index 7f6203a..946e75b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 38.0.1 + 40.0.0 @@ -19,7 +19,7 @@ Robert Haase, MPI CBG and Stephane Rigaud, Institut Pasteur sign,deploy-to-scijava - 0.13.4 + 0.16.0 clesperantoj @@ -153,19 +153,17 @@ net.imglib2 imglib2 - 7.0.2 + junit junit test - org.bytedeco javacpp - - 1.5.10 + net.imagej @@ -280,7 +278,8 @@ org.bytedeco javacpp - 1.5.10 + + ${javacpp.version} ${compiler.option} diff --git a/src/main/java/net/clesperanto/kernels/Tier1.java b/src/main/java/net/clesperanto/kernels/Tier1.java index 1a9d7a5..ac83b22 100644 --- a/src/main/java/net/clesperanto/kernels/Tier1.java +++ b/src/main/java/net/clesperanto/kernels/Tier1.java @@ -22,8 +22,9 @@ public class Tier1 { * <pre>f(x) = |x| </pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_absolute * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ absolute(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -36,29 +37,31 @@ public static ArrayJ absolute(DeviceJ device, ArrayJ input, ArrayJ output) { * Calculates the sum of pairs of pixels x and y from images X and Y weighted with factors a and b. * <pre>f(x, y, a, b) = x * a + y * b</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first input image to added. - * @param input1 ({@link ArrayJ}) - The second image to be added. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) - * @param factor0 (float) - Multiplication factor of each pixel of src0 before adding it. (default: 1) - * @param factor1 (float) - Multiplication factor of each pixel of src1 before adding it. (default: 1) + * @param input0 ({@link ArrayJ}) - First input image to add. + * @param input1 ({@link ArrayJ}) - Second image to add. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) + * @param factor1 (float) - Multiplication factor of each pixel of src0 before adding it. (default: 1) + * @param factor2 (float) - Multiplication factor of each pixel of src1 before adding it. (default: 1) * @return {@link ArrayJ} + * @see reference_addImagesWeighted * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ addImagesWeighted(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output, float factor0, float factor1) { + public static ArrayJ addImagesWeighted(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output, float factor1, float factor2) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input0, "input0 cannot be null"); Objects.requireNonNull(input1, "input1 cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.add_images_weighted(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw(), factor0, factor1)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.add_images_weighted(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw(), factor1, factor2)); } /** * Adds a scalar value s to all pixels x of a given image X. * <pre>f(x, s) = x + s</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - The input image where scalare should be added. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) - * @param scalar (float) - The constant number which will be added to all pixels. (default: 1) + * @param input ({@link ArrayJ}) - Input image to process. + * @param output ({@link ArrayJ}) - Output image. (default: None) + * @param scalar (float) - Scalar number to add to all pixels. (default: 1) * @return {@link ArrayJ} + * @see reference_addImageAndScalar * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ addImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -72,10 +75,11 @@ public static ArrayJ addImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ outp * All pixel values except 0 in the input images are interpreted as 1. * <pre>f(x, y) = x & y</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first binary input image to be processed. - * @param input1 ({@link ArrayJ}) - The second binary input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input0 ({@link ArrayJ}) - First binary input image to be processed. + * @param input1 ({@link ArrayJ}) - Second binary input image to be processed. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_binaryAnd * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binaryAnd(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -89,9 +93,10 @@ public static ArrayJ binaryAnd(DeviceJ device, ArrayJ input0, ArrayJ input1, Arr * Determines pixels/voxels which are on the surface of binary objects and sets only them to 1 in the destination image. * All other pixels are set to 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - The binary input image where edges will be searched. - * @param output ({@link ArrayJ}) - The output image where edge pixels will be 1. (default: None) + * @param input ({@link ArrayJ}) - Binary input image where edges will be searched. + * @param output ({@link ArrayJ}) - Output image where edge pixels will be 1. (default: None) * @return {@link ArrayJ} + * @see reference_binaryEdgeDetection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binaryEdgeDetection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -104,9 +109,10 @@ public static ArrayJ binaryEdgeDetection(DeviceJ device, ArrayJ input, ArrayJ ou * Computes a binary image (containing pixel values 0 and 1) from an image X by negating its pixel values x using the binary NOT operator ! All pixel values except 0 in the input image are interpreted as 1. * <pre>f(x) = !x</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - The binary input image to be inverted. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input ({@link ArrayJ}) - Binary input image to be inverted. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_binaryNot * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binaryNot(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -120,10 +126,11 @@ public static ArrayJ binaryNot(DeviceJ device, ArrayJ input, ArrayJ output) { * All pixel values except 0 in the input images are interpreted as 1. * <pre>f(x, y) = x | y</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first binary input image to be processed. - * @param input1 ({@link ArrayJ}) - The second binary input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input0 ({@link ArrayJ}) - First binary input image to be processed. + * @param input1 ({@link ArrayJ}) - Second binary input image to be processed. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_binaryOr * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binaryOr(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -136,10 +143,11 @@ public static ArrayJ binaryOr(DeviceJ device, ArrayJ input0, ArrayJ input1, Arra /** * Subtracts one binary image from another. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first binary input image to be processed. - * @param input1 ({@link ArrayJ}) - The second binary input image to be subtracted from the first. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input0 ({@link ArrayJ}) - First binary input image to be processed. + * @param input1 ({@link ArrayJ}) - Second binary input image to be subtracted from the first. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_binarySubtract * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binarySubtract(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -154,10 +162,11 @@ public static ArrayJ binarySubtract(DeviceJ device, ArrayJ input0, ArrayJ input1 * All pixel values except 0 in the input images are interpreted as 1. * <pre>f(x, y) = (x & !y) | (!x & y)</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first binary input image to be processed. - * @param input1 ({@link ArrayJ}) - The second binary input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input0 ({@link ArrayJ}) - First binary input image to be processed. + * @param input1 ({@link ArrayJ}) - Second binary input image to be processed. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_binaryXOr * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ binaryXor(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -172,7 +181,7 @@ public static ArrayJ binaryXor(DeviceJ device, ArrayJ input0, ArrayJ input1, Arr * Warning: This operation is only supported BINARY data type images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The binary input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -187,7 +196,7 @@ public static ArrayJ binarySupinf(DeviceJ device, ArrayJ input, ArrayJ output) { * Warning: This operation is only supported BINARY data type images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The binary input image to be processed. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -225,6 +234,7 @@ public static ArrayJ blockEnumerate(DeviceJ device, ArrayJ input0, ArrayJ input1 * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_convolve * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ convolve(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -241,6 +251,7 @@ public static ArrayJ convolve(DeviceJ device, ArrayJ input0, ArrayJ input1, Arra * @param input ({@link ArrayJ}) - Input image to copy. * @param output ({@link ArrayJ}) - Output copy image. (default: None) * @return {@link ArrayJ} + * @see reference_copy * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ copy(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -250,51 +261,54 @@ public static ArrayJ copy(DeviceJ device, ArrayJ input, ArrayJ output) { } /** - * This method has two purposes: It copies a 2D image to a given slice z position in a 3D image stack or It copies a given slice at position z in an image stack to a 2D image. + * This method has two purposes: It copies a 2D image to a given slice_index z position in a 3D image stack or It copies a given slice_index at position z in an image stack to a 2D image. * The first case is only available via ImageJ macro. * If you are using it, it is recommended that the target 3D image already preexists in GPU memory before calling this method. * Otherwise, CLIJ create the image stack with z planes. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to copy from. - * @param output ({@link ArrayJ}) - Output copy image slice. (default: None) - * @param slice (int) - (default: 0) + * @param output ({@link ArrayJ}) - Output copy image slice_index. (default: None) + * @param slice_index (int) - Index of the slice to copy. (default: 0) * @return {@link ArrayJ} + * @see reference_copySlice * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ copySlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice) { + public static ArrayJ copySlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice_index) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice_index)); } /** - * This method has two purposes: It copies a 2D image to a given slice y position in a 3D image stack or It copies a given slice at position y in an image stack to a 2D image. + * This method has two purposes: It copies a 2D image to a given slice_index y position in a 3D image stack or It copies a given slice_index at position y in an image stack to a 2D image. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to copy from. - * @param output ({@link ArrayJ}) - Output copy image slice. (default: None) - * @param slice (int) - (default: 0) + * @param output ({@link ArrayJ}) - Output copy image slice_index. (default: None) + * @param slice_index (int) - Index of the slice to copy. (default: 0) * @return {@link ArrayJ} + * @see reference_copySlice * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ copyHorizontalSlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice) { + public static ArrayJ copyHorizontalSlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice_index) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_horizontal_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_horizontal_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice_index)); } /** - * This method has two purposes: It copies a 2D image to a given slice x position in a 3D image stack or It copies a given slice at position x in an image stack to a 2D image. + * This method has two purposes: It copies a 2D image to a given slice_index x position in a 3D image stack or It copies a given slice_index at position x in an image stack to a 2D image. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to copy from. - * @param output ({@link ArrayJ}) - Output copy image slice. (default: None) - * @param slice (int) - (default: 0) + * @param output ({@link ArrayJ}) - Output copy image slice_index. (default: None) + * @param slice_index (int) - Index of the slice to copy. (default: 0) * @return {@link ArrayJ} + * @see reference_copySlice * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ copyVerticalSlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice) { + public static ArrayJ copyVerticalSlice(DeviceJ device, ArrayJ input, ArrayJ output, int slice_index) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_vertical_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.copy_vertical_slice(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), slice_index)); } /** @@ -310,6 +324,7 @@ public static ArrayJ copyVerticalSlice(DeviceJ device, ArrayJ input, ArrayJ outp * @param height (int) - Height size of the region to crop. (default: 1) * @param depth (int) - Depth size of the region to crop. (default: 1) * @return {@link ArrayJ} + * @see reference_crop3D * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ crop(DeviceJ device, ArrayJ input, ArrayJ output, int start_x, int start_y, int start_z, int width, int height, int depth) { @@ -338,6 +353,7 @@ public static ArrayJ cubicRoot(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_detectLabelEdges * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ detectLabelEdges(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -346,9 +362,29 @@ public static ArrayJ detectLabelEdges(DeviceJ device, ArrayJ input, ArrayJ outpu return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.detect_label_edges(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw())); } + /** + * Computes the dilation operation between an image and a structuring element. + * The operation is applied in grayscale if the image is in grayscale. + * The structuring element is a binary image with pixel values 0 and 1, and must have the same dimensionality as the image (3D is the image is 3D, 2D if the image is 2D). + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param footprint ({@link ArrayJ}) - Structuring element to use for the operation. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @return {@link ArrayJ} + * @see reference_erodeBox + * @throws NullPointerException if any of the device or input parameters are null. + */ + @Deprecated + public static ArrayJ dilation(DeviceJ device, ArrayJ input, ArrayJ footprint, ArrayJ output) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(footprint, "footprint cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.dilation(device.getRaw(), input.getRaw(), footprint.getRaw(), output == null ? null : output.getRaw())); + } + /** * Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. - * The dilation takes the Mooreneighborhood (8 pixels in 2D and 26 pixels in 3d) into account. + * The dilation takes the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. * This method is comparable to the 'Dilate' menu in ImageJ in case it is applied to a 2D image. * The only difference is that the output image contains values 0 and 1 instead of 0 and 255. @@ -356,6 +392,7 @@ public static ArrayJ detectLabelEdges(DeviceJ device, ArrayJ input, ArrayJ outpu * @param input ({@link ArrayJ}) - Input image to process. Input image to process. * @param output ({@link ArrayJ}) - Output result image. Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_dilateBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -367,12 +404,13 @@ public static ArrayJ dilateBox(DeviceJ device, ArrayJ input, ArrayJ output) { /** * Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. - * The dilation takes the vonNeumannneighborhood (4 pixels in 2D and 6 pixels in 3d) into account. + * The dilation takes the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. Input image to process. * @param output ({@link ArrayJ}) - Output result image. Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_dilateSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -384,36 +422,43 @@ public static ArrayJ dilateSphere(DeviceJ device, ArrayJ input, ArrayJ output) { /** * Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. - * The dilation apply the Mooreneighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the vonNeumannneighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. + * The dilation apply the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. + * For a more flexible dilation with arbitrary shapes, use dilation() instead. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. Input image to process. * @param output ({@link ArrayJ}) - Output result image. Output result image. (default: None) + * @param radius_x (float) - Radius of sphere or box structuring element in X. (default: 1) + * @param radius_y (float) - Radius of sphere or box structuring element in Y. (default: 1) + * @param radius_z (float) - Radius of sphere or box structuring element in Z. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere". (default: "box") * @return {@link ArrayJ} + * @see reference_dilateBox + * @see reference_dilateSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ dilate(DeviceJ device, ArrayJ input, ArrayJ output, String connectivity) { + public static ArrayJ binaryDilate(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.dilate(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.binary_dilate(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** * Divides two images X and Y by each other pixel wise. * <pre>f(x, y) = x / y</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - First input image to process. - * @param input1 ({@link ArrayJ}) - Second input image to process. + * @param dividend ({@link ArrayJ}) - Input image to process. + * @param divisor ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_divideImages * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ divideImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { + public static ArrayJ divideImages(DeviceJ device, ArrayJ dividend, ArrayJ divisor, ArrayJ output) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input0, "input0 cannot be null"); - Objects.requireNonNull(input1, "input1 cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.divide_images(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(dividend, "dividend cannot be null"); + Objects.requireNonNull(divisor, "divisor cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.divide_images(device.getRaw(), dividend.getRaw(), divisor.getRaw(), output == null ? null : output.getRaw())); } /** @@ -422,7 +467,7 @@ public static ArrayJ divideImages(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param scalar (float) - (default: 0) + * @param scalar (float) - Scalar value to divide the image with. (default: 0) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -437,10 +482,11 @@ public static ArrayJ divideScalarByImage(DeviceJ device, ArrayJ input, ArrayJ ou * <pre>f(a, b) = 1 if a == b; 0 otherwise. * </pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first image to be compared with. - * @param input1 ({@link ArrayJ}) - The second image to be compared with the first. - * @param output ({@link ArrayJ}) - The resulting binary image where pixels will be 1 only if source1 (default: None) + * @param input0 ({@link ArrayJ}) - First image to be compared with. + * @param input1 ({@link ArrayJ}) - Second image to be compared with the first. + * @param output ({@link ArrayJ}) - Output binary image. (default: None) * @return {@link ArrayJ} + * @see reference_equal * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ equal(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -455,10 +501,11 @@ public static ArrayJ equal(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ * <pre>f(a, b) = 1 if a == b; 0 otherwise. * </pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - The image where every pixel is compared to the constant. - * @param output ({@link ArrayJ}) - The resulting binary image where pixels will be 1 only if source1 (default: None) - * @param scalar (float) - The constant where every pixel is compared to. (default: 0) + * @param input ({@link ArrayJ}) - Input omage where every pixel is compared to the constant. + * @param output ({@link ArrayJ}) - Output binary image. (default: None) + * @param scalar (float) - Scalar value to compare pixel with. (default: 0) * @return {@link ArrayJ} + * @see reference_equalConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ equalConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -467,9 +514,28 @@ public static ArrayJ equalConstant(DeviceJ device, ArrayJ input, ArrayJ output, return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.equal_constant(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), scalar)); } + /** + * Computes the erosion operation between an image and a structuring element. + * The operation is applied in grayscale if the image is in grayscale. + * The structuring element is a binary image with pixel values 0 and 1, and must have the same dimensionality as the image (3D is the image is 3D, 2D if the image is 2D). + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param footprint ({@link ArrayJ}) - Structuring element to use for the operation. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @return {@link ArrayJ} + * @see reference_erodeBox + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ erosion(DeviceJ device, ArrayJ input, ArrayJ footprint, ArrayJ output) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(footprint, "footprint cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.erosion(device.getRaw(), input.getRaw(), footprint.getRaw(), output == null ? null : output.getRaw())); + } + /** * Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. - * The erosion takes the Mooreneighborhood (8 pixels in 2D and 26 pixels in 3d) into account. + * The erosion takes the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. * This method is comparable to the 'Erode' menu in ImageJ in case it is applied to a 2D image. * The only difference is that the output image contains values 0 and 1 instead of 0 and 255. @@ -477,6 +543,7 @@ public static ArrayJ equalConstant(DeviceJ device, ArrayJ input, ArrayJ output, * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_erodeBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -488,12 +555,13 @@ public static ArrayJ erodeBox(DeviceJ device, ArrayJ input, ArrayJ output) { /** * Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. - * The erosion takes the vonNeumannneighborhood (4 pixels in 2D and 6 pixels in 3d) into account. + * The erosion takes the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_erodeSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -505,19 +573,25 @@ public static ArrayJ erodeSphere(DeviceJ device, ArrayJ input, ArrayJ output) { /** * Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. - * The erosion apply the Mooreneighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the vonNeumannneighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. + * The erosion apply the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. + * For a more flexible erosion with arbitrary shapes, use erosion() instead. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param radius_x (float) - Radius of the eroding sphere or box structuring element in X. (default: 1) + * @param radius_y (float) - Radius of the eroding sphere or box structuring element in Y. (default: 1) + * @param radius_z (float) - Radius of the eroding sphere or box structuring element in Z. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere". (default: "box") * @return {@link ArrayJ} + * @see reference_erodeBox + * @see reference_erodeSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ erode(DeviceJ device, ArrayJ input, ArrayJ output, String connectivity) { + public static ArrayJ binaryErode(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.erode(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.binary_erode(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -527,6 +601,7 @@ public static ArrayJ erode(DeviceJ device, ArrayJ input, ArrayJ output, String c * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_exponential * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ exponential(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -544,6 +619,7 @@ public static ArrayJ exponential(DeviceJ device, ArrayJ input, ArrayJ output) { * @param flip_y (boolean) - Flip along the y axis if true. (default: True) * @param flip_z (boolean) - Flip along the z axis if true. (default: True) * @return {@link ArrayJ} + * @see reference_flip3D * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ flip(DeviceJ device, ArrayJ input, ArrayJ output, boolean flip_x, boolean flip_y, boolean flip_z) { @@ -564,6 +640,7 @@ public static ArrayJ flip(DeviceJ device, ArrayJ input, ArrayJ output, boolean f * @param sigma_y (float) - Sigma value along the y axis. (default: 0) * @param sigma_z (float) - Sigma value along the z axis. (default: 0) * @return {@link ArrayJ} + * @see reference_gaussianBlur3D * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gaussianBlur(DeviceJ device, ArrayJ input, ArrayJ output, float sigma_x, float sigma_y, float sigma_z) { @@ -581,17 +658,18 @@ public static ArrayJ gaussianBlur(DeviceJ device, ArrayJ input, ArrayJ output, f * Thus, one can threshold a distance matrix to generate a touch matrix out of it for drawing objects to a theoretical background object. * In that way, distance matrices are of the same size as touch matrices meshes. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - First input image to process. - * @param input1 ({@link ArrayJ}) - Second input image to process. - * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param coordinate_list1 ({@link ArrayJ}) - First coordinate list to process. + * @param coordinate_list2 ({@link ArrayJ}) - Second coordinate list to process. + * @param distance_matrix_destination ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_generateDistanceMatrix * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ generateDistanceMatrix(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { + public static ArrayJ generateDistanceMatrix(DeviceJ device, ArrayJ coordinate_list1, ArrayJ coordinate_list2, ArrayJ distance_matrix_destination) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input0, "input0 cannot be null"); - Objects.requireNonNull(input1, "input1 cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.generate_distance_matrix(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(coordinate_list1, "coordinate_list1 cannot be null"); + Objects.requireNonNull(coordinate_list2, "coordinate_list2 cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.generate_distance_matrix(device.getRaw(), coordinate_list1.getRaw(), coordinate_list2.getRaw(), distance_matrix_destination == null ? null : distance_matrix_destination.getRaw())); } /** @@ -602,6 +680,7 @@ public static ArrayJ generateDistanceMatrix(DeviceJ device, ArrayJ input0, Array * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_gradientX * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gradientX(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -618,6 +697,7 @@ public static ArrayJ gradientX(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_gradientY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gradientY(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -634,6 +714,7 @@ public static ArrayJ gradientY(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_gradientZ * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gradientZ(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -650,6 +731,7 @@ public static ArrayJ gradientZ(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_greater * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ greater(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -665,8 +747,9 @@ public static ArrayJ greater(DeviceJ device, ArrayJ input0, ArrayJ input1, Array * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param scalar (float) - (default: 0) + * @param scalar (float) - Scalar value to compare pixel with. (default: 0) * @return {@link ArrayJ} + * @see reference_greaterConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ greaterConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -683,6 +766,7 @@ public static ArrayJ greaterConstant(DeviceJ device, ArrayJ input, ArrayJ output * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_greaterOrEqual * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ greaterOrEqual(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -698,8 +782,9 @@ public static ArrayJ greaterOrEqual(DeviceJ device, ArrayJ input0, ArrayJ input1 * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param scalar (float) - Scalar value used in the comparison. (default: 0) + * @param scalar (float) - Scalar value to compare pixel with. (default: 0) * @return {@link ArrayJ} + * @see reference_greaterOrEqualConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ greaterOrEqualConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -739,6 +824,7 @@ public static ArrayList hessianEigenvalues(DeviceJ device, ArrayJ input, * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_laplaceBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -754,6 +840,7 @@ public static ArrayJ laplaceBox(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_laplaceDiamond * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -770,6 +857,7 @@ public static ArrayJ laplaceDiamond(DeviceJ device, ArrayJ input, ArrayJ output) * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_laplaceDiamond * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ laplace(DeviceJ device, ArrayJ input, ArrayJ output, String connectivity) { @@ -781,17 +869,17 @@ public static ArrayJ laplace(DeviceJ device, ArrayJ input, ArrayJ output, String /** * Compute the cross correlation of an image to a given kernel. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - First input image to process. - * @param input1 ({@link ArrayJ}) - Second input image to process. + * @param input ({@link ArrayJ}) - Input image to process. + * @param kernel ({@link ArrayJ}) - Input * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ localCrossCorrelation(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { + public static ArrayJ localCrossCorrelation(DeviceJ device, ArrayJ input, ArrayJ kernel, ArrayJ output) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input0, "input0 cannot be null"); - Objects.requireNonNull(input1, "input1 cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.local_cross_correlation(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(kernel, "kernel cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.local_cross_correlation(device.getRaw(), input.getRaw(), kernel.getRaw(), output == null ? null : output.getRaw())); } /** @@ -801,6 +889,7 @@ public static ArrayJ localCrossCorrelation(DeviceJ device, ArrayJ input0, ArrayJ * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_logarithm * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ logarithm(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -818,6 +907,7 @@ public static ArrayJ logarithm(DeviceJ device, ArrayJ input, ArrayJ output) { * @param mask ({@link ArrayJ}) - Mask image to apply. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_mask * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ mask(DeviceJ device, ArrayJ input, ArrayJ mask, ArrayJ output) { @@ -830,13 +920,14 @@ public static ArrayJ mask(DeviceJ device, ArrayJ input, ArrayJ mask, ArrayJ outp /** * Computes a masked image by applying a label mask to an image. * All pixel values x of image X will be copied to the destination image in case pixel value m at the same position in the label_map image has the right index value i. - * f(x,m,i) = (x if (m == i); (0 otherwise)). + * <pre>f(x,m,i) = (x if (m == i); (0 otherwise))</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input0 ({@link ArrayJ}) - Input Intensity image. * @param input1 ({@link ArrayJ}) - Input Label image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param label (float) - Label value to use. (default: 1) * @return {@link ArrayJ} + * @see reference_maskLabel * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maskLabel(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output, float label) { @@ -854,6 +945,7 @@ public static ArrayJ maskLabel(DeviceJ device, ArrayJ input0, ArrayJ input1, Arr * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Scalar value used in the comparison. (default: 0) * @return {@link ArrayJ} + * @see reference_maximumImageAndScalar * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maximumImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -870,6 +962,7 @@ public static ArrayJ maximumImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_maximumImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maximumImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -885,14 +978,15 @@ public static ArrayJ maximumImages(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_maximum3DBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ maximumBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ maximumBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.maximum_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -904,17 +998,41 @@ public static ArrayJ maximumBox(DeviceJ device, ArrayJ input, ArrayJ output, int * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 0) - * @param radius_y (int) - Radius size along y axis. (default: 0) - * @param radius_z (int) - Radius size along z axis. (default: 0) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) + * @param connectivity (String) - Filter neigborhood (default: "box") + * @return {@link ArrayJ} + * @see reference_maximum3DBox + * @see reference_maximum3DSphere + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ maximumFilter(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.maximum_filter(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + } + + /** + * Computes a grayscale image containing the grayscale dilation of a given input image. + * The erosion apply the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. + * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_minimum3DBox + * @see reference_minimum3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ maximum(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ grayscaleDilate(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.maximum(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.grayscale_dilate(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -923,6 +1041,7 @@ public static ArrayJ maximum(DeviceJ device, ArrayJ input, ArrayJ output, int ra * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_maximumXProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maximumXProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -937,6 +1056,7 @@ public static ArrayJ maximumXProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_maximumYProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maximumYProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -951,6 +1071,7 @@ public static ArrayJ maximumYProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_maximumZProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maximumZProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -965,14 +1086,15 @@ public static ArrayJ maximumZProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_mean3DBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ meanBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ meanBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mean_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -984,14 +1106,15 @@ public static ArrayJ meanBox(DeviceJ device, ArrayJ input, ArrayJ output, int ra * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_mean3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ meanSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ meanSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mean_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1003,17 +1126,18 @@ public static ArrayJ meanSphere(DeviceJ device, ArrayJ input, ArrayJ output, int * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_mean3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ mean(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ meanFilter(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mean(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mean_filter(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -1022,6 +1146,7 @@ public static ArrayJ mean(DeviceJ device, ArrayJ input, ArrayJ output, int radiu * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_meanXProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ meanXProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1036,6 +1161,7 @@ public static ArrayJ meanXProjection(DeviceJ device, ArrayJ input, ArrayJ output * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_meanYProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ meanYProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1050,6 +1176,7 @@ public static ArrayJ meanYProjection(DeviceJ device, ArrayJ input, ArrayJ output * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_meanZProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ meanZProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1065,14 +1192,15 @@ public static ArrayJ meanZProjection(DeviceJ device, ArrayJ input, ArrayJ output * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_median3DBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ medianBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ medianBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.median_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1085,14 +1213,15 @@ public static ArrayJ medianBox(DeviceJ device, ArrayJ input, ArrayJ output, int * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_median3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ medianSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ medianSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.median_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1106,14 +1235,15 @@ public static ArrayJ medianSphere(DeviceJ device, ArrayJ input, ArrayJ output, i * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_median3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ median(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ median(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.median(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); @@ -1125,14 +1255,15 @@ public static ArrayJ median(DeviceJ device, ArrayJ input, ArrayJ output, int rad * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 0) - * @param radius_y (int) - Radius size along y axis. (default: 0) - * @param radius_z (int) - Radius size along z axis. (default: 0) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_minimum3DBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ minimumBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ minimumBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.minimum_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1144,17 +1275,41 @@ public static ArrayJ minimumBox(DeviceJ device, ArrayJ input, ArrayJ output, int * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 0) - * @param radius_y (int) - Radius size along y axis. (default: 0) - * @param radius_z (int) - Radius size along z axis. (default: 0) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_minimum3DBox + * @see reference_minimum3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ minimum(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ minimumFilter(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.minimum(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.minimum_filter(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + } + + /** + * Computes a grayscale image containing the grayscale erosion of a given input image. + * The erosion apply the Mooreneighborhood (8 pixels in 2D and 26 pixels in 3d) for the "box" connectivity and the vonNeumannneighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. + * The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) + * @param connectivity (String) - Filter neigborhood (default: "box") + * @return {@link ArrayJ} + * @see reference_minimum3DBox + * @see reference_minimum3DSphere + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ grayscaleErode(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.grayscale_erode(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -1165,6 +1320,7 @@ public static ArrayJ minimum(DeviceJ device, ArrayJ input, ArrayJ output, int ra * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Scalar value used in the comparison. (default: 0) * @return {@link ArrayJ} + * @see reference_minimumImageAndScalar * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ minimumImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -1181,6 +1337,7 @@ public static ArrayJ minimumImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_minimumImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ minimumImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -1196,6 +1353,7 @@ public static ArrayJ minimumImages(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_minimumXProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ minimumXProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1210,6 +1368,7 @@ public static ArrayJ minimumXProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_minimumYProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ minimumYProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1224,6 +1383,7 @@ public static ArrayJ minimumYProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_minimumZProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ minimumZProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1241,14 +1401,14 @@ public static ArrayJ minimumZProjection(DeviceJ device, ArrayJ input, ArrayJ out * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ modeBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ modeBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mode_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1263,14 +1423,14 @@ public static ArrayJ modeBox(DeviceJ device, ArrayJ input, ArrayJ output, int ra * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ modeSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ modeSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mode_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -1286,14 +1446,14 @@ public static ArrayJ modeSphere(DeviceJ device, ArrayJ input, ArrayJ output, int * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ mode(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ mode(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.mode(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); @@ -1322,6 +1482,7 @@ public static ArrayJ moduloImages(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param dimension (int) - Dimension (0,1,2) to use in the operation. (default: 0) * @return {@link ArrayJ} + * @see reference_multiplyImageAndCoordinate * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ multiplyImageAndPosition(DeviceJ device, ArrayJ input, ArrayJ output, int dimension) { @@ -1335,9 +1496,10 @@ public static ArrayJ multiplyImageAndPosition(DeviceJ device, ArrayJ input, Arra * <pre>f(x, s) = x * s</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image to be multiplied with a constant. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @param scalar (float) - The number with which every pixel will be multiplied with. (default: 0) * @return {@link ArrayJ} + * @see reference_multiplyImageAndScalar * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ multiplyImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -1350,10 +1512,11 @@ public static ArrayJ multiplyImageAndScalar(DeviceJ device, ArrayJ input, ArrayJ * Multiplies all pairs of pixel values x and y from two image X and Y. * <pre>f(x, y) = x * y</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first input image to be multiplied. - * @param input1 ({@link ArrayJ}) - The second image to be multiplied. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param input0 ({@link ArrayJ}) - First input image to be multiplied. + * @param input1 ({@link ArrayJ}) - Second image to be multiplied. + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_multiplyImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ multiplyImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -1370,11 +1533,12 @@ public static ArrayJ multiplyImages(DeviceJ device, ArrayJ input0, ArrayJ input1 * It is recommended to specify those values. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @param nan (float) - Value to replace (default: 0) * @param posinf (float) - Value to replace +inf with. (default: np.nan_to_num(float('inf'))) * @param neginf (float) - Value to replace -inf with. (default: np.nan_to_num(float('-inf'))) * @return {@link ArrayJ} + * @see numpy.nan_to_num.html * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ nanToNum(DeviceJ device, ArrayJ input, ArrayJ output, float nan, float posinf, float neginf) { @@ -1393,6 +1557,7 @@ public static ArrayJ nanToNum(DeviceJ device, ArrayJ input, ArrayJ output, float * @param output0 ({@link ArrayJ}) - Output flag (0 or 1). * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_nonzeroMaximumBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1412,6 +1577,7 @@ public static ArrayJ nonzeroMaximumBox(DeviceJ device, ArrayJ input, ArrayJ outp * @param output0 ({@link ArrayJ}) - Output flag (0 or 1). * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_nonzeroMaximumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1433,6 +1599,8 @@ public static ArrayJ nonzeroMaximumDiamond(DeviceJ device, ArrayJ input, ArrayJ * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_nonzeroMaximumBox + * @see reference_nonzeroMaximumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ nonzeroMaximum(DeviceJ device, ArrayJ input, ArrayJ output0, ArrayJ output1, String connectivity) { @@ -1451,6 +1619,7 @@ public static ArrayJ nonzeroMaximum(DeviceJ device, ArrayJ input, ArrayJ output0 * @param output0 ({@link ArrayJ}) - Output flag (0 or 1). * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_nonzeroMinimumBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1470,6 +1639,7 @@ public static ArrayJ nonzeroMinimumBox(DeviceJ device, ArrayJ input, ArrayJ outp * @param output0 ({@link ArrayJ}) - Output flag (0 or 1). * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_nonzeroMinimumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1491,6 +1661,8 @@ public static ArrayJ nonzeroMinimumDiamond(DeviceJ device, ArrayJ input, ArrayJ * @param output1 ({@link ArrayJ}) - Output image where results are written into. (default: None) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_nonzeroMinimumBox + * @see reference_nonzeroMinimumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ nonzeroMinimum(DeviceJ device, ArrayJ input, ArrayJ output0, ArrayJ output1, String connectivity) { @@ -1503,10 +1675,11 @@ public static ArrayJ nonzeroMinimum(DeviceJ device, ArrayJ input, ArrayJ output0 * Determines if two images A and B equal pixel wise. * f(a, b) = 1 if a != b; 0 otherwise. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - The first image to be compared with. - * @param input1 ({@link ArrayJ}) - The second image to be compared with the first. + * @param input0 ({@link ArrayJ}) - First image to be compared with. + * @param input1 ({@link ArrayJ}) - Second image to be compared with the first. * @param output ({@link ArrayJ}) - The resulting binary image where pixels will be 1 only if source1 (default: None) * @return {@link ArrayJ} + * @see reference_notEqual * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ notEqual(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -1524,6 +1697,7 @@ public static ArrayJ notEqual(DeviceJ device, ArrayJ input0, ArrayJ input1, Arra * @param output ({@link ArrayJ}) - The resulting binary image where pixels will be 1 only if source1 (default: None) * @param scalar (float) - The constant where every pixel is compared to. (default: 0) * @return {@link ArrayJ} + * @see reference_notEqualConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ notEqualConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -1537,64 +1711,69 @@ public static ArrayJ notEqualConstant(DeviceJ device, ArrayJ input, ArrayJ outpu * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param index_x (int) - Origin pixel coodinate in x to paste. (default: 0) - * @param index_y (int) - Origin pixel coodinate in y to paste. (default: 0) - * @param index_z (int) - Origin pixel coodinate in z to paste. (default: 0) + * @param destination_x (int) - Origin pixel coodinate in x to paste. (default: 0) + * @param destination_y (int) - Origin pixel coodinate in y to paste. (default: 0) + * @param destination_z (int) - Origin pixel coodinate in z to paste. (default: 0) * @return {@link ArrayJ} + * @see reference_paste3D * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ paste(DeviceJ device, ArrayJ input, ArrayJ output, int index_x, int index_y, int index_z) { + public static ArrayJ paste(DeviceJ device, ArrayJ input, ArrayJ output, int destination_x, int destination_y, int destination_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.paste(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), index_x, index_y, index_z)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.paste(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), destination_x, destination_y, destination_z)); } /** * Apply a local maximum filter to an image which only overwrites pixels with value 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param output0 ({@link ArrayJ}) - Output flag value, 0 or 1. - * @param output1 ({@link ArrayJ}) - Output image. (default: None) + * @param flag ({@link ArrayJ}) - Output + * @param output ({@link ArrayJ}) - Output image. (default: None) * @return {@link ArrayJ} + * @see reference_onlyzeroOverwriteMaximumBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ onlyzeroOverwriteMaximumBox(DeviceJ device, ArrayJ input, ArrayJ output0, ArrayJ output1) { + public static ArrayJ onlyzeroOverwriteMaximumBox(DeviceJ device, ArrayJ input, ArrayJ flag, ArrayJ output) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum_box(device.getRaw(), input.getRaw(), output0.getRaw(), output1 == null ? null : output1.getRaw())); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum_box(device.getRaw(), input.getRaw(), flag.getRaw(), output == null ? null : output.getRaw())); } /** * Apply a local maximum filter to an image which only overwrites pixels with value 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param output0 ({@link ArrayJ}) - Output flag value, 0 or 1. - * @param output1 ({@link ArrayJ}) - Output image. (default: None) + * @param flag ({@link ArrayJ}) - Output + * @param output ({@link ArrayJ}) - Output image. (default: None) * @return {@link ArrayJ} + * @see reference_onlyzeroOverwriteMaximumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ onlyzeroOverwriteMaximumDiamond(DeviceJ device, ArrayJ input, ArrayJ output0, ArrayJ output1) { + public static ArrayJ onlyzeroOverwriteMaximumDiamond(DeviceJ device, ArrayJ input, ArrayJ flag, ArrayJ output) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum_diamond(device.getRaw(), input.getRaw(), output0.getRaw(), output1 == null ? null : output1.getRaw())); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum_diamond(device.getRaw(), input.getRaw(), flag.getRaw(), output == null ? null : output.getRaw())); } /** * Apply a local maximum filter to an image which only overwrites pixels with value 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param output0 ({@link ArrayJ}) - Output flag value, 0 or 1. - * @param output1 ({@link ArrayJ}) - Output image. (default: None) + * @param flag ({@link ArrayJ}) - Output + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_onlyzeroOverwriteMaximumBox + * @see reference_onlyzeroOverwriteMaximumDiamond * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ onlyzeroOverwriteMaximum(DeviceJ device, ArrayJ input, ArrayJ output0, ArrayJ output1, String connectivity) { + public static ArrayJ onlyzeroOverwriteMaximum(DeviceJ device, ArrayJ input, ArrayJ flag, ArrayJ output, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum(device.getRaw(), input.getRaw(), output0.getRaw(), output1 == null ? null : output1.getRaw(), connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.onlyzero_overwrite_maximum(device.getRaw(), input.getRaw(), flag.getRaw(), output == null ? null : output.getRaw(), connectivity)); } /** @@ -1605,6 +1784,7 @@ public static ArrayJ onlyzeroOverwriteMaximum(DeviceJ device, ArrayJ input, Arra * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Power value. (default: 1) * @return {@link ArrayJ} + * @see reference_power * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ power(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -1620,6 +1800,7 @@ public static ArrayJ power(DeviceJ device, ArrayJ input, ArrayJ output, float sc * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_powerImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ powerImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -1680,6 +1861,7 @@ public static ArrayJ readValuesFromPositions(DeviceJ device, ArrayJ input, Array * @param input1 ({@link ArrayJ}) - List of intensities to replace, as a vector of values. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_replaceIntensities * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ replaceValues(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -1694,15 +1876,16 @@ public static ArrayJ replaceValues(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param scalar0 (float) - Old value. (default: 0) - * @param scalar1 (float) - New value. (default: 1) + * @param value_to_replace (float) - Old value. (default: 0) + * @param value_replacement (float) - New value. (default: 1) * @return {@link ArrayJ} + * @see reference_replaceIntensity * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ replaceValue(DeviceJ device, ArrayJ input, ArrayJ output, float scalar0, float scalar1) { + public static ArrayJ replaceValue(DeviceJ device, ArrayJ input, ArrayJ output, float value_to_replace, float value_replacement) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.replace_value(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), scalar0, scalar1)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.replace_value(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), value_to_replace, value_replacement)); } /** @@ -1710,16 +1893,17 @@ public static ArrayJ replaceValue(DeviceJ device, ArrayJ input, ArrayJ output, f * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param scalar0 (float) - Old value. (default: 0) - * @param scalar1 (float) - New value. (default: 1) + * @param value_to_replace (float) - Old value. (default: 0) + * @param value_replacement (float) - New value. (default: 1) * @return {@link ArrayJ} + * @see reference_replaceIntensity * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ replaceIntensity(DeviceJ device, ArrayJ input, ArrayJ output, float scalar0, float scalar1) { + public static ArrayJ replaceIntensity(DeviceJ device, ArrayJ input, ArrayJ output, float value_to_replace, float value_replacement) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.replace_intensity(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), scalar0, scalar1)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.replace_intensity(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), value_to_replace, value_replacement)); } /** @@ -1732,6 +1916,7 @@ public static ArrayJ replaceIntensity(DeviceJ device, ArrayJ input, ArrayJ outpu * @param input1 ({@link ArrayJ}) - List of intensities to replace, as a vector of values. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_replaceIntensities * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1752,6 +1937,7 @@ public static ArrayJ replaceIntensities(DeviceJ device, ArrayJ input0, ArrayJ in * @param radius_y (float) - Radius size along y axis. (default: 1) * @param radius_z (float) - Radius size along z axis. (default: 0) * @return {@link ArrayJ} + * @see reference_maximum3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1771,6 +1957,7 @@ public static ArrayJ maximumSphere(DeviceJ device, ArrayJ input, ArrayJ output, * @param radius_y (float) - Radius size along y axis. (default: 1) * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_minimum3DSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -1784,17 +1971,18 @@ public static ArrayJ minimumSphere(DeviceJ device, ArrayJ input, ArrayJ output, * Multiplies two matrices with each other. * Shape of matrix1 should be equal to shape of matrix2 transposed. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - First input image to process. - * @param input1 ({@link ArrayJ}) - Second input image to process. - * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param matrix1 ({@link ArrayJ}) - First matrix to process. + * @param matrix2 ({@link ArrayJ}) - Second matrix to process. + * @param matrix_destination ({@link ArrayJ}) - Output result matrix. (default: None) * @return {@link ArrayJ} + * @see reference_multiplyMatrix * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ multiplyMatrix(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { + public static ArrayJ multiplyMatrix(DeviceJ device, ArrayJ matrix1, ArrayJ matrix2, ArrayJ matrix_destination) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input0, "input0 cannot be null"); - Objects.requireNonNull(input1, "input1 cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.multiply_matrix(device.getRaw(), input0.getRaw(), input1.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(matrix1, "matrix1 cannot be null"); + Objects.requireNonNull(matrix2, "matrix2 cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.multiply_matrix(device.getRaw(), matrix1.getRaw(), matrix2.getRaw(), matrix_destination == null ? null : matrix_destination.getRaw())); } /** @@ -1803,6 +1991,7 @@ public static ArrayJ multiplyMatrix(DeviceJ device, ArrayJ input0, ArrayJ input1 * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see numpy.reciprocal.html * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ reciprocal(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -1818,6 +2007,7 @@ public static ArrayJ reciprocal(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param scalar (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_set * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ set(DeviceJ device, ArrayJ input, float scalar) { @@ -1830,15 +2020,16 @@ public static ArrayJ set(DeviceJ device, ArrayJ input, float scalar) { * Sets all pixel values x of a given column in X to a constant value v. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param column (int) - Column index. (default: 0) + * @param column_index (int) - Column index. (default: 0) * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setColumn * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ setColumn(DeviceJ device, ArrayJ input, int column, float value) { + public static ArrayJ setColumn(DeviceJ device, ArrayJ input, int column_index, float value) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_column(device.getRaw(), input.getRaw(), column, value)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_column(device.getRaw(), input.getRaw(), column_index, value)); } /** @@ -1847,6 +2038,7 @@ public static ArrayJ setColumn(DeviceJ device, ArrayJ input, int column, float v * @param input ({@link ArrayJ}) - Input image to process. * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setImageBorders * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setImageBorders(DeviceJ device, ArrayJ input, float value) { @@ -1859,15 +2051,16 @@ public static ArrayJ setImageBorders(DeviceJ device, ArrayJ input, float value) * Sets all pixel values x of a given plane in X to a constant value v. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param plane (int) - Plane index. (default: 0) + * @param plane_index (int) - Plane index. (default: 0) * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setPlane * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ setPlane(DeviceJ device, ArrayJ input, int plane, float value) { + public static ArrayJ setPlane(DeviceJ device, ArrayJ input, int plane_index, float value) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_plane(device.getRaw(), input.getRaw(), plane, value)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_plane(device.getRaw(), input.getRaw(), plane_index, value)); } /** @@ -1875,6 +2068,7 @@ public static ArrayJ setPlane(DeviceJ device, ArrayJ input, int plane, float val * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @return {@link ArrayJ} + * @see reference_setRampX * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setRampX(DeviceJ device, ArrayJ input) { @@ -1888,6 +2082,7 @@ public static ArrayJ setRampX(DeviceJ device, ArrayJ input) { * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @return {@link ArrayJ} + * @see reference_setRampY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setRampY(DeviceJ device, ArrayJ input) { @@ -1901,6 +2096,7 @@ public static ArrayJ setRampY(DeviceJ device, ArrayJ input) { * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @return {@link ArrayJ} + * @see reference_setRampZ * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setRampZ(DeviceJ device, ArrayJ input) { @@ -1913,15 +2109,16 @@ public static ArrayJ setRampZ(DeviceJ device, ArrayJ input) { * Sets all pixel values x of a given row in X to a constant value v. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. - * @param row (int) - (default: 0) + * @param row_index (int) - (default: 0) * @param value (float) - (default: 0) * @return {@link ArrayJ} + * @see reference_setRow * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ setRow(DeviceJ device, ArrayJ input, int row, float value) { + public static ArrayJ setRow(DeviceJ device, ArrayJ input, int row_index, float value) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_row(device.getRaw(), input.getRaw(), row, value)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.set_row(device.getRaw(), input.getRaw(), row_index, value)); } /** @@ -1947,6 +2144,7 @@ public static ArrayJ setNonzeroPixelsToPixelindex(DeviceJ device, ArrayJ input, * @param input ({@link ArrayJ}) - Input image to process. * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setWhereXequalsY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setWhereXEqualsY(DeviceJ device, ArrayJ input, float value) { @@ -1963,6 +2161,7 @@ public static ArrayJ setWhereXEqualsY(DeviceJ device, ArrayJ input, float value) * @param input ({@link ArrayJ}) - Input image to process. * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setWhereXgreaterThanY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setWhereXGreaterThanY(DeviceJ device, ArrayJ input, float value) { @@ -1979,6 +2178,7 @@ public static ArrayJ setWhereXGreaterThanY(DeviceJ device, ArrayJ input, float v * @param input ({@link ArrayJ}) - Input image to process. * @param value (float) - Value to set. (default: 0) * @return {@link ArrayJ} + * @see reference_setWhereXsmallerThanY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ setWhereXSmallerThanY(DeviceJ device, ArrayJ input, float value) { @@ -2013,6 +2213,7 @@ public static ArrayJ sign(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_smaller * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ smaller(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -2030,6 +2231,7 @@ public static ArrayJ smaller(DeviceJ device, ArrayJ input0, ArrayJ input1, Array * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Scalar used in the comparison. (default: 0) * @return {@link ArrayJ} + * @see reference_smallerConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ smallerConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -2046,6 +2248,7 @@ public static ArrayJ smallerConstant(DeviceJ device, ArrayJ input, ArrayJ output * @param input1 ({@link ArrayJ}) - Second input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_smallerOrEqual * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ smallerOrEqual(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -2063,6 +2266,7 @@ public static ArrayJ smallerOrEqual(DeviceJ device, ArrayJ input0, ArrayJ input1 * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Scalar used in the comparison. (default: 0) * @return {@link ArrayJ} + * @see reference_smallerOrEqualConstant * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ smallerOrEqualConstant(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -2078,6 +2282,7 @@ public static ArrayJ smallerOrEqualConstant(DeviceJ device, ArrayJ input, ArrayJ * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_sobel * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ sobel(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2106,6 +2311,7 @@ public static ArrayJ squareRoot(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_standardDeviationZProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ stdZProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2122,6 +2328,7 @@ public static ArrayJ stdZProjection(DeviceJ device, ArrayJ input, ArrayJ output) * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param scalar (float) - Scalar used in the subtraction. (default: 0) * @return {@link ArrayJ} + * @see reference_subtractImageFromScalar * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ subtractImageFromScalar(DeviceJ device, ArrayJ input, ArrayJ output, float scalar) { @@ -2153,6 +2360,7 @@ public static ArrayJ sumReductionX(DeviceJ device, ArrayJ input, ArrayJ output, * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_sumXProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ sumXProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2167,6 +2375,7 @@ public static ArrayJ sumXProjection(DeviceJ device, ArrayJ input, ArrayJ output) * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_sumYProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ sumYProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2181,6 +2390,7 @@ public static ArrayJ sumYProjection(DeviceJ device, ArrayJ input, ArrayJ output) * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_sumZProjection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ sumZProjection(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2193,8 +2403,9 @@ public static ArrayJ sumZProjection(DeviceJ device, ArrayJ input, ArrayJ output) * Transpose X and Y axes of an image. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_transposeXY * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ transposeXy(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2207,8 +2418,9 @@ public static ArrayJ transposeXy(DeviceJ device, ArrayJ input, ArrayJ output) { * Transpose X and Z axes of an image. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_transposeXZ * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ transposeXz(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2221,8 +2433,9 @@ public static ArrayJ transposeXz(DeviceJ device, ArrayJ input, ArrayJ output) { * Transpose Y and Z axes of an image. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image. - * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) + * @param output ({@link ArrayJ}) - Output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_transposeYZ * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ transposeYz(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2237,6 +2450,7 @@ public static ArrayJ transposeYz(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_undefinedToZero * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ undefinedToZero(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -2252,14 +2466,15 @@ public static ArrayJ undefinedToZero(DeviceJ device, ArrayJ input, ArrayJ output * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_varianceBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ varianceBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ varianceBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.variance_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -2272,14 +2487,15 @@ public static ArrayJ varianceBox(DeviceJ device, ArrayJ input, ArrayJ output, in * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_varianceSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ varianceSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ varianceSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.variance_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -2292,17 +2508,19 @@ public static ArrayJ varianceSphere(DeviceJ device, ArrayJ input, ArrayJ output, * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius size along x axis. (default: 1) - * @param radius_y (int) - Radius size along y axis. (default: 1) - * @param radius_z (int) - Radius size along z axis. (default: 1) + * @param radius_x (float) - Radius size along x axis. (default: 1) + * @param radius_y (float) - Radius size along y axis. (default: 1) + * @param radius_z (float) - Radius size along z axis. (default: 1) * @param connectivity (String) - Filter neigborhood (default: "box") * @return {@link ArrayJ} + * @see reference_varianceBox + * @see reference_varianceSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ variance(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ varianceFilter(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.variance(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier1.variance_filter(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -2312,6 +2530,7 @@ public static ArrayJ variance(DeviceJ device, ArrayJ input, ArrayJ output, int r * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_writeValuesToPositions * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ writeValuesToPositions(DeviceJ device, ArrayJ input, ArrayJ output) { diff --git a/src/main/java/net/clesperanto/kernels/Tier2.java b/src/main/java/net/clesperanto/kernels/Tier2.java index 8142301..dac335c 100644 --- a/src/main/java/net/clesperanto/kernels/Tier2.java +++ b/src/main/java/net/clesperanto/kernels/Tier2.java @@ -25,6 +25,7 @@ public class Tier2 { * @param input1 ({@link ArrayJ}) - The input image which is subtracted. * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_absoluteDifference * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ absoluteDifference(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -42,6 +43,7 @@ public static ArrayJ absoluteDifference(DeviceJ device, ArrayJ input0, ArrayJ in * @param input1 ({@link ArrayJ}) - The second image to be added. * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) * @return {@link ArrayJ} + * @see reference_addImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ addImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -56,14 +58,15 @@ public static ArrayJ addImages(DeviceJ device, ArrayJ input0, ArrayJ input1, Arr * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image where the background is subtracted from. * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) - * @param radius_x (int) - Radius of the background determination region in X. (default: 1) - * @param radius_y (int) - Radius of the background determination region in Y. (default: 1) - * @param radius_z (int) - Radius of the background determination region in Z. (default: 1) + * @param radius_x (float) - Radius of the background determination region in X. (default: 1) + * @param radius_y (float) - Radius of the background determination region in Y. (default: 1) + * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @return {@link ArrayJ} + * @see reference_bottomHatBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ bottomHatBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ bottomHatBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.bottom_hat_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -78,6 +81,7 @@ public static ArrayJ bottomHatBox(DeviceJ device, ArrayJ input, ArrayJ output, i * @param radius_y (float) - Radius of the background determination region in Y. (default: 1) * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @return {@link ArrayJ} + * @see reference_bottomHatSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -97,6 +101,8 @@ public static ArrayJ bottomHatSphere(DeviceJ device, ArrayJ input, ArrayJ output * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} + * @see reference_bottomHatBox + * @see reference_bottomHatSphere * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ bottomHat(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { @@ -114,6 +120,7 @@ public static ArrayJ bottomHat(DeviceJ device, ArrayJ input, ArrayJ output, floa * @param min_intensity (float) - new, lower limit of the intensity range (default: None) * @param max_intensity (float) - new, upper limit of the intensity range (default: None) * @return {@link ArrayJ} + * @see numpy.clip.html * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ clip(DeviceJ device, ArrayJ input, ArrayJ output, float min_intensity, float max_intensity) { @@ -123,14 +130,14 @@ public static ArrayJ clip(DeviceJ device, ArrayJ input, ArrayJ output, float min } /** - * Closing operator, boxshaped Applies morphological closing to intensity images using a boxshaped footprint. + * Closing operator, applies grayscale morphological closing to intensity images using a box shaped footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (int) - Radius along the x axis. (default: 1) + * @param radius_y (int) - Radius along the y axis. (default: 1) + * @param radius_z (int) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -142,41 +149,77 @@ public static ArrayJ closingBox(DeviceJ device, ArrayJ input, ArrayJ output, int } /** - * Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. + * Closing operator, applies grayscale morphological closing to intensity images using a sphere shaped footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 1) - * @param radius_y (int) - Radius along the y axis. (default: 1) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ closingSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ closingSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.closing_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); } /** - * Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. + * Closing operator, applies grayscale morphological closing to intensity images using a sphere or box shaped footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 1) - * @param radius_y (int) - Radius along the y axis. (default: 1) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ closing(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ grayscaleClosing(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.closing(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.grayscale_closing(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + } + + /** + * Closing operator, applies morphological closing to intensity images using a custom structuring element provided as input. + * This operator also works with binary images. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param footprint ({@link ArrayJ}) - Structuring element for the operation. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @return {@link ArrayJ} + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ closing(DeviceJ device, ArrayJ input, ArrayJ footprint, ArrayJ output) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(footprint, "footprint cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.closing(device.getRaw(), input.getRaw(), footprint.getRaw(), output == null ? null : output.getRaw())); + } + + /** + * Closing operator, applies binary morphological closing to intensity images using a sphere or box shaped footprint. + * This operator also works with binary images. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param radius_x (float) - Radius of the sphere or box element along the x axis. (default: 1) + * @param radius_y (float) - Radius of the sphere or box element along the y axis. (default: 1) + * @param radius_z (float) - Radius of the sphere or box element along the z axis. (default: 1) + * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") + * @return {@link ArrayJ} + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ binaryClosing(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.binary_closing(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -186,6 +229,7 @@ public static ArrayJ closing(DeviceJ device, ArrayJ input, ArrayJ output, int ra * @param input1 ({@link ArrayJ}) - Second input image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_combineHorizontally * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ concatenateAlongX(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -202,6 +246,7 @@ public static ArrayJ concatenateAlongX(DeviceJ device, ArrayJ input0, ArrayJ inp * @param input1 ({@link ArrayJ}) - Second input image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_combineVertically * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ concatenateAlongY(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -218,6 +263,7 @@ public static ArrayJ concatenateAlongY(DeviceJ device, ArrayJ input0, ArrayJ inp * @param input1 ({@link ArrayJ}) - Second input image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_concatenateStacks * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ concatenateAlongZ(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -233,16 +279,17 @@ public static ArrayJ concatenateAlongZ(DeviceJ device, ArrayJ input0, ArrayJ inp * To ignore touches with background, hand over a touch matrix where the first column (index = 0) has been set to 0. * Use set_column for that. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input image to process. - * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param touch_matrix ({@link ArrayJ}) - Input touch matrix to process. + * @param touching_neighbors_count_destination ({@link ArrayJ}) - Output vector of touch count. (default: None) * @param ignore_background (boolean) - (default: True) * @return {@link ArrayJ} + * @see reference_countTouchingNeighbors * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ countTouchingNeighbors(DeviceJ device, ArrayJ input, ArrayJ output, boolean ignore_background) { + public static ArrayJ countTouchingNeighbors(DeviceJ device, ArrayJ touch_matrix, ArrayJ touching_neighbors_count_destination, boolean ignore_background) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.count_touching_neighbors(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), ignore_background)); + Objects.requireNonNull(touch_matrix, "touch_matrix cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.count_touching_neighbors(device.getRaw(), touch_matrix.getRaw(), touching_neighbors_count_destination == null ? null : touching_neighbors_count_destination.getRaw(), ignore_background)); } /** @@ -270,6 +317,7 @@ public static ArrayJ cropBorder(DeviceJ device, ArrayJ input, ArrayJ output, int * @param sigma_y (float) - Gaussian sigma value along y. (default: 2) * @param sigma_z (float) - Gaussian sigma value along z. (default: 2) * @return {@link ArrayJ} + * @see reference_divideByGaussianBackground * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ divideByGaussianBackground(DeviceJ device, ArrayJ input, ArrayJ output, float sigma_x, float sigma_y, float sigma_z) { @@ -298,14 +346,15 @@ public static ArrayJ degreesToRadians(DeviceJ device, ArrayJ input, ArrayJ outpu * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 0) + * @param radius_y (float) - Radius along the y axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 0) * @return {@link ArrayJ} + * @see reference_detectMaximaBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ detectMaximaBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ detectMaximaBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.detect_maxima_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -317,14 +366,16 @@ public static ArrayJ detectMaximaBox(DeviceJ device, ArrayJ input, ArrayJ output * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 0) + * @param radius_y (float) - Radius along the y axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 0) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} + * @see reference_detectMaximaBox + * @see reference_detectMaximaSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ detectMaxima(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ detectMaxima(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.detect_maxima(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); @@ -336,14 +387,15 @@ public static ArrayJ detectMaxima(DeviceJ device, ArrayJ input, ArrayJ output, i * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 0) + * @param radius_y (float) - Radius along the y axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 0) * @return {@link ArrayJ} + * @see reference_detectMinimaBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ detectMinimaBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ detectMinimaBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.detect_minima_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -355,14 +407,16 @@ public static ArrayJ detectMinimaBox(DeviceJ device, ArrayJ input, ArrayJ output * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 0) + * @param radius_y (float) - Radius along the y axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 0) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} + * @see reference_detectMinimaBox + * @see reference_detectMinimaSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ detectMinima(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ detectMinima(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.detect_minima(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); @@ -381,6 +435,7 @@ public static ArrayJ detectMinima(DeviceJ device, ArrayJ input, ArrayJ output, i * @param sigma2_y (float) - Sigma of the second Gaussian filter in y (default: 2) * @param sigma2_z (float) - Sigma of the second Gaussian filter in z (default: 2) * @return {@link ArrayJ} + * @see reference_differenceOfGaussian3D * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ differenceOfGaussian(DeviceJ device, ArrayJ input, ArrayJ output, float sigma1_x, float sigma1_y, float sigma1_z, float sigma2_x, float sigma2_y, float sigma2_z) { @@ -396,6 +451,7 @@ public static ArrayJ differenceOfGaussian(DeviceJ device, ArrayJ input, ArrayJ o * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_extendLabelingViaVoronoi * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ extendLabelingViaVoronoi(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -412,6 +468,7 @@ public static ArrayJ extendLabelingViaVoronoi(DeviceJ device, ArrayJ input, Arra * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_invert * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ invert(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -428,6 +485,7 @@ public static ArrayJ invert(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_labelSpots * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ labelSpots(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -456,6 +514,7 @@ public static ArrayJ largeHessianEigenvalue(DeviceJ device, ArrayJ input, ArrayJ * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @return float + * @see reference_maximumOfAllPixels * @throws NullPointerException if any of the device or input parameters are null. */ public static float maximumOfAllPixels(DeviceJ device, ArrayJ input) { @@ -470,6 +529,7 @@ public static float maximumOfAllPixels(DeviceJ device, ArrayJ input) { * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @return float + * @see reference_minimumOfAllPixels * @throws NullPointerException if any of the device or input parameters are null. */ public static float minimumOfAllPixels(DeviceJ device, ArrayJ input) { @@ -485,6 +545,7 @@ public static float minimumOfAllPixels(DeviceJ device, ArrayJ input) { * @param input ({@link ArrayJ}) - Input image to process. * @param mask ({@link ArrayJ}) - Input * @return float + * @see reference_minimumOfMaskedPixels * @throws NullPointerException if any of the device or input parameters are null. */ public static float minimumOfMaskedPixels(DeviceJ device, ArrayJ input, ArrayJ mask) { @@ -495,33 +556,33 @@ public static float minimumOfMaskedPixels(DeviceJ device, ArrayJ input, ArrayJ m } /** - * Opening operator, boxshaped Applies morphological opening to intensity images using a boxshaped footprint. + * Opening operator, applies morphological opening to intensity images using a boxshaped footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 0) - * @param radius_y (int) - Radius along the y axis. (default: 0) - * @param radius_z (int) - Radius along the z axis. (default: 0) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ openingBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ openingBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.opening_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); } /** - * Opening operator, sphereshaped Applies morphological opening to intensity images using a sphereshaped footprint. + * Opening operator, applies morphological opening to intensity images using a sphereshaped footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param radius_x (float) - Radius along the x axis. (default: 1) * @param radius_y (float) - Radius along the y axis. (default: 1) - * @param radius_z (float) - Radius along the z axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -533,22 +594,58 @@ public static ArrayJ openingSphere(DeviceJ device, ArrayJ input, ArrayJ output, } /** - * Opening operator, sphereshaped Applies morphological opening to intensity images using a sphereshaped footprint. + * Opening operator, Applies morphological opening to intensity images using a sphereshaped or boxshepd footprint. * This operator also works with binary images. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @param radius_x (float) - Radius along the x axis. (default: 1) * @param radius_y (float) - Radius along the y axis. (default: 1) - * @param radius_z (float) - Radius along the z axis. (default: 0) + * @param radius_z (float) - Radius along the z axis. (default: 1) + * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") + * @return {@link ArrayJ} + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ grayscaleOpening(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.grayscale_opening(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + } + + /** + * Opening operator, applies morphological opening to intensity images using a custom structuring element provided as input. + * This operator also works with binary images. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param footprint ({@link ArrayJ}) - Structuring element for the operation. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @return {@link ArrayJ} + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ opening(DeviceJ device, ArrayJ input, ArrayJ footprint, ArrayJ output) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(footprint, "footprint cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.opening(device.getRaw(), input.getRaw(), footprint.getRaw(), output == null ? null : output.getRaw())); + } + + /** + * Closing operator, applies binary morphological opening to intensity images using a sphere or box shaped footprint. + * This operator also works with binary images. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - Input image to process. + * @param output ({@link ArrayJ}) - Output result image. (default: None) + * @param radius_x (float) - Radius of the sphere or box element along the x axis. (default: 1) + * @param radius_y (float) - Radius of the sphere or box element along the y axis. (default: 1) + * @param radius_z (float) - Radius of the sphere or box element along the z axis. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ opening(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { + public static ArrayJ binaryOpening(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.opening(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.binary_opening(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); } /** @@ -572,6 +669,7 @@ public static ArrayJ radiansToDegrees(DeviceJ device, ArrayJ input, ArrayJ outpu * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_reduceLabelsToLabelEdges * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ reduceLabelsToLabelEdges(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -601,6 +699,7 @@ public static ArrayJ smallHessianEigenvalue(DeviceJ device, ArrayJ input, ArrayJ * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see numpy.square.html * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ square(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -616,6 +715,7 @@ public static ArrayJ square(DeviceJ device, ArrayJ input, ArrayJ output) { * @param input1 ({@link ArrayJ}) - Second input image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_squaredDifference * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ squaredDifference(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -632,14 +732,15 @@ public static ArrayJ squaredDifference(DeviceJ device, ArrayJ input0, ArrayJ inp * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 1) - * @param radius_y (int) - Radius along the y axis. (default: 1) - * @param radius_z (int) - Radius along the z axis. (default: 1) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_standardDeviationBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ standardDeviationBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ standardDeviationBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.standard_deviation_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -652,14 +753,15 @@ public static ArrayJ standardDeviationBox(DeviceJ device, ArrayJ input, ArrayJ o * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 1) - * @param radius_y (int) - Radius along the y axis. (default: 1) - * @param radius_z (int) - Radius along the z axis. (default: 1) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @return {@link ArrayJ} + * @see reference_standardDeviationSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ standardDeviationSphere(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ standardDeviationSphere(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.standard_deviation_sphere(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -672,14 +774,16 @@ public static ArrayJ standardDeviationSphere(DeviceJ device, ArrayJ input, Array * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. * @param output ({@link ArrayJ}) - Output result image. (default: None) - * @param radius_x (int) - Radius along the x axis. (default: 1) - * @param radius_y (int) - Radius along the y axis. (default: 1) - * @param radius_z (int) - Radius along the z axis. (default: 1) + * @param radius_x (float) - Radius along the x axis. (default: 1) + * @param radius_y (float) - Radius along the y axis. (default: 1) + * @param radius_z (float) - Radius along the z axis. (default: 1) * @param connectivity (String) - Neigborhood shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} + * @see reference_standardDeviationBox + * @see reference_standardDeviationSphere * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ standardDeviation(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z, String connectivity) { + public static ArrayJ standardDeviation(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.standard_deviation(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z, connectivity)); @@ -694,6 +798,7 @@ public static ArrayJ standardDeviation(DeviceJ device, ArrayJ input, ArrayJ outp * @param sigma_y (float) - Radius along the y axis. (default: 2) * @param sigma_z (float) - Radius along the z axis. (default: 2) * @return {@link ArrayJ} + * @see reference_subtractGaussianBackground * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ subtractGaussianBackground(DeviceJ device, ArrayJ input, ArrayJ output, float sigma_x, float sigma_y, float sigma_z) { @@ -710,6 +815,7 @@ public static ArrayJ subtractGaussianBackground(DeviceJ device, ArrayJ input, Ar * @param input1 ({@link ArrayJ}) - Second input image. * @param output ({@link ArrayJ}) - Output result image. (default: None) * @return {@link ArrayJ} + * @see reference_subtractImages * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ subtractImages(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -727,6 +833,7 @@ public static ArrayJ subtractImages(DeviceJ device, ArrayJ input0, ArrayJ input1 * @param start_z (int) - Start z coordinate of the crop. (default: 0) * @param end_z (int) - End z coordinate of the crop. (default: 0) * @return {@link ArrayJ} + * @see reference_subStack * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ subStack(DeviceJ device, ArrayJ input, ArrayJ output, int start_z, int end_z) { @@ -747,6 +854,7 @@ public static ArrayJ subStack(DeviceJ device, ArrayJ input, ArrayJ output, int s * @param reduction_factor (int) - Reduction factor. (default: 2) * @param offset (int) - Offset. (default: 0) * @return {@link ArrayJ} + * @see reference_reduceStack * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ reduceStack(DeviceJ device, ArrayJ input, ArrayJ output, int reduction_factor, int offset) { @@ -761,6 +869,7 @@ public static ArrayJ reduceStack(DeviceJ device, ArrayJ input, ArrayJ output, in * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Input image to process. (default: None) * @return float + * @see reference_sumOfAllPixels * @throws NullPointerException if any of the device or input parameters are null. */ public static float sumOfAllPixels(DeviceJ device, ArrayJ input) { @@ -774,14 +883,15 @@ public static float sumOfAllPixels(DeviceJ device, ArrayJ input) { * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The input image where the background is subtracted from. * @param output ({@link ArrayJ}) - The output image where results are written into. (default: None) - * @param radius_x (int) - Radius of the background determination region in X. (default: 1) - * @param radius_y (int) - Radius of the background determination region in Y. (default: 1) - * @param radius_z (int) - Radius of the background determination region in Z. (default: 1) + * @param radius_x (float) - Radius of the background determination region in X. (default: 1) + * @param radius_y (float) - Radius of the background determination region in Y. (default: 1) + * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @return {@link ArrayJ} + * @see reference_topHatBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ topHatBox(DeviceJ device, ArrayJ input, ArrayJ output, int radius_x, int radius_y, int radius_z) { + public static ArrayJ topHatBox(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); return new ArrayJ(net.clesperanto._internals.kernelj.Tier2.top_hat_box(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), radius_x, radius_y, radius_z)); @@ -796,6 +906,7 @@ public static ArrayJ topHatBox(DeviceJ device, ArrayJ input, ArrayJ output, int * @param radius_y (float) - Radius of the background determination region in Y. (default: 1) * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @return {@link ArrayJ} + * @see reference_topHatSphere * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -815,6 +926,8 @@ public static ArrayJ topHatSphere(DeviceJ device, ArrayJ input, ArrayJ output, f * @param radius_z (float) - Radius of the background determination region in Z. (default: 1) * @param connectivity (String) - Element shape, "box" or "sphere" (default: "box") * @return {@link ArrayJ} + * @see reference_topHatBox + * @see reference_topHatSphere * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ topHat(DeviceJ device, ArrayJ input, ArrayJ output, float radius_x, float radius_y, float radius_z, String connectivity) { diff --git a/src/main/java/net/clesperanto/kernels/Tier3.java b/src/main/java/net/clesperanto/kernels/Tier3.java index dfdb82e..f5d88d2 100644 --- a/src/main/java/net/clesperanto/kernels/Tier3.java +++ b/src/main/java/net/clesperanto/kernels/Tier3.java @@ -21,8 +21,9 @@ public class Tier3 { * Determines the bounding box of all nonzero pixels in a binary image. * The positions are returned in an array of 6 values as follows: minX, minY, minZ, maxX, maxY, maxZ. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - + * @param input ({@link ArrayJ}) - Input binary image * @return ArrayList<Float> + * @see reference_boundingBox * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayList boundingBox(DeviceJ device, ArrayJ input) { @@ -35,8 +36,9 @@ public static ArrayList boundingBox(DeviceJ device, ArrayJ input) { * Determines the center of mass of an image or image stack. * It writes the result in the results table in the columns MassX, MassY and MassZ. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - + * @param input ({@link ArrayJ}) - Input image * @return ArrayList<Float> + * @see reference_centerOfMass * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayList centerOfMass(DeviceJ device, ArrayJ input) { @@ -51,10 +53,11 @@ public static ArrayList centerOfMass(DeviceJ device, ArrayJ input) { * For example if you pass 0,1,0,0,1: Labels 1 and 4 will be removed (those with a 1 in the vector will be excluded). * Labels 2 and 3 will be kept and renumbered to 1 and 2. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param list ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param list ({@link ArrayJ}) - Vector of 0 and 1 flagging labels to remove + * @param output ({@link ArrayJ}) - Output label image (default: None) * @return {@link ArrayJ} + * @see reference_excludeLabels * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeLabels(DeviceJ device, ArrayJ input, ArrayJ list, ArrayJ output) { @@ -70,10 +73,11 @@ public static ArrayJ removeLabels(DeviceJ device, ArrayJ input, ArrayJ list, Arr * For example if you pass 0,1,0,0,1: Labels 1 and 4 will be removed (those with a 1 in the vector will be excluded). * Labels 2 and 3 will be kept and renumbered to 1 and 2. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param list ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param list ({@link ArrayJ}) - Vector of 0 and 1 flagging labels to remove + * @param output ({@link ArrayJ}) - Output label image (default: None) * @return {@link ArrayJ} + * @see reference_excludeLabels * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ excludeLabels(DeviceJ device, ArrayJ input, ArrayJ list, ArrayJ output) { @@ -87,12 +91,13 @@ public static ArrayJ excludeLabels(DeviceJ device, ArrayJ input, ArrayJ list, Ar * Removes all labels from a label map which touch the edges of the image. * Remaining label elements are renumbered afterwards. * @param device ({@link DeviceJ}) - Device to perform the operation on. (default: None) - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param output ({@link ArrayJ}) - Output label image (default: None) * @param exclude_x (boolean) - Exclude labels along min and max x (default: True) * @param exclude_y (boolean) - Exclude labels along min and max y (default: True) * @param exclude_z (boolean) - Exclude labels along min and max z (default: True) * @return {@link ArrayJ} + * @see reference_excludeLabelsOnEdges * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeLabelsOnEdges(DeviceJ device, ArrayJ input, ArrayJ output, boolean exclude_x, boolean exclude_y, boolean exclude_z) { @@ -105,12 +110,13 @@ public static ArrayJ removeLabelsOnEdges(DeviceJ device, ArrayJ input, ArrayJ ou * Removes all labels from a label map which touch the edges of the image. * Remaining label elements are renumbered afterwards. * @param device ({@link DeviceJ}) - Device to perform the operation on. (default: None) - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param output ({@link ArrayJ}) - Output label image (default: None) * @param exclude_x (boolean) - Exclude labels along min and max x (default: True) * @param exclude_y (boolean) - Exclude labels along min and max y (default: True) * @param exclude_z (boolean) - Exclude labels along min and max z (default: True) * @return {@link ArrayJ} + * @see reference_excludeLabelsOnEdges * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ excludeLabelsOnEdges(DeviceJ device, ArrayJ input, ArrayJ output, boolean exclude_x, boolean exclude_y, boolean exclude_z) { @@ -138,10 +144,11 @@ public static ArrayJ flagExistingLabels(DeviceJ device, ArrayJ input, ArrayJ out * Applies a gamma correction to an image. * Therefore, all pixels x of the Image X are normalized and the power to gamma g is computed, before normlization is reversed (^ is the power operator):f(x) = (x / max(X)) ^ gamma * max(X). * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input image + * @param output ({@link ArrayJ}) - Output image (default: None) * @param gamma (float) - (default: 1) * @return {@link ArrayJ} + * @see reference_gammaCorrection * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gammaCorrection(DeviceJ device, ArrayJ input, ArrayJ output, float gamma) { @@ -154,10 +161,11 @@ public static ArrayJ gammaCorrection(DeviceJ device, ArrayJ input, ArrayJ output * Takes two labelmaps with n and m labels and generates a (n+1)*(m+1) matrix where all pixels are set to 0 exept those where labels overlap between the label maps. * For example, if labels 3 in labelmap1 and 4 in labelmap2 are touching then the pixel (3,4) in the matrix will be set to 1. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - - * @param input1 ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input0 ({@link ArrayJ}) - First input label image + * @param input1 ({@link ArrayJ}) - Second input label image + * @param output ({@link ArrayJ}) - Output overlap matrix (default: None) * @return {@link ArrayJ} + * @see reference_generateBinaryOverlapMatrix * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ generateBinaryOverlapMatrix(DeviceJ device, ArrayJ input0, ArrayJ input1, ArrayJ output) { @@ -173,9 +181,10 @@ public static ArrayJ generateBinaryOverlapMatrix(DeviceJ device, ArrayJ input0, * For example, if labels 3 and 4 are touching then the pixel (3,4) in the matrix will be set to 1. * The touch matrix is a representation of a region adjacency graph. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param output ({@link ArrayJ}) - Output touch matrix (default: None) * @return {@link ArrayJ} + * @see reference_generateTouchMatrix * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ generateTouchMatrix(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -201,18 +210,19 @@ public static ArrayJ generateTouchMatrix(DeviceJ device, ArrayJ input, ArrayJ ou * openclprogrammingguide. * com. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) - * @param nbins (int) - (default: 256) - * @param min (float) - (default: None) - * @param max (float) - (default: None) + * @param input ({@link ArrayJ}) - Input image to derive histogram from + * @param output ({@link ArrayJ}) - Output histogram (default: None) + * @param num_bins (int) - (default: 256) + * @param minimum_intensity (float) - (default: None) + * @param maximum_intensity (float) - (default: None) * @return {@link ArrayJ} + * @see reference_histogram * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ histogram(DeviceJ device, ArrayJ input, ArrayJ output, int nbins, float min, float max) { + public static ArrayJ histogram(DeviceJ device, ArrayJ input, ArrayJ output, int num_bins, float minimum_intensity, float maximum_intensity) { Objects.requireNonNull(device, "device cannot be null"); Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier3.histogram(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), nbins, min, max)); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier3.histogram(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), num_bins, minimum_intensity, maximum_intensity)); } /** @@ -221,9 +231,10 @@ public static ArrayJ histogram(DeviceJ device, ArrayJ input, ArrayJ output, int * The resulting Jaccard index is saved to the results table in the 'Jaccard_Index' column. * Note that the SorensenDice coefficient can be calculated from the Jaccard index j using this formula: <pre>s = f(j) = 2 j / (j + 1)</pre>. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - - * @param input1 ({@link ArrayJ}) - + * @param input0 ({@link ArrayJ}) - First binary image to compare + * @param input1 ({@link ArrayJ}) - Second binary image to compare * @return float + * @see reference_jaccardIndex * @throws NullPointerException if any of the device or input parameters are null. */ public static float jaccardIndex(DeviceJ device, ArrayJ input0, ArrayJ input1) { @@ -238,15 +249,16 @@ public static float jaccardIndex(DeviceJ device, ArrayJ input0, ArrayJ input1) { * Transforms a labelmap of spots (single pixels with values 1, 2,. * , n for n spots) as resulting from connected components analysis in an image where every column contains d pixels (with d = dimensionality of the original image) with the coordinates of the maxima/minima. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param label ({@link ArrayJ}) - Input + * @param pointlist ({@link ArrayJ}) - Output coordinate list (default: None) * @return {@link ArrayJ} + * @see reference_labelledSpotsToPointList * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ labelledSpotsToPointlist(DeviceJ device, ArrayJ input, ArrayJ output) { + public static ArrayJ labelledSpotsToPointlist(DeviceJ device, ArrayJ label, ArrayJ pointlist) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier3.labelled_spots_to_pointlist(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(label, "label cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier3.labelled_spots_to_pointlist(device.getRaw(), label.getRaw(), pointlist == null ? null : pointlist.getRaw())); } /** @@ -267,6 +279,7 @@ public static ArrayList maximumPosition(DeviceJ device, ArrayJ input) { * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - The image of which the mean average of all pixels will be determined. * @return float + * @see reference_meanOfAllPixels * @throws NullPointerException if any of the device or input parameters are null. */ public static float meanOfAllPixels(DeviceJ device, ArrayJ input) { @@ -310,32 +323,34 @@ public static ArrayJ morphologicalChanVese(DeviceJ device, ArrayJ input, ArrayJ /** * Compute the bounding box, area (in pixels/voxels), minimum intensity, maximum intensity, average intensity, standard deviation of the intensity, and some shape descriptors of labelled objects in a label image and its corresponding intensity image. - * The intensity image is optional and set to 0 if not provided. + * The intensity image is equal to the label image if not provided. + * The label image is set to the entire image if not provided. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param label ({@link ArrayJ}) - Label image to compute the statistics. * @param intensity ({@link ArrayJ}) - Intensity image. (default: None) + * @param label ({@link ArrayJ}) - Label image to compute the statistics. (default: None) * @return StatisticsMap + * @see reference_statisticsOfLabelledPixels * @throws NullPointerException if any of the device or input parameters are null. */ - public static HashMap> statisticsOfLabelledPixels(DeviceJ device, ArrayJ label, ArrayJ intensity) { + public static HashMap> statisticsOfLabelledPixels(DeviceJ device, ArrayJ intensity, ArrayJ label) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(label, "label cannot be null"); - return Utils.toHashMap(net.clesperanto._internals.kernelj.Tier3.statistics_of_labelled_pixels(device.getRaw(), label.getRaw(), intensity == null ? null : intensity.getRaw())); + return Utils.toHashMap(net.clesperanto._internals.kernelj.Tier3.statistics_of_labelled_pixels(device.getRaw(), intensity == null ? null : intensity.getRaw(), label == null ? null : label.getRaw())); } /** * Compute, for the background and labels, the bounding box, area (in pixels/voxels), minimum intensity, maximum intensity, average intensity, standard deviation of the intensity, and some shape descriptors of labelled objects in a label image and its corresponding intensity image. - * The intensity image is optional and set to 0 if not provided. + * The intensity image is equal to the label image if not provided. + * The label image is set to the entire image if not provided. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param label ({@link ArrayJ}) - Label image to compute the statistics. * @param intensity ({@link ArrayJ}) - Intensity image. (default: None) + * @param label ({@link ArrayJ}) - Label image to compute the statistics. (default: None) * @return StatisticsMap + * @see reference_statisticsOfBackgroundAndLabelledPixels * @throws NullPointerException if any of the device or input parameters are null. */ - public static HashMap> statisticsOfBackgroundAndLabelledPixels(DeviceJ device, ArrayJ label, ArrayJ intensity) { + public static HashMap> statisticsOfBackgroundAndLabelledPixels(DeviceJ device, ArrayJ intensity, ArrayJ label) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(label, "label cannot be null"); - return Utils.toHashMap(net.clesperanto._internals.kernelj.Tier3.statistics_of_background_and_labelled_pixels(device.getRaw(), label.getRaw(), intensity == null ? null : intensity.getRaw())); + return Utils.toHashMap(net.clesperanto._internals.kernelj.Tier3.statistics_of_background_and_labelled_pixels(device.getRaw(), intensity == null ? null : intensity.getRaw(), label == null ? null : label.getRaw())); } } diff --git a/src/main/java/net/clesperanto/kernels/Tier4.java b/src/main/java/net/clesperanto/kernels/Tier4.java index 1bcebd9..39a88b8 100644 --- a/src/main/java/net/clesperanto/kernels/Tier4.java +++ b/src/main/java/net/clesperanto/kernels/Tier4.java @@ -21,9 +21,10 @@ public class Tier4 { * Determines the bounding box of the specified label from a label image. * The positions are returned in an array of 6 values as follows: minX, minY, minZ, maxX, maxY, maxZ. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param label_id (int) - + * @param input ({@link ArrayJ}) - Label image + * @param label_id (int) - Identifier of label * @return ArrayList<Float> + * @see reference_boundingBox * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayList labelBoundingBox(DeviceJ device, ArrayJ input, int label_id) { @@ -36,9 +37,10 @@ public static ArrayList labelBoundingBox(DeviceJ device, ArrayJ input, in * Determines the mean squared error (MSE) between two images. * The MSE will be stored in a new row of ImageJs Results table in the column 'MSE'. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - - * @param input1 ({@link ArrayJ}) - + * @param input0 ({@link ArrayJ}) - First image to compare + * @param input1 ({@link ArrayJ}) - Second image to compare * @return float + * @see reference_meanSquaredError * @throws NullPointerException if any of the device or input parameters are null. */ public static float meanSquaredError(DeviceJ device, ArrayJ input0, ArrayJ input1) { @@ -51,9 +53,10 @@ public static float meanSquaredError(DeviceJ device, ArrayJ input0, ArrayJ input /** * Transforms a spots image as resulting from maximum/minimum detection in an image where every column contains d pixels (with d = dimensionality of the original image) with the coordinates of the maxima/minima. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input binary image of spots + * @param output ({@link ArrayJ}) - Output coordinate list of spots (default: None) * @return {@link ArrayJ} + * @see reference_spotsToPointList * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ spotsToPointlist(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -69,10 +72,11 @@ public static ArrayJ spotsToPointlist(DeviceJ device, ArrayJ input, ArrayJ outpu * Thus, afterwards number of labels and maximum label index are equal. * This operation is mostly performed on the CPU. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Label image. + * @param input ({@link ArrayJ}) - Input label image. * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param blocksize (int) - Renumbering is done in blocks for performance reasons. (default: 4096) * @return {@link ArrayJ} + * @see reference_closeIndexGapsInLabelMap * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ relabelSequential(DeviceJ device, ArrayJ input, ArrayJ output, int blocksize) { @@ -87,6 +91,9 @@ public static ArrayJ relabelSequential(DeviceJ device, ArrayJ input, ArrayJ outp * @param input ({@link ArrayJ}) - Input image to threshold. * @param output ({@link ArrayJ}) - Output binary image. (default: None) * @return {@link ArrayJ} + * @see reference_thresholdOtsu + * @see skimage.filters.html#skimage.filters.threshold_otsu + * @see 4310076 * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ thresholdOtsu(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -95,6 +102,24 @@ public static ArrayJ thresholdOtsu(DeviceJ device, ArrayJ input, ArrayJ output) return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.threshold_otsu(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw())); } + /** + * Takes an image and a corresponding label map, determines the mean intensity per label and replaces every label with the that number. + * This results in a parametric image expressing mean object intensity. + * @param device ({@link DeviceJ}) - Device to perform the operation on. + * @param input ({@link ArrayJ}) - intensity image + * @param labels ({@link ArrayJ}) - label image + * @param output ({@link ArrayJ}) - Parametric image computed (default: None) + * @return {@link ArrayJ} + * @see reference_meanIntensityMap + * @throws NullPointerException if any of the device or input parameters are null. + */ + public static ArrayJ meanIntensityMap(DeviceJ device, ArrayJ input, ArrayJ labels, ArrayJ output) { + Objects.requireNonNull(device, "device cannot be null"); + Objects.requireNonNull(input, "input cannot be null"); + Objects.requireNonNull(labels, "labels cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.mean_intensity_map(device.getRaw(), input.getRaw(), labels.getRaw(), output == null ? null : output.getRaw())); + } + /** * Takes a label map, determines the number of pixels per label and replaces every label with the that number. * This results in a parametric image expressing area or volume. @@ -102,6 +127,7 @@ public static ArrayJ thresholdOtsu(DeviceJ device, ArrayJ input, ArrayJ output) * @param input ({@link ArrayJ}) - Label image to measure * @param output ({@link ArrayJ}) - Parametric image computed (default: None) * @return {@link ArrayJ} + * @see reference_pixelCountMap * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ pixelCountMap(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -117,6 +143,7 @@ public static ArrayJ pixelCountMap(DeviceJ device, ArrayJ input, ArrayJ output) * @param input ({@link ArrayJ}) - Label image to measure * @param output ({@link ArrayJ}) - Parametric image computed (default: None) * @return {@link ArrayJ} + * @see reference_pixelCountMap * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -130,16 +157,17 @@ public static ArrayJ labelPixelCountMap(DeviceJ device, ArrayJ input, ArrayJ out * Determines the centroids of all labels in a label image or image stack. * It writes the resulting coordinates in point list image of dimensions n * d where n is the number of labels and d=3 the dimensionality (x,y,z) of the original image. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Label image where the centroids will be determined from. - * @param output ({@link ArrayJ}) - Output image where the centroids will be written to. (default: None) - * @param withBG (boolean) - Determines if the background label should be included. (default: False) + * @param label_image ({@link ArrayJ}) - Label image where the centroids will be determined from. + * @param centroids_coordinates ({@link ArrayJ}) - Output list of coordinates where the centroids will be written to. + * @param include_background (boolean) - Determines if the background label should be included. (default: False) * @return {@link ArrayJ} + * @see reference_centroidsOfLabels * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ centroidsOfLabels(DeviceJ device, ArrayJ input, ArrayJ output, boolean withBG) { + public static ArrayJ centroidsOfLabels(DeviceJ device, ArrayJ label_image, ArrayJ centroids_coordinates, boolean include_background) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.centroids_of_labels(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw(), withBG)); + Objects.requireNonNull(label_image, "label_image cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.centroids_of_labels(device.getRaw(), label_image.getRaw(), centroids_coordinates.getRaw(), include_background)); } /** @@ -151,6 +179,7 @@ public static ArrayJ centroidsOfLabels(DeviceJ device, ArrayJ input, ArrayJ outp * @param min_value (float) - Minimum value to keep. (default: 0) * @param max_value (float) - Maximum value to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsWithValuesOutOfRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeLabelsWithMapValuesOutOfRange(DeviceJ device, ArrayJ input, ArrayJ values, ArrayJ output, float min_value, float max_value) { @@ -169,6 +198,7 @@ public static ArrayJ removeLabelsWithMapValuesOutOfRange(DeviceJ device, ArrayJ * @param min_value (float) - Minimum value to keep. (default: 0) * @param max_value (float) - Maximum value to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsWithValuesWithinRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeLabelsWithMapValuesWithinRange(DeviceJ device, ArrayJ input, ArrayJ values, ArrayJ output, float min_value, float max_value) { @@ -181,39 +211,41 @@ public static ArrayJ removeLabelsWithMapValuesWithinRange(DeviceJ device, ArrayJ /** * Exclude labels with values outside a given value range based on a vector of values associated with the labels. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input image where labels will be filtered. - * @param values ({@link ArrayJ}) - Vector of + * @param values_map ({@link ArrayJ}) - Vector of values associated with the labels. + * @param label_map_input ({@link ArrayJ}) - Input image where labels will be filtered. * @param output ({@link ArrayJ}) - Output image where labels will be written to. (default: None) - * @param min_value_range (float) - Minimum value to keep. (default: 0) - * @param max_value_range (float) - Maximum value to keep. (default: 100) + * @param minimum_value_range (float) - Minimum value to keep. (default: 0) + * @param maximum_value_range (float) - Maximum value to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsWithValuesOutOfRange * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ excludeLabelsWithMapValuesOutOfRange(DeviceJ device, ArrayJ input, ArrayJ values, ArrayJ output, float min_value_range, float max_value_range) { + public static ArrayJ excludeLabelsWithMapValuesOutOfRange(DeviceJ device, ArrayJ values_map, ArrayJ label_map_input, ArrayJ output, float minimum_value_range, float maximum_value_range) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - Objects.requireNonNull(values, "values cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.exclude_labels_with_map_values_out_of_range(device.getRaw(), input.getRaw(), values.getRaw(), output == null ? null : output.getRaw(), min_value_range, max_value_range)); + Objects.requireNonNull(values_map, "values_map cannot be null"); + Objects.requireNonNull(label_map_input, "label_map_input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.exclude_labels_with_map_values_out_of_range(device.getRaw(), values_map.getRaw(), label_map_input.getRaw(), output == null ? null : output.getRaw(), minimum_value_range, maximum_value_range)); } /** * Exclude labels with values inside a given value range based on a vector of values associated with the labels. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input image where labels will be filtered. - * @param values ({@link ArrayJ}) - Vector of + * @param values_map ({@link ArrayJ}) - Vector of values associated with the labels. + * @param label_map_input ({@link ArrayJ}) - Input image where labels will be filtered. * @param output ({@link ArrayJ}) - Output image where labels will be written to. (default: None) - * @param min_value_range (float) - Minimum value to keep. (default: 0) - * @param max_value_range (float) - Maximum value to keep. (default: 100) + * @param minimum_value_range (float) - Minimum value to keep. (default: 0) + * @param maximum_value_range (float) - Maximum value to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsWithValuesWithinRange * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated - public static ArrayJ excludeLabelsWithMapValuesWithinRange(DeviceJ device, ArrayJ input, ArrayJ values, ArrayJ output, float min_value_range, float max_value_range) { + public static ArrayJ excludeLabelsWithMapValuesWithinRange(DeviceJ device, ArrayJ values_map, ArrayJ label_map_input, ArrayJ output, float minimum_value_range, float maximum_value_range) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - Objects.requireNonNull(values, "values cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.exclude_labels_with_map_values_within_range(device.getRaw(), input.getRaw(), values.getRaw(), output == null ? null : output.getRaw(), min_value_range, max_value_range)); + Objects.requireNonNull(values_map, "values_map cannot be null"); + Objects.requireNonNull(label_map_input, "label_map_input cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier4.exclude_labels_with_map_values_within_range(device.getRaw(), values_map.getRaw(), label_map_input.getRaw(), output == null ? null : output.getRaw(), minimum_value_range, maximum_value_range)); } /** @@ -223,6 +255,7 @@ public static ArrayJ excludeLabelsWithMapValuesWithinRange(DeviceJ device, Array * @param input ({@link ArrayJ}) - Input label image. * @param output ({@link ArrayJ}) - Output parametric image. (default: None) * @return {@link ArrayJ} + * @see reference_extensionRatioMap * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ extensionRatioMap(DeviceJ device, ArrayJ input, ArrayJ output) { diff --git a/src/main/java/net/clesperanto/kernels/Tier5.java b/src/main/java/net/clesperanto/kernels/Tier5.java index 907b05d..2549439 100644 --- a/src/main/java/net/clesperanto/kernels/Tier5.java +++ b/src/main/java/net/clesperanto/kernels/Tier5.java @@ -22,9 +22,10 @@ public class Tier5 { * If shape of the images or any pixel are different, returns False. * True otherwise This function is supposed to work similarly like its counterpart in numpy [1]. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - - * @param input1 ({@link ArrayJ}) - + * @param input0 ({@link ArrayJ}) - First array to compare + * @param input1 ({@link ArrayJ}) - Second array to compare * @return boolean + * @see numpy.array_equal.html * @throws NullPointerException if any of the device or input parameters are null. */ public static boolean arrayEqual(DeviceJ device, ArrayJ input0, ArrayJ input1) { @@ -59,6 +60,7 @@ public static ArrayJ combineLabels(DeviceJ device, ArrayJ input0, ArrayJ input1, * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param connectivity (String) - Defines pixel neighborhood relationship, "box" or "sphere". (default: 'box') * @return {@link ArrayJ} + * @see reference_connectedComponentsLabelingBox * @throws NullPointerException if any of the device or input parameters are null. */ @Deprecated @@ -75,6 +77,7 @@ public static ArrayJ connectedComponentsLabeling(DeviceJ device, ArrayJ input, A * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param connectivity (String) - Defines pixel neighborhood relationship, "box" or "sphere". (default: 'box') * @return {@link ArrayJ} + * @see reference_connectedComponentsLabelingBox * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ connectedComponentLabeling(DeviceJ device, ArrayJ input, ArrayJ output, String connectivity) { @@ -89,6 +92,7 @@ public static ArrayJ connectedComponentLabeling(DeviceJ device, ArrayJ input, Ar * @param input ({@link ArrayJ}) - Label image to reduce. * @param output ({@link ArrayJ}) - Output label image with centroids. (default: None) * @return {@link ArrayJ} + * @see reference_reduceLabelsToCentroids * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ reduceLabelsToCentroids(DeviceJ device, ArrayJ input, ArrayJ output) { @@ -105,6 +109,7 @@ public static ArrayJ reduceLabelsToCentroids(DeviceJ device, ArrayJ input, Array * @param minimum_size (float) - Minimum size of labels to keep. (default: 0) * @param maximum_size (float) - Maximum size of labels to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ filterLabelBySize(DeviceJ device, ArrayJ input, ArrayJ output, float minimum_size, float maximum_size) { @@ -121,6 +126,7 @@ public static ArrayJ filterLabelBySize(DeviceJ device, ArrayJ input, ArrayJ outp * @param minimum_size (float) - Minimum size of labels to keep. (default: 0) * @param maximum_size (float) - Maximum size of labels to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ excludeLabelsOutsideSizeRange(DeviceJ device, ArrayJ input, ArrayJ output, float minimum_size, float maximum_size) { diff --git a/src/main/java/net/clesperanto/kernels/Tier6.java b/src/main/java/net/clesperanto/kernels/Tier6.java index eff9ec6..e770f10 100644 --- a/src/main/java/net/clesperanto/kernels/Tier6.java +++ b/src/main/java/net/clesperanto/kernels/Tier6.java @@ -22,8 +22,8 @@ public class Tier6 { * No label overwrites another label. * Similar to the implementation in scikitimage [2] and MorpholibJ[3] Notes * This operation assumes input images are isotropic. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - label image to erode - * @param output ({@link ArrayJ}) - result (default: None) + * @param input ({@link ArrayJ}) - Input label image to erode + * @param output ({@link ArrayJ}) - Output label image (default: None) * @param radius (int) - (default: 2) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. @@ -40,10 +40,10 @@ public static ArrayJ dilateLabels(DeviceJ device, ArrayJ input, ArrayJ output, i * Thus, overlapping labels of input and output may not have the same identifier. * Notes * This operation assumes input images are isotropic. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - result - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input label image + * @param output ({@link ArrayJ}) - Output label image (default: None) * @param radius (int) - (default: 1) - * @param relabel (boolean) - and all label indices exist. (default: False) + * @param relabel (boolean) - Relabel the image, e.g. if object disappear or split. (default: False) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. */ @@ -59,10 +59,12 @@ public static ArrayJ erodeLabels(DeviceJ device, ArrayJ input, ArrayJ output, in * Under the hood, this filter applies a Gaussian blur, Otsu-thresholding [1] and connected component labeling [2]. * The thresholded binary image is flooded using the Voronoi tesselation approach starting from the found local maxima. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input0 ({@link ArrayJ}) - intensity image to add labels + * @param input0 ({@link ArrayJ}) - Intensity image to segment * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param outline_sigma (float) - Gaussian blur sigma along all axes (default: 0) * @return {@link ArrayJ} + * @see 4310076 + * @see Connected-component_labeling * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ gaussOtsuLabeling(DeviceJ device, ArrayJ input0, ArrayJ output, float outline_sigma) { @@ -76,10 +78,11 @@ public static ArrayJ gaussOtsuLabeling(DeviceJ device, ArrayJ input0, ArrayJ out * The region growing is limited to a masked area. * The resulting label map is written to the output. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param mask ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input binary image + * @param mask ({@link ArrayJ}) - Input + * @param output ({@link ArrayJ}) - Output label image (default: None) * @return {@link ArrayJ} + * @see reference_maskedVoronoiLabeling * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ maskedVoronoiLabeling(DeviceJ device, ArrayJ input, ArrayJ mask, ArrayJ output) { @@ -93,24 +96,26 @@ public static ArrayJ maskedVoronoiLabeling(DeviceJ device, ArrayJ input, ArrayJ * Takes a binary image, labels connected components and dilates the regions using a octagon shape until they touch. * The resulting label map is written to the output. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - - * @param output ({@link ArrayJ}) - (default: None) + * @param input_binary ({@link ArrayJ}) - Input binary image + * @param output_labels ({@link ArrayJ}) - Output label image (default: None) * @return {@link ArrayJ} + * @see reference_voronoiLabeling * @throws NullPointerException if any of the device or input parameters are null. */ - public static ArrayJ voronoiLabeling(DeviceJ device, ArrayJ input, ArrayJ output) { + public static ArrayJ voronoiLabeling(DeviceJ device, ArrayJ input_binary, ArrayJ output_labels) { Objects.requireNonNull(device, "device cannot be null"); - Objects.requireNonNull(input, "input cannot be null"); - return new ArrayJ(net.clesperanto._internals.kernelj.Tier6.voronoi_labeling(device.getRaw(), input.getRaw(), output == null ? null : output.getRaw())); + Objects.requireNonNull(input_binary, "input_binary cannot be null"); + return new ArrayJ(net.clesperanto._internals.kernelj.Tier6.voronoi_labeling(device.getRaw(), input_binary.getRaw(), output_labels == null ? null : output_labels.getRaw())); } /** * Removes labelled objects small than a given size (in pixels) from a label map. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Label image to filter. - * @param output ({@link ArrayJ}) - Output label image fitlered. (default: None) + * @param output ({@link ArrayJ}) - Output label image filtered. (default: None) * @param minimum_size (float) - Smallest size object allowed. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeSmallLabels(DeviceJ device, ArrayJ input, ArrayJ output, float minimum_size) { @@ -123,9 +128,10 @@ public static ArrayJ removeSmallLabels(DeviceJ device, ArrayJ input, ArrayJ outp * Removes labels from a label map which are below a given maximum size. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Label image to filter. - * @param output ({@link ArrayJ}) - Output label image fitlered. (default: None) + * @param output ({@link ArrayJ}) - Output label image filtered. (default: None) * @param maximum_size (float) - Largest size object to exclude. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ excludeSmallLabels(DeviceJ device, ArrayJ input, ArrayJ output, float maximum_size) { @@ -135,12 +141,13 @@ public static ArrayJ excludeSmallLabels(DeviceJ device, ArrayJ input, ArrayJ out } /** - * Removes labelled objects bigger than a given size (in pixels) from a label map. + * Removes labeled objects bigger than a given size (in pixels) from a label map. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Label image to filter. - * @param output ({@link ArrayJ}) - Output label image fitlered. (default: None) + * @param output ({@link ArrayJ}) - Output label image filtered. (default: None) * @param maximum_size (float) - Biggest size object allowed. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ removeLargeLabels(DeviceJ device, ArrayJ input, ArrayJ output, float maximum_size) { @@ -153,9 +160,10 @@ public static ArrayJ removeLargeLabels(DeviceJ device, ArrayJ input, ArrayJ outp * Removes labels from a label map which are higher a given minimum size. * @param device ({@link DeviceJ}) - Device to perform the operation on. * @param input ({@link ArrayJ}) - Label image to filter. - * @param output ({@link ArrayJ}) - Output label image fitlered. (default: None) + * @param output ({@link ArrayJ}) - Output label image filtered. (default: None) * @param minimum_size (float) - Smallest size object to keep. (default: 100) * @return {@link ArrayJ} + * @see reference_excludeLabelsOutsideSizeRange * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ excludeLargeLabels(DeviceJ device, ArrayJ input, ArrayJ output, float minimum_size) { diff --git a/src/main/java/net/clesperanto/kernels/Tier7.java b/src/main/java/net/clesperanto/kernels/Tier7.java index fcccb14..904dabc 100644 --- a/src/main/java/net/clesperanto/kernels/Tier7.java +++ b/src/main/java/net/clesperanto/kernels/Tier7.java @@ -25,8 +25,8 @@ public class Tier7 { * the first 3 elements are the first row of the matrix. * If no matrix is given, the identity matrix will be used. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be transformed. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be transformed. + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param transform_matrix (ArrayList<Float>) - Affine transformation matrix (3x3 or 4x4). (default: None) * @param interpolate (boolean) - If true, bi/trilinear interpolation will be applied, if hardware allows. (default: False) * @param resize (boolean) - Automatically determines the size of the output depending on the rotation angles. (default: False) @@ -48,11 +48,13 @@ public static ArrayJ affineTransform(DeviceJ device, ArrayJ input, ArrayJ output * Like when using Voronoi-Otsu-labeling, small objects may disappear when applying this operation. * This function is inspired by a similar implementation in Java by Jan Brocher (Biovoxxel) [0] [1]. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be transformed. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be transformed. + * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param number_of_erosions (int) - Number of iteration of erosion. (default: 5) * @param outline_sigma (float) - Gaussian blur sigma applied before Otsu thresholding. (default: 2) * @return {@link ArrayJ} + * @see BV_LabelSplitter.java#L83) + * @see 434949702 * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ erodedOtsuLabeling(DeviceJ device, ArrayJ input, ArrayJ output, int number_of_erosions, float outline_sigma) { @@ -68,8 +70,8 @@ public static ArrayJ erodedOtsuLabeling(DeviceJ device, ArrayJ input, ArrayJ out * pi * 180. * 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be transformed. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be transformed. + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param translate_x (float) - Translation along x axis in pixels. (default: 0) * @param translate_y (float) - Translation along y axis in pixels. (default: 0) * @param translate_z (float) - Translation along z axis in pixels. (default: 0) @@ -95,8 +97,8 @@ public static ArrayJ rigidTransform(DeviceJ device, ArrayJ input, ArrayJ output, * pi * 180. * 0. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be rotated. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be rotated. + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param angle_x (float) - Rotation around x axis in degrees. (default: 0) * @param angle_y (float) - Rotation around y axis in degrees. (default: 0) * @param angle_z (float) - Rotation around z axis in degrees. (default: 0) @@ -115,8 +117,8 @@ public static ArrayJ rotate(DeviceJ device, ArrayJ input, ArrayJ output, float a /** * Scale the image by given factors. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be scaleded. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be scaled. + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param factor_x (float) - Scaling along x axis. (default: 1) * @param factor_y (float) - Scaling along y axis. (default: 1) * @param factor_z (float) - Scaling along z axis. (default: 1) @@ -135,8 +137,8 @@ public static ArrayJ scale(DeviceJ device, ArrayJ input, ArrayJ output, float fa /** * Translate the image by a given vector. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input Array to be translated. - * @param output ({@link ArrayJ}) - Output Array. (default: None) + * @param input ({@link ArrayJ}) - Input image to be translated. + * @param output ({@link ArrayJ}) - Output image. (default: None) * @param translate_x (float) - Translation along x axis in pixels. (default: 0) * @param translate_y (float) - Translation along y axis in pixels. (default: 0) * @param translate_z (float) - Translation along z axis in pixels. (default: 0) @@ -156,8 +158,8 @@ public static ArrayJ translate(DeviceJ device, ArrayJ input, ArrayJ output, floa * With every iteration, box and diamond/sphere structuring elements are used and thus, the operation has an octagon as structuring element. * Notes * This operation assumes input images are isotropic. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input label Array. - * @param output ({@link ArrayJ}) - Output label Array. (default: None) + * @param input ({@link ArrayJ}) - Input label image. + * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param radius (int) - Radius size for the closing. (default: 0) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. @@ -173,8 +175,8 @@ public static ArrayJ closingLabels(DeviceJ device, ArrayJ input, ArrayJ output, * Note: Depending on the label image and the radius, labels may disappear and labels may split into multiple islands. * Thus, overlapping labels of input and output may not have the same identifier. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - result - * @param output ({@link ArrayJ}) - (default: None) + * @param input ({@link ArrayJ}) - Input image to process + * @param output ({@link ArrayJ}) - Output label image (default: None) * @param radius (int) - (default: 1) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. @@ -191,8 +193,8 @@ public static ArrayJ erodeConnectedLabels(DeviceJ device, ArrayJ input, ArrayJ o * With every iteration, box and diamond/sphere structuring elements are used and thus, the operation has an octagon as structuring element. * Notes * This operation assumes input images are isotropic. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input label Array. - * @param output ({@link ArrayJ}) - Output label Array. (default: None) + * @param input ({@link ArrayJ}) - Input label image. + * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param radius (int) - Radius size for the opening. (default: 0) * @return {@link ArrayJ} * @throws NullPointerException if any of the device or input parameters are null. @@ -210,11 +212,14 @@ public static ArrayJ openingLabels(DeviceJ device, ArrayJ input, ArrayJ output, * The thresholded binary image is flooded using the Voronoi tesselation approach starting from the found local maxima. * Notes * This operation assumes input images are isotropic. * @param device ({@link DeviceJ}) - Device to perform the operation on. - * @param input ({@link ArrayJ}) - Input intensity Array. - * @param output ({@link ArrayJ}) - Output label Array. (default: None) + * @param input ({@link ArrayJ}) - Input intensity image. + * @param output ({@link ArrayJ}) - Output label image. (default: None) * @param spot_sigma (float) - Controls how close detected cells can be. (default: 2) * @param outline_sigma (float) - Controls how precise segmented objects are outlined. (default: 2) * @return {@link ArrayJ} + * @see reference_voronoiOtsuLabeling + * @see 4310076 + * @see Voronoi_diagram * @throws NullPointerException if any of the device or input parameters are null. */ public static ArrayJ voronoiOtsuLabeling(DeviceJ device, ArrayJ input, ArrayJ output, float spot_sigma, float outline_sigma) {