Data representing the entire MR sequence.
More...
#include <ExternalSequence.h>
|
typedef void(* | PrintFunPtr) (const std::string &str) |
| A pointer-type to the low-level print function.
|
|
|
static std::istream & | getline (std::istream &stream, char *buffer, const int MAX_SIZE) |
| Read a line from the input stream independent of line ending. More...
|
|
static void | defaultPrint (const std::string &str) |
| Print string to standard output (with newline character)
|
|
Data representing the entire MR sequence.
This class defines an abstract sequence consisting of arbitrary blocks The basic structure of the sequence consists of three hierarchical levels:
- Block - list of integer indices pointing to simultaneous events for RF, gradients, ADC.
- Event - Basic event with one of the following types:
- delay - Simple delay
- RF - contains amplitude, frequency offset, and two indices pointing to basic shape for amp & phase
- Trapezoid gradient - contains amplitude, ramp up, flat top, ramp down times
- Arbitrary gradient - contains amplitude and index to basic shape
- ADC readout - contains number of samples, dwell time, delay, frequency & phase offsets
- Shape - List of compressed samples defining a basic shape (arbitrary RF or gradient)
- Author
- Kelvin Layton kelvi.nosp@m.n.la.nosp@m.yton@.nosp@m.unik.nosp@m.linik.nosp@m.-fre.nosp@m.iburg.nosp@m..de
- Date
- May 2014
- Examples:
- parsemr.cpp.
void ExternalSequence::buildFileIndex |
( |
std::ifstream & |
stream | ) |
|
|
private |
Search the file stream for section headers e.g. [RF], [GRAD] etc.
Searches forward in the stream for sections enclosed in square brackets and writes to index
bool ExternalSequence::checkBlockReferences |
( |
EventIDs & |
events | ) |
|
|
private |
Check the IDs contains references to valid events in the library.
- Parameters
-
events | The event IDs to check |
- Returns
- true if event references are ok
- See also
- checkRF(), checkGradient()
void ExternalSequence::checkGradient |
( |
SeqBlock & |
block | ) |
|
|
private |
Check the shapes defining the arbitrary gradient events (if present)
Check the decompressed amplitude of the given block is between [0 1].
- Parameters
-
block | The sequence block to check |
- See also
- checkRF()
void ExternalSequence::checkRF |
( |
SeqBlock & |
block | ) |
|
|
private |
Check the shapes defining the RF event (if present)
Check the decompressed RF amplitude of the given block is between [0 1] and the phase between [0 2pi].
- Parameters
-
block | The sequence block to check |
- See also
- checkGradient()
bool ExternalSequence::decodeBlock |
( |
SeqBlock * |
block | ) |
|
Decode a block by looking up indexed events.
This involves assigning the block's event objects from the libraries as well as decompressing arbitrary RF and gradient shapes.
- Returns
- true if successful
bool ExternalSequence::decompressShape |
( |
CompressedShape & |
encoded, |
|
|
float * |
shape |
|
) |
| |
|
private |
Decompress a run-length compressed shape.
- Parameters
-
encoded | Compressed shape structure |
shape | array of floating-point values (must be preallocated!) |
SeqBlock * ExternalSequence::GetBlock |
( |
int |
blockIndex | ) |
|
Construct a sequence block from the library events.
Events are loaded from the library. However, arbitrary waveforms are not decoded until decodeBlock() is called.
- See also
- decodeBlock()
- Examples:
- parsemr.cpp.
std::vector< double > ExternalSequence::GetDefinition |
( |
std::string |
key | ) |
|
|
inline |
Lookup the custom definition.
Search the list of user-specified definitions through the [DEFINITIONS] section. If the definition key is not found, an empty vector is returned.
- Parameters
-
- Returns
- a list of values (or empty vector)
std::istream & ExternalSequence::getline |
( |
std::istream & |
stream, |
|
|
char * |
buffer, |
|
|
const int |
MAX_SIZE |
|
) |
| |
|
staticprivate |
Read a line from the input stream independent of line ending.
Unlike istream::getline(), this function safely handles three different line endings:
- Unix/OSX (\n)
- Windows (\r\n)
- Old Mac (\r)
- Parameters
-
stream | the input file stream to read from |
buffer | the output line buffer (null terminated) |
MAX_SIZE | maximum size of the buffer |
bool ExternalSequence::load |
( |
std::string |
path | ) |
|
Load the sequence from file.
Reads the sequence files into the class members, the sequence is stored in compressed format. The given path refer to either:
- A single file with all sequence definitions
- A directory containing a single file (e.g. external.seq)
- A directory containing three files (blocks.seq, events.seq, shapes.seq)
- Parameters
-
path | location of file or directory |
- Examples:
- parsemr.cpp.
void ExternalSequence::print_msg |
( |
MessageType |
level, |
|
|
std::ostream & |
ss |
|
) |
| |
|
static |
Display an output message.
Display a message only if the MSG_LEVEL is sufficiently high. This function calls the low-level output function, which can be overridden using SetPutMsgFunction().
- Parameters
-
level | type of message |
ss | string stream containing the message |
void ExternalSequence::SetPrintFunction |
( |
PrintFunPtr |
fun | ) |
|
|
inlinestatic |
Set the output print function.
Set the low-level output function to be used for printing or logging messages. If no function is specified messages will be printed to cout
- Parameters
-
- Examples:
- parsemr.cpp.
void ExternalSequence::skipComments |
( |
std::ifstream & |
stream, |
|
|
char * |
buffer |
|
) |
| |
|
private |
Skip the comments and empty lines in the given input stream.
- Parameters
-
stream | the input file stream to process |
buffer | return output buffer of next non-comment line |
The documentation for this class was generated from the following files:
- C:/MinGW/msys/1.0/home/layton/code/pulseq_public/src/ExternalSequence.h
- C:/MinGW/msys/1.0/home/layton/code/pulseq_public/src/ExternalSequence.cpp