refactor: migrate voxel data storage to DataAllocator for CUDA

This commit is contained in:
AndreaRigoni
2026-02-28 10:05:39 +00:00
parent 07915295cb
commit 52580d8cde
14 changed files with 1484 additions and 1022 deletions

View File

@@ -23,8 +23,6 @@
//////////////////////////////////////////////////////////////////////////////*/
#ifndef VOXIMAGEFILTER_H
#define VOXIMAGEFILTER_H
@@ -33,96 +31,83 @@
#include "Math/VoxImage.h"
namespace uLib {
namespace Interface {
struct VoxImageFilterShape {
template <class Self> void check_structural() {
uLibCheckFunction(Self,operator(),float,float);
uLibCheckFunction(Self,operator(),float,const Vector3f&);
}
template <class Self> void check_structural() {
uLibCheckFunction(Self, operator(), float, float);
uLibCheckFunction(Self, operator(), float, const Vector3f &);
}
};
}
template < typename VoxelT > class Kernel;
} // namespace Interface
template <typename VoxelT> class Kernel;
namespace Abstract {
class VoxImageFilter {
public:
virtual void Run() = 0;
virtual void Run() = 0;
virtual void SetImage(Abstract::VoxImage *image) = 0;
virtual void SetImage(Abstract::VoxImage *image) = 0;
protected:
virtual ~VoxImageFilter() {}
virtual ~VoxImageFilter() {}
};
}
} // namespace Abstract
template < typename VoxelT, typename AlgorithmT >
class VoxImageFilter : public Abstract::VoxImageFilter
{
template <typename VoxelT, typename AlgorithmT>
class VoxImageFilter : public Abstract::VoxImageFilter {
public:
VoxImageFilter(const Vector3i &size);
VoxImageFilter(const Vector3i &size);
void Run();
void Run();
void SetKernelNumericXZY(const std::vector<float> &numeric);
void SetKernelNumericXZY(const std::vector<float> &numeric);
void SetKernelSpherical(float (*shape)(float));
void SetKernelSpherical(float (*shape)(float));
template < class ShapeT >
void SetKernelSpherical( ShapeT shape );
template <class ShapeT> void SetKernelSpherical(ShapeT shape);
void SetKernelWeightFunction(float (*shape)(const Vector3f &));
void SetKernelWeightFunction(float (*shape)(const Vector3f &));
template < class ShapeT >
void SetKernelWeightFunction( ShapeT shape );
template <class ShapeT> void SetKernelWeightFunction(ShapeT shape);
inline Kernel<VoxelT> GetKernelData() const { return this->m_KernelData; }
inline const Kernel<VoxelT> &GetKernelData() const {
return this->m_KernelData;
}
inline Kernel<VoxelT> &GetKernelData() { return this->m_KernelData; }
inline VoxImage<VoxelT>* GetImage() const { return this->m_Image; }
inline VoxImage<VoxelT> *GetImage() const { return this->m_Image; }
void SetImage(Abstract::VoxImage *image);
void SetImage(Abstract::VoxImage *image);
protected:
float Convolve(const VoxImage<VoxelT> &buffer, int index); // remove //
float Convolve(const VoxImage<VoxelT> &buffer, int index); // remove //
void SetKernelOffset();
void SetKernelOffset();
float Distance2(const Vector3i &v);
float Distance2(const Vector3i &v);
// protected members for algorithm access //
Kernel<VoxelT> m_KernelData;
VoxImage<VoxelT> *m_Image;
// protected members for algorithm access //
Kernel<VoxelT> m_KernelData;
VoxImage<VoxelT> *m_Image;
private:
AlgorithmT *t_Algoritm;
AlgorithmT *t_Algoritm;
};
}
} // namespace uLib
#endif // VOXIMAGEFILTER_H
#include "VoxImageFilter.hpp"
#include "VoxImageFilterLinear.hpp"
#include "VoxImageFilterThreshold.hpp"
#include "VoxImageFilterMedian.hpp"
#include "VoxImageFilter2ndStat.hpp"
#include "VoxImageFilterABTrim.hpp"
#include "VoxImageFilterBilateral.hpp"
#include "VoxImageFilter2ndStat.hpp"
#include "VoxImageFilterCustom.hpp"
#include "VoxImageFilterLinear.hpp"
#include "VoxImageFilterMedian.hpp"
#include "VoxImageFilterThreshold.hpp"