snake.mrd_utils.utils#

Utils for the MRD format.

Module Contents#

Classes#

ACQ

Acquisition flags of MRD as an IntFlags.

Functions#

get_waveform_id

Generate a unique id from an input string.

obj2b64encode

Return the base64 encoded pickle of a python object.

b64encode2obj

Load a base64 string as a python object.

API#

snake.mrd_utils.utils.get_waveform_id(input_string: str) int[source]#

Generate a unique id from an input string.

The generated id is guaranteed to be bigger than 1024 and smaller than 2^16.

Parameters:

input_string (str) – The input string from which to generate the unique id.

Returns:

Unique id generated from the input string.

Return type:

int

Examples

>>> generate_unique_id('hello_world')
32767
>>> generate_unique_id('this_is_a_test')
20481
snake.mrd_utils.utils.obj2b64encode(f: Any) bytes[source]#

Return the base64 encoded pickle of a python object.

snake.mrd_utils.utils.b64encode2obj(s: str) Any[source]#

Load a base64 string as a python object.

class snake.mrd_utils.utils.ACQ[source]#

Bases: enum.IntFlag

Acquisition flags of MRD as an IntFlags.

Initialization

Initialize self. See help(type(self)) for accurate signature.

FIRST_IN_ENCODE_STEP1 = None#
LAST_IN_ENCODE_STEP1 = None#
FIRST_IN_ENCODE_STEP2 = None#
LAST_IN_ENCODE_STEP2 = None#
FIRST_IN_AVERAGE = None#
LAST_IN_AVERAGE = None#
FIRST_IN_SLICE = None#
LAST_IN_SLICE = None#
FIRST_IN_CONTRAST = None#
LAST_IN_CONTRAST = None#
FIRST_IN_PHASE = None#
LAST_IN_PHASE = None#
FIRST_IN_REPETITION = None#
LAST_IN_REPETITION = None#
FIRST_IN_SET = None#
LAST_IN_SET = None#
FIRST_IN_SEGMENT = None#
LAST_IN_SEGMENT = None#
IS_NOISE_MEASUREMENT = None#
IS_PARALLEL_CALIBRATION = None#
IS_PARALLEL_CALIBRATION_AND_IMAGING = None#
IS_REVERSE = None#
IS_NAVIGATION_DATA = None#
IS_PHASECORR_DATA = None#
LAST_IN_MEASUREMENT = None#
IS_HPFEEDBACK_DATA = None#
IS_DUMMYSCAN_DATA = None#
IS_RTFEEDBACK_DATA = None#
IS_SURFACECOILCORRECTIONSCAN_DATA = None#
IS_PHASE_STABILIZATION_REFERENCE = None#
IS_PHASE_STABILIZATION = None#
COMPRESSION1 = None#
COMPRESSION2 = None#
COMPRESSION3 = None#
COMPRESSION4 = None#
USER1 = None#
USER2 = None#
USER3 = None#
USER4 = None#
USER5 = None#
USER6 = None#
USER7 = None#
USER8 = None#