Developer documentation
Version 3.0.3-105-gd3941f44
MR::DWI::Tractography::WriterUnbuffered< ValueType > Class Template Reference

class to handle unbuffered writing of tracks to file More...

#include "dwi/tractography/file.h"

Inheritance diagram for MR::DWI::Tractography::WriterUnbuffered< ValueType >:
MR::DWI::Tractography::WriterInterface< float >

Public Types

using vector_type = Eigen::Matrix< ValueType, 3, 1 >
 

Public Member Functions

 WriterUnbuffered (const std::string &file, const Properties &properties)
 create a new track file with the specified properties More...
 
bool operator() (const Streamline< ValueType > &tck)
 append track to file More...
 
void set_weights_path (const std::string &path)
 set the path to the track weights More...
 
- Public Member Functions inherited from MR::DWI::Tractography::WriterInterface< float >
virtual bool operator() (const Streamline< float > &)=0
 
virtual ~WriterInterface ()
 

Protected Member Functions

vector_type delimiter () const
 indicates end of track and start of new track More...
 
vector_type barrier () const
 indicates end of data More...
 
void format_point (const vector_type &src, vector_type &dest)
 perform per-point byte-swapping if required More...
 
void write_weights (const std::string &contents)
 write track weights data to file More...
 
void commit (vector_type *data, size_t num_points)
 write track point data to file More...
 
 WriterUnbuffered (const WriterUnbuffered &)=delete
 copy construction explicitly disabled More...
 

Protected Attributes

std::string weights_name
 
int64_t barrier_addr
 

Detailed Description

template<class ValueType = float>
class MR::DWI::Tractography::WriterUnbuffered< ValueType >

class to handle unbuffered writing of tracks to file

writes track header as specified in properties and individual tracks to the file specified in file. Writing individual tracks is done using the operator() method.

This class re-opens the output file every time a new streamline is written. This may result in slow operation in some circumstances, and may lead to fragmentation on some file systems, but is necessary in use cases where a very large number of track files are being written at once. For most applications (where typically one track file is written at a time), the Writer class is more appropriate.

Definition at line 204 of file file.h.

Member Typedef Documentation

◆ vector_type

template<class ValueType = float>
using MR::DWI::Tractography::WriterUnbuffered< ValueType >::vector_type = Eigen::Matrix<ValueType,3,1>

Definition at line 216 of file file.h.

Constructor & Destructor Documentation

◆ WriterUnbuffered() [1/2]

template<class ValueType = float>
MR::DWI::Tractography::WriterUnbuffered< ValueType >::WriterUnbuffered ( const std::string &  file,
const Properties properties 
)
inline

create a new track file with the specified properties

Definition at line 219 of file file.h.

◆ WriterUnbuffered() [2/2]

template<class ValueType = float>
MR::DWI::Tractography::WriterUnbuffered< ValueType >::WriterUnbuffered ( const WriterUnbuffered< ValueType > &  )
protecteddelete

copy construction explicitly disabled

Member Function Documentation

◆ barrier()

template<class ValueType = float>
vector_type MR::DWI::Tractography::WriterUnbuffered< ValueType >::barrier ( ) const
inlineprotected

indicates end of data

Definition at line 288 of file file.h.

◆ commit()

template<class ValueType = float>
void MR::DWI::Tractography::WriterUnbuffered< ValueType >::commit ( vector_type data,
size_t  num_points 
)
inlineprotected

write track point data to file

Note
buffer needs to be greater than num_points by one element to add the barrier.

Definition at line 311 of file file.h.

◆ delimiter()

template<class ValueType = float>
vector_type MR::DWI::Tractography::WriterUnbuffered< ValueType >::delimiter ( ) const
inlineprotected

indicates end of track and start of new track

Definition at line 286 of file file.h.

◆ format_point()

template<class ValueType = float>
void MR::DWI::Tractography::WriterUnbuffered< ValueType >::format_point ( const vector_type src,
vector_type dest 
)
inlineprotected

perform per-point byte-swapping if required

Definition at line 291 of file file.h.

◆ operator()()

template<class ValueType = float>
bool MR::DWI::Tractography::WriterUnbuffered< ValueType >::operator() ( const Streamline< ValueType > &  tck)
inline

append track to file

Definition at line 252 of file file.h.

◆ set_weights_path()

template<class ValueType = float>
void MR::DWI::Tractography::WriterUnbuffered< ValueType >::set_weights_path ( const std::string &  path)
inline

set the path to the track weights

Definition at line 273 of file file.h.

◆ write_weights()

template<class ValueType = float>
void MR::DWI::Tractography::WriterUnbuffered< ValueType >::write_weights ( const std::string &  contents)
inlineprotected

write track weights data to file

Definition at line 300 of file file.h.

Member Data Documentation

◆ barrier_addr

template<class ValueType = float>
int64_t MR::DWI::Tractography::WriterUnbuffered< ValueType >::barrier_addr
protected

Definition at line 283 of file file.h.

◆ weights_name

template<class ValueType = float>
std::string MR::DWI::Tractography::WriterUnbuffered< ValueType >::weights_name
protected

Definition at line 282 of file file.h.


The documentation for this class was generated from the following file: