class to handle writing track scalars to file More...
#include "dwi/tractography/scalar_file.h"
Public Types | |
using | value_type = T |
Public Member Functions | |
ScalarWriter (const std::string &file, const Properties &properties) | |
~ScalarWriter () | |
bool | operator() (const TrackScalar< T > &tck_scalar) |
Protected Member Functions | |
void | add_scalar (const value_type &s) |
value_type | delimiter () const |
void | format_scalar (const value_type &s, value_type &destination) |
void | commit () |
ScalarWriter (const ScalarWriter &)=delete | |
Protected Attributes | |
const size_t | buffer_capacity |
std::unique_ptr< value_type[]> | buffer |
size_t | buffer_size |
int64_t | current_offset |
class to handle writing track scalars to file
writes track scalar file header as specified in properties and individual track scalars to the file specified in file. Writing individual scalars is done using the append() method.
This class implements a large write-back RAM buffer to hold the track scalar data in RAM, and only commits to file when the buffer capacity is reached. This minimises the number of write() calls, which can otherwise become a bottleneck on distributed or network filesystems. It also helps reduce file fragmentation when multiple processes write to file concurrently. The size of the write-back buffer defaults to 16MB, and can be set in the config file using the TrackWriterBufferSize field (in bytes).
Definition at line 167 of file scalar_file.h.
using MR::DWI::Tractography::ScalarWriter< T >::value_type = T |
Definition at line 170 of file scalar_file.h.
|
inline |
Definition at line 181 of file scalar_file.h.
|
inline |
Definition at line 202 of file scalar_file.h.
|
protecteddelete |
|
inlineprotected |
Definition at line 230 of file scalar_file.h.
|
inlineprotected |
Definition at line 245 of file scalar_file.h.
|
inlineprotected |
Definition at line 234 of file scalar_file.h.
|
inlineprotected |
Definition at line 236 of file scalar_file.h.
|
inline |
Definition at line 207 of file scalar_file.h.
|
protected |
Definition at line 226 of file scalar_file.h.
|
protected |
Definition at line 225 of file scalar_file.h.
|
protected |
Definition at line 227 of file scalar_file.h.
|
protected |
Definition at line 228 of file scalar_file.h.