Skip to content

Commit

Permalink
Merge pull request #409 from clEsperanto/add-more-parameteric-map
Browse files Browse the repository at this point in the history
Add-more-parameteric-map
  • Loading branch information
StRigaud authored Dec 20, 2024
2 parents 0b51c89 + fe9b264 commit 8a7b01d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
39 changes: 39 additions & 0 deletions clic/include/tier4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,45 @@ auto
extension_ratio_map_func(const Device::Pointer & device, const Array::Pointer & src, Array::Pointer dst)
-> Array::Pointer;

/**
* @name mean_extension_map
* @brief Determines for every label the mean distance of any pixel to the centroid in a label map and returns it as
* a parametric map.
*
* The extension ration is defined as the maximum distance of any pixel in the label to the label's centroid divided by
* the average distance of all pixels in the label to the centroid.
*
* @param device Device to perform the operation on. [const Device::Pointer &]
* @param src Input label image. [const Array::Pointer &]
* @param dst Output parametric image. [Array::Pointer ( = None )]
* @return Array::Pointer
*
* @note 'label processing', 'in assistant', 'map'
* @see https://clij.github.io/clij2-docs/reference_meanExtensionMap
*/
auto
mean_extension_map_func(const Device::Pointer & device, const Array::Pointer & src, Array::Pointer dst)
-> Array::Pointer;

/**
* @name maximum_extension_map
* @brief Determines for every label the maximum distance of any pixel to the centroid in a label map and returns it as
* a parametric map.
*
* The extension ration is defined as the maximum distance of any pixel in the label to the label's centroid divided by
* the average distance of all pixels in the label to the centroid.
*
* @param device Device to perform the operation on. [const Device::Pointer &]
* @param src Input label image. [const Array::Pointer &]
* @param dst Output parametric image. [Array::Pointer ( = None )]
* @return Array::Pointer
*
* @note 'label processing', 'in assistant', 'map'
* @see https://clij.github.io/clij2-docs/reference_meanExtensionMap
*/
auto
maximum_extension_map_func(const Device::Pointer & device, const Array::Pointer & src, Array::Pointer dst)
-> Array::Pointer;

/**
* @name minimum_intensity_map
Expand Down
2 changes: 1 addition & 1 deletion clic/include/tier7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ affine_transform_func(const Device::Pointer & device,
* @return Array::Pointer
*
* @note 'label', 'in assistant'
* @see https://github.com/biovoxxel/bv3dbox (BV_LabelSplitter.java#L83)
* @see https://github.com/biovoxxel/bv3dbox
* @see https://zenodo.org/badge/latestdoi/434949702
*/
auto
Expand Down
27 changes: 27 additions & 0 deletions clic/src/tier4/parametrics_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,33 @@ extension_ratio_map_func(const Device::Pointer & device, const Array::Pointer &
return tier1::replace_values_func(device, src, values, dst);
}

auto
mean_extension_map_func(const Device::Pointer & device, const Array::Pointer & src, Array::Pointer dst)
-> Array::Pointer
{
tier0::create_like(src, dst, dType::FLOAT);
auto props = tier3::statistics_of_background_and_labelled_pixels_func(device, src, src);
auto vector = props["mean_distance_to_centroid"];
auto values = Array::create(vector.size(), 1, 1, 1, dType::FLOAT, mType::BUFFER, device);
values->writeFrom(vector.data());
tier1::set_column_func(device, values, 0, 0);
return tier1::replace_values_func(device, src, values, dst);
}

auto
maximum_extension_map_func(const Device::Pointer & device, const Array::Pointer & src, Array::Pointer dst)
-> Array::Pointer
{
tier0::create_like(src, dst, dType::FLOAT);
auto props = tier3::statistics_of_background_and_labelled_pixels_func(device, src, src);
auto vector = props["max_distance_to_centroid"];
auto values = Array::create(vector.size(), 1, 1, 1, dType::FLOAT, mType::BUFFER, device);
values->writeFrom(vector.data());
tier1::set_column_func(device, values, 0, 0);
return tier1::replace_values_func(device, src, values, dst);
}


auto
mean_intensity_map_func(const Device::Pointer & device,
const Array::Pointer & src,
Expand Down

0 comments on commit 8a7b01d

Please sign in to comment.