17#ifndef __dwi_tractography_sift_track_contribution_h__
18#define __dwi_tractography_sift_track_contribution_h__
33 namespace Tractography
46 const uint32_t length_as_int = std::min (uint32_t(255), uint32_t(
std::round (scale_to_storage *
length)));
47 data = (fixel_index & 0x00FFFFFF) | (length_as_int << 24);
53 uint32_t get_fixel_index()
const {
return (data & 0x00FFFFFF); }
54 float get_length()
const {
return (uint32_t((data & 0xFF000000) >> 24) * scale_from_storage); }
57 bool add (
const float length)
62 const uint32_t existing = (data & 0xFF000000) >> 24;
63 if (existing + increment > 255)
65 data = (data & 0x00FFFFFF) | ((existing + increment) << 24);
70 static void set_scaling (
const Header&
H)
75 scale_to_storage = 255.0 / max_length;
76 scale_from_storage = max_length / 255.0;
77 min_length_for_storage = 0.5 / scale_to_storage;
82 static float min() {
return min_length_for_storage; }
88 static float scale_to_storage, scale_from_storage, min_length_for_storage;
137 total_contribution (c),
142 total_contribution (0.0),
143 total_length (0.0) { }
147 float get_total_contribution()
const {
return total_contribution; }
148 float get_total_length ()
const {
return total_length; }
151 const float total_contribution, total_length;
constexpr T pow2(const T &v)
constexpr I round(const T x)
PointType::Scalar length(const vector< PointType > &tck)