FAST
3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
|
Go to the documentation of this file.
17 FAST_EXPORT
double log2(
double n);
18 FAST_EXPORT
double round(
double n);
19 FAST_EXPORT
double round(
double n,
int decimals);
32 template <
typename ...Args>
34 auto size = std::snprintf(
nullptr, 0,
format.c_str(), std::forward<Args>(args)...);
35 std::string output(size + 1,
'\0');
36 std::sprintf(&output[0],
format.c_str(), std::forward<Args>(args)...);
54 }
else if (value < 0) {
65 T* data = (T*)voidData;
67 for(
unsigned int i = 0; i < size*nrOfComponents; i += nrOfComponents) {
80 T* data = (T*)voidData;
84 for(
unsigned int i = 0; i < nrOfElements; i++) {
85 if((
float)data[i] < *
min) {
86 *
min = (float)data[i];
88 if((
float)data[i] > *
max) {
89 *
max = (float)data[i];
96 T* data = (T*)voidData;
99 for(
unsigned int i = 0; i < nrOfElements; i++) {
100 sum += (float)data[i];
105 FAST_EXPORT cl::size_t<3>
createRegion(
unsigned int x,
unsigned int y,
unsigned int z);
117 FAST_EXPORT std::vector<std::string>
split(
const std::string input,
const std::string& delimiter =
" ",
float removeEmpty =
true);
120 static inline void ltrim(std::string &s) {
121 s.erase(s.begin(), std::find_if(s.begin(), s.end(),
122 [](
unsigned char c) {return !std::isspace(c); }));
126 static inline void rtrim(std::string &s) {
127 s.erase(std::find_if(s.rbegin(), s.rend(),
128 [](
unsigned char c) {return !std::isspace(c); }).base(), s.end());
132 static inline void trim(std::string &s) {
140 FAST_EXPORT std::string
replace(std::string str, std::string find, std::string replacement);
143 static inline void hash_combine(std::size_t& seed,
const T& v)
146 seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
151 FAST_EXPORT Matrix4f
loadOrthographicMatrix(
float left,
float right,
float bottom,
float top,
float zNear,
float zFar);
170 FAST_EXPORT
bool fileExists(std::string filename);
179 FAST_EXPORT std::vector<std::string>
getDirectoryList(std::string path,
bool getFiles =
true,
bool getDirectories =
false);
188 FAST_EXPORT std::string
getDirName(std::string path);
202 FAST_EXPORT std::string
join(std::string path);
219 template<
typename ...T>
220 std::string
join(
const std::string& path1, T... args) {
221 return path1 +
"/" +
join(args...);
229 FAST_EXPORT
bool isFile(
const std::string& path);
236 FAST_EXPORT
bool isDir(
const std::string& path);
247 return std::unique_ptr<T>(
new typename std::remove_extent<T>::type[size]);
255 FAST_EXPORT
void extractZipFile(std::string zipFilepath, std::string destination);
FAST_EXPORT Matrix4f loadPerspectiveMatrix(float fovy, float aspect, float zNear, float zFar)
std::shared_ptr< ExecutionDevice > pointer
Definition: ExecutionDevice.hpp:11
FAST_EXPORT double log2(double n)
FAST_EXPORT void getMaxAndMinFromOpenCLImage(OpenCLDevice::pointer device, cl::Image2D image, DataType type, float *min, float *max)
FAST_EXPORT unsigned int getPowerOfTwoSize(unsigned int size)
DataType
Definition: DataTypes.hpp:38
Definition: AffineTransformation.hpp:7
float getSumFromData(void *voidData, unsigned int nrOfElements)
Definition: Utility.hpp:95
FAST_EXPORT bool isFile(const std::string &path)
FAST_EXPORT std::string getDirName(std::string path)
FAST_EXPORT std::string join(std::string path)
FAST_EXPORT Matrix4f loadOrthographicMatrix(float left, float right, float bottom, float top, float zNear, float zFar)
FAST_EXPORT void createDirectory(std::string path)
FAST_EXPORT cl::size_t< 3 > createOrigoRegion()
FAST_EXPORT std::string stringToLower(std::string)
FAST_EXPORT cl::size_t< 3 > createRegion(unsigned int x, unsigned int y, unsigned int z)
FAST_EXPORT std::string getModifiedDate(std::string filename)
FAST_EXPORT std::vector< std::string > getDirectoryList(std::string path, bool getFiles=true, bool getDirectories=false)
FAST_EXPORT bool fileExists(std::string filename)
FAST_EXPORT std::string stringToUpper(std::string)
FAST_EXPORT std::vector< std::string > split(const std::string input, const std::string &delimiter=" ", float removeEmpty=true)
std::string format(std::string format, Args &&... args)
Definition: Utility.hpp:33
FAST_EXPORT void createDirectories(std::string path)
T max(T a, T b)
Definition: Utility.hpp:46
T square(T x)
Definition: Utility.hpp:28
FAST_EXPORT bool isDir(const std::string &path)
float getSumFromOpenCLImageResult(void *voidData, unsigned int size, unsigned int nrOfComponents)
Definition: Utility.hpp:64
FAST_EXPORT double round(double n)
FAST_EXPORT std::string currentDateTime(std::string format="%Y-%m-%d-%H%M%S")
T min(T a, T b)
Definition: Utility.hpp:41
FAST_EXPORT void getMaxAndMinFromOpenCLBuffer(OpenCLDevice::pointer device, cl::Buffer buffer, unsigned int size, DataType type, float *min, float *max)
T sign(T value)
Definition: Utility.hpp:51
FAST_EXPORT void getIntensitySumFromOpenCLImage(OpenCLDevice::pointer device, cl::Image2D image, DataType type, float *sum)
void getMaxAndMinFromData(void *voidData, unsigned int nrOfElements, float *min, float *max)
Definition: Utility.hpp:79
FAST_EXPORT std::string replace(std::string str, std::string find, std::string replacement)
FAST_EXPORT std::string getCLErrorString(cl_int err)
std::unique_ptr< T > make_uninitialized_unique(std::size_t size)
Definition: Utility.hpp:246
FAST_EXPORT void * allocateDataArray(unsigned int voxels, DataType type, unsigned int nrOfComponents)
FAST_EXPORT void extractZipFile(std::string zipFilepath, std::string destination)
Eigen::Matrix< uint, 3, 1 > Vector3ui
Definition: DataTypes.hpp:35