17#ifndef __dwi_tractography_seeding_base_h__
18#define __dwi_tractography_seeding_base_h__
35#define MAX_TRACKING_SEED_ATTEMPTS_RANDOM 1000
40#define MAX_TRACKING_SEED_ATTEMPTS_DYNAMIC 1000
45#define MAX_TRACKING_SEED_ATTEMPTS_GMWMI 1000
49#define MAX_TRACKING_SEED_ATTEMPTS_FIXED 1000
58 namespace Tractography
66 template <
class ImageType>
69 std::atomic<uint32_t> count (0);
70 ThreadedLoop (data).run ([&] (ImageType& v) {
if (v.value()) count.fetch_add (1, std::memory_order_relaxed); }, data);
75 template <
class ImageType>
78 std::atomic<default_type> volume (0.0);
80 [&] (
decltype(data)& v) {
87 }
while (!volume.compare_exchange_weak (
current, target, std::memory_order_relaxed));
100 Base (
const std::string& in,
const std::string& desc,
const size_t attempts) :
105 max_attempts (attempts) { }
110 uint32_t num()
const {
return count; }
111 bool is_finite()
const {
return count; }
112 const std::string& get_type()
const {
return type; }
113 const std::string& get_name()
const {
return name; }
114 size_t get_max_attempts()
const {
return max_attempts; }
116 virtual bool get_seed (Eigen::Vector3f&)
const = 0;
117 virtual bool get_seed (Eigen::Vector3f& p, Eigen::Vector3f&) {
return get_seed (p); }
133 const std::string name;
134 const size_t max_attempts;
friend std::ostream & operator<<(std::ostream &stream, const Base &B)
VectorType::Scalar value(const VectorType &coefs, typename VectorType::Scalar cos_elevation, typename VectorType::Scalar cos_azimuth, typename VectorType::Scalar sin_azimuth, int lmax)
uint32_t get_count(ImageType &data)
float get_volume(ImageType &data)
std::pair< int, int > current()
MR::default_type value_type
std::string basename(const std::string &name)
bool exists(const std::string &path)
double default_type
the default type used throughout MRtrix
ThreadedLoopRunOuter< decltype(Loop(vector< size_t >()))> ThreadedLoop(const HeaderType &source, const vector< size_t > &outer_axes, const vector< size_t > &inner_axes)
Multi-threaded loop object.