Skip to content

Commit

Permalink
change type in image
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Dec 5, 2023
1 parent ae3cf96 commit 3da305f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions applications/plugins/image/ImageAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ real norm(cimg_library::CImg<real>& distances, sofa::type::fixed_array<int, 3>&
/// @brief Replace value at oldCoord with a combinaison of value at newCoord, a offset and a bias if provided
template<typename real,typename T>
void replace(cimg_library::CImg<unsigned int>& voronoi, cimg_library::CImg<real>& distances, sofa::type::fixed_array<int, 3>& oldCoord, sofa::type::fixed_array<int, 3>& newCoord,
sofa::type::fixed_array<real, 3>& offset, const sofa::type::fixed_array<real, 3>& voxelSize, const cimg_library::CImg<T>* bias)
sofa::type::fixed_array<real, 3>& offset, const sofa::type::Vec<3, real>& voxelSize, const cimg_library::CImg<T>* bias)
{
real b=1.0;
if(bias)
Expand All @@ -313,7 +313,7 @@ void replace(cimg_library::CImg<unsigned int>& voronoi, cimg_library::CImg<real>

/// @brief Update value of the pixel of an image after comparing it with its neighbor
template<typename real,typename T>
void update(cimg_library::CImg<real>& distances, cimg_library::CImg<unsigned int>& voronoi, sofa::type::fixed_array< sofa::type::fixed_array<int, 3>, 10 >& coord, sofa::type::fixed_array< sofa::type::fixed_array<real, 3>, 10 >& offset, const sofa::type::fixed_array<real, 3>& voxelSize, const cimg_library::CImg<T>* bias)
void update(cimg_library::CImg<real>& distances, cimg_library::CImg<unsigned int>& voronoi, sofa::type::fixed_array< sofa::type::fixed_array<int, 3>, 10 >& coord, sofa::type::fixed_array< sofa::type::fixed_array<real, 3>, 10 >& offset, const sofa::type::Vec<3, real>& voxelSize, const cimg_library::CImg<T>* bias)
{
real l_curr=norm(distances,coord[0]);
for(int l=1; l<=9; ++l)
Expand Down Expand Up @@ -348,7 +348,7 @@ bool hasConverged(cimg_library::CImg<real>& previous, cimg_library::CImg<real>&

/// @brief Perform a raster scan from left to right to update distances
template<typename real,typename T>
void left(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void left(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int i=d.width()-2; i>=0; --i)
{
Expand All @@ -375,7 +375,7 @@ void left(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, cons

/// @brief Perform a raster scan from right to left to update distances
template<typename real,typename T>
void right(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void right(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int i=1; i<d.width(); ++i)
{
Expand All @@ -402,7 +402,7 @@ void right(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, con

/// @brief Perform a raster scan from down to up to update distances
template<typename real,typename T>
void down(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void down(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int j=d.height()-2; j>=0; --j)
{
Expand All @@ -429,7 +429,7 @@ void down(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, cons

/// @brief Perform a raster scan from up to down to update distances
template<typename real,typename T>
void up(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void up(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int j=1; j<d.height(); ++j)
{
Expand All @@ -456,7 +456,7 @@ void up(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const

/// @brief Perform a raster scan from backward to forward to update distances
template<typename real,typename T>
void backward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void backward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int k=d.depth()-2; k>=0; --k)
{
Expand All @@ -483,7 +483,7 @@ void backward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d,

/// @brief Perform a raster scan from forward to backward to update distances
template<typename real,typename T>
void forward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::fixed_array<real, 3>& vx, const cimg_library::CImg<T>* bias)
void forward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, const sofa::type::Vec<3, real>& vx, const cimg_library::CImg<T>* bias)
{
for(int k=1; k<d.depth(); ++k)
{
Expand All @@ -510,7 +510,7 @@ void forward(cimg_library::CImg<unsigned int>& v, cimg_library::CImg<real>& d, c

/// @brief Perform 6 raster scan of an image to fully cover it.
template<typename real,typename T>
void rasterScan(cimg_library::CImg<unsigned int>& voronoi, cimg_library::CImg<real>& distances, const sofa::type::fixed_array<real, 3>& voxelSize, const cimg_library::CImg<T>* biasFactor=NULL)
void rasterScan(cimg_library::CImg<unsigned int>& voronoi, cimg_library::CImg<real>& distances, const sofa::type::Vec<3, real>& voxelSize, const cimg_library::CImg<T>* biasFactor=NULL)
{
right(voronoi, distances, voxelSize, biasFactor);
left(voronoi, distances, voxelSize, biasFactor);
Expand All @@ -528,7 +528,7 @@ void rasterScan(cimg_library::CImg<unsigned int>& voronoi, cimg_library::CImg<re
/// @param tolerance should be carefully chosen to minimize computation time.
/// @returns @param voronoi and @param distances
template<typename real,typename T>
void parallelMarching(cimg_library::CImg<real>& distances, cimg_library::CImg<unsigned int>& voronoi, const sofa::type::fixed_array<real, 3>& voxelSize, const unsigned int maxIter=std::numeric_limits<unsigned int>::max(), const SReal tolerance=10, const cimg_library::CImg<T>* biasFactor=NULL)
void parallelMarching(cimg_library::CImg<real>& distances, cimg_library::CImg<unsigned int>& voronoi, const sofa::type::Vec<3, real>& voxelSize, const unsigned int maxIter=std::numeric_limits<unsigned int>::max(), const SReal tolerance=10, const cimg_library::CImg<T>* biasFactor=NULL)
{
if(distances.width()<3 || distances.height()<3 || distances.depth()<3)
{
Expand Down

0 comments on commit 3da305f

Please sign in to comment.