JEMRIS  2.8.2
open-source MRI simulations
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
Sample Class Reference

The Sample is the object to simulate. It contains the spins. More...

#include <Sample.h>

+ Inheritance diagram for Sample:
+ Collaboration diagram for Sample:

Public Member Functions

 Sample ()
 
 Sample (const string &file, const int multiple=1)
 
 Sample (const size_t size)
 
virtual ~Sample ()
 
virtual void Prepare (const std::string &fname="")
 
void ClearSpins ()
 delete the spin structure
 
void CreateSpins (const size_t size)
 create the spin structure More...
 
void CreateSpins (const size_t nprops, const size_t size)
 create the spin structure More...
 
size_t GetSize () const
 
size_t GetNProps () const
 
vector< size_t > GetSampleDims () const
 
void SetSampleDims (vector< size_t > d)
 
const int GetSampleDimsSize () const
 Dimensions. More...
 
SampleGetSubSample (const int n, const size_t size)
 
void GetValues (const size_t l, double *val)
 Get values for spin l and deliver them in val. More...
 
double * GetResolution ()
 Get grid resolution. More...
 
void InitRandGenerator (int val=1)
 Initialize the randome number generator. More...
 
void SetR2Prime (double val)
 Set the random local field fluctuations. More...
 
void SetPositionRandomness (double val)
 Set the position randomness in per cent of the cartesian resolution. More...
 
double GetDeltaB (size_t pos=-1)
 Get off-resonance of a specific spin. More...
 
virtual IO::Status Populate (const string &file)
 
double * GetSpinsData ()
 
void SetReorderStrategy (string strat)
 
void ReorderSample ()
 
void DumpRestartInfo (CoilArray *RxCA)
 Utility function for restart: dump information to restart jemris after crash.
 
void ReportSpin (int beg, int end, int value)
 Utility function for restart: mark spins which have been calculated.
 
int ReadSpinsState ()
 Utility function for restart: Read restart file after crash.
 
void ClearSpinsState ()
 Utility function for restart: mark all spins as not simulated.
 
void GetScatterVectors (int *sendcount, int *displ, int size)
 utility function to send sample in parallel mode: initial samples are send via mpi_scatterv; get needed vectors to scatter data.
 
void GetNextPacket (int &noSpins, int &NextSpinToSend, int SlaveId)
 utility function to send sample in parallel mode: get next spin packet to be sent. (beginning index + no_spins to send)
 
int SpinsLeft ()
 Returns No spins which still needs to be calculated.
 
void SetTimeInterval (double val)
 Set Time interval in seconds after which new spins are sent (approx. value.)
 
bool IsRestart ()
 true if simulation run is from a restart
 
void GetHelper (double *target)
 
double * GetHelper ()
 
size_t GetHelperSize ()
 
int GetNoSpinCompartments ()
 
void SetNoSpinCompartments (int n)
 
void CreateHelper (const size_t l)
 
void CreateDims (const size_t l)
 
void CopyHelper (double *out)
 
virtual void CropEnumerate ()
 

Protected Member Functions

void MultiplySample (int multiple)
 

Protected Attributes

Ensemble< double > m_ensemble
 
vector< size_t > m_index
 
vector< double > m_res
 
vector< double > m_offset
 
RNG m_rng
 
double m_r2prime
 
double m_pos_rand_perc
 
SampleReorderStrategyInterfacem_reorder_strategy
 
int m_max_paket_size
 
int m_min_paket_size
 
int m_next_spin_to_send
 
vector< char > m_spin_state
 
bool m_is_restart
 
vector< int > m_spins_sent
 
vector< int > m_last_offset_sent
 
vector< timeval > m_last_time
 
double m_sent_interval
 
double m_total_cpu_time
 
double m_no_spins_done
 
vector< double > m_helper
 
int m_no_spin_compartments
 

Detailed Description

The Sample is the object to simulate. It contains the spins.

Constructor & Destructor Documentation

§ Sample() [1/3]

Sample::Sample ( )

Constructor

+ Here is the call graph for this function:

§ Sample() [2/3]

Sample::Sample ( const string &  file,
const int  multiple = 1 
)

Constructor

Create a container from binary file

Parameters
fileSample binary file
+ Here is the call graph for this function:

§ Sample() [3/3]

Sample::Sample ( const size_t  size)

Constructor

Create a container of requested size initialized with zeros

Parameters
sizeSize of the sample
+ Here is the call graph for this function:

§ ~Sample()

Sample::~Sample ( )
virtual

Destructor

+ Here is the call graph for this function:

Member Function Documentation

§ CreateSpins() [1/2]

void Sample::CreateSpins ( const size_t  size)

create the spin structure

Parameters
sizeSize of the spin structure to create
+ Here is the call graph for this function:

§ CreateSpins() [2/2]

void Sample::CreateSpins ( const size_t  nprops,
const size_t  size 
)

create the spin structure

Parameters
sizeSize of the spin structure to create
+ Here is the call graph for this function:

§ GetDeltaB()

double Sample::GetDeltaB ( size_t  pos = -1)

Get off-resonance of a specific spin.

The off-resonance is given by the deterministic value, read by Populate from the binary file, plus the random field fluctuation specified by SetR2Prime.

Parameters
posPosition of the spin. If negative, last acquired spin by GetValues is used.
Returns
The off-resonance in unit [Khz]
+ Here is the call graph for this function:

§ GetNProps()

size_t Sample::GetNProps ( ) const
inline

Get number of spin properties including spatial

Returns
Number of spin properties
+ Here is the caller graph for this function:

§ GetResolution()

double* Sample::GetResolution ( )
inline

Get grid resolution.

Returns
Grid resolution

§ GetSampleDims()

vector<size_t> Sample::GetSampleDims ( ) const
inline

Get number of sample dimensions

Returns
number of sample dimensions
+ Here is the caller graph for this function:

§ GetSampleDimsSize()

const int Sample::GetSampleDimsSize ( ) const
inline

Dimensions.

Returns
Dimensions of the ensemble

§ GetSize()

size_t Sample::GetSize ( ) const

Get size of the sample

Returns
Size of the sample
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ GetSpinsData()

double* Sample::GetSpinsData ( )
inline

returns pointer to sample data (needed for MPI send/receive)

§ GetSubSample()

Sample* Sample::GetSubSample ( const int  n,
const size_t  size 
)

Get a subset of this sample

Parameters
nN-th subset
sizeSize of the subset

§ GetValues()

void Sample::GetValues ( const size_t  l,
double *  val 
)

Get values for spin l and deliver them in val.

Parameters
lSpin number
valOutput container
+ Here is the call graph for this function:

§ InitRandGenerator()

void Sample::InitRandGenerator ( int  val = 1)
inline

Initialize the randome number generator.

Parameters
valany integer
+ Here is the caller graph for this function:

§ Populate()

IO::Status Sample::Populate ( const string &  file)
virtual

Create a container from binary file

Parameters
fileSample binary file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ Prepare()

void Sample::Prepare ( const std::string &  fname = "")
virtual

init variables which are same for all constructors

Reimplemented in MultiPoolSample.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ ReorderSample()

void Sample::ReorderSample ( )

executes sample reordering

+ Here is the caller graph for this function:

§ SetPositionRandomness()

void Sample::SetPositionRandomness ( double  val)
inline

Set the position randomness in per cent of the cartesian resolution.

Parameters
valPercentage width of the Gaussian distribution.
+ Here is the caller graph for this function:

§ SetR2Prime()

void Sample::SetR2Prime ( double  val)
inline

Set the random local field fluctuations.

Parameters
valR2Prime (Shaping parameter of the Lorentz distribution in kHz).
+ Here is the caller graph for this function:

§ SetReorderStrategy()

void Sample::SetReorderStrategy ( string  strat)

can set a method to reorder the sample (do nothing, shuffle sample,... )

+ Here is the caller graph for this function:

§ SetSampleDims()

void Sample::SetSampleDims ( vector< size_t >  d)
inline

Get number of sample dimensions

Returns
number of sample dimensions

Member Data Documentation

§ m_ensemble

Ensemble<double> Sample::m_ensemble
protected

clones sample 'multiple'-times, e.g. for diffusion simulation

§ m_is_restart

bool Sample::m_is_restart
protected

keeps track whether spin is not touched (==0), sent (==1) or calculated (==2)

§ m_last_offset_sent

vector<int> Sample::m_last_offset_sent
protected

no of spins last sent to each slave

§ m_last_time

vector<timeval> Sample::m_last_time
protected

offset to the last spins sent

§ m_min_paket_size

int Sample::m_min_paket_size
protected

maximal no of spins to send

§ m_next_spin_to_send

int Sample::m_next_spin_to_send
protected

minimal no of spins to send

§ m_offset

vector<double> Sample::m_offset
protected

< Sample resolution [mm]

§ m_pos_rand_perc

double Sample::m_pos_rand_perc
protected

< R2-Prime == shaping parameter of the Lorentzian distribution

§ m_r2prime

double Sample::m_r2prime
protected

< random number generator

§ m_reorder_strategy

SampleReorderStrategyInterface* Sample::m_reorder_strategy
protected

< Percantage (of cartesian resolution) randomness in spin position .

§ m_res

vector<double> Sample::m_res
protected

< Sample dimensions

§ m_rng

RNG Sample::m_rng
protected

< Sample offeset to {0,0,0} origin

§ m_sent_interval

double Sample::m_sent_interval
protected

last timepoint at which spins were sent

§ m_spins_sent

vector<int> Sample::m_spins_sent
protected

true if simulation run is from a restart

§ m_total_cpu_time

double Sample::m_total_cpu_time
protected

approx. time in seconds after which new spins are sent


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

-- last change 24.05.2018 | Tony Stoecker | Imprint | Data Protection --