Modules - Core Modules

 Included Core Modules

The following “core” modules are included in the YarraServer installation package. The binaries are located in the folder yarra/modules. They can be referenced using the helper macro %bd. Sometimes, beta versions of updated core modules are released. It is possible to install these versions as user modules in parallel to the version that comes with the YarraServer release (in this case, the macro for calling the modules has to be replaced by %bu).

 DriveTransfer  Transfer
Author: Kai Tobias Block
Version: 0.11b6


Transfers reconstructed DICOM images onto a network share (or mounted disk drive).


DriveTransfer [mode file] [directory with DICOMs] [unique task name]

Typical call:

Args=%mc %td %vuid


In .mode file:

TargetPath=#Path to target location, e.g. /media/yarra_out
 IniPatch  Preprocessing
Author: Kai Tobias Block
Version: 0.12


Creates a “patched” copy of a source ini file in the work directory with the given name. All keys specified in the mode file will be replaced by the param value passed as 4th argument, or by statically defined values written into the mode file.


IniPatch [mode file] [source ini file] [target (in work dir)] [param value]

Typical call:

Args=%mc %md/template.ini %rid/settings.ini %vparam


In .mode file:

PatchKey1=#Name of entry to patch in format section/entry, e.g. Preprocessing/SpokesPerFrame1
PatchKey2=#Name of 2nd entry to patch
PatchKey3=#Name of addition entry (up to 50 possible)

The section [IniPatch] defines those keys that should be overwritten (dynamically) with the value passed as 4th function argument. The section [IniPatch_static] can be used to define a number of keys that are overwritten by fixed values. An unlimited number of keys can be defined using the notation SectionName/KeyName=Value.

 SetDCMTags  Postprocessing
Author: Kai Tobias Block
Version: 0.1b9


Populates the DICOM tags of reconstructed images based on patient and scan information read from the Twix file. It also combines DICOM files into series based on the file name and sets the needed DICOM UUIDs.


SetDCMTags [options] input output rawfile


  input   -- Folder with DICOM files to process
  output  -- Folder where modified DICOM files will be written
  rawfile -- Path and name of raw-data file


  -a -- Accession number
  -t -- Path and name of task file
  -m -- Path and name of mode file
  -d -- Path and name of dynamic settings
  -l -- Extended log output for debugging
  -v -- Show version information and exit

Typical call:

Args=%pid %pod %rid/%rif -a %vacc -m %mc -t %rid/rit


File naming convention

In order for SetDCMTags to correctly group images into series, the DICOMs written by the reconstruction module have to be named according to the syntax:


where {n} is the series # (e.g. time point, in case of 4D MRI data) and {m} is the slice number.

Global options

The following settings can be defined in the [SetDCMTags] section of the .mode file:

SeriesOffset=        // Adds an offset to the series number
Color=               // Set to TRUE if the images are color images
ClearDefaults=       // Set to TRUE if the default tag assignment should not be used
SeriesMode=          // Set to TIME for 4D scans (i.e. if series are different time points)
FrameDuration=       // Defines the duration of one frame of the 4D dataset (in ms)
TimeOffset=          // Adds a time offset for the first frame (in ms)
InterleaveSeries=    // Set to TRUE if the order of series/slices should be swapped
StackSeries=         // Set to TRUE is all images should be stacked in one series
Adding or overwriting tags

SetDCMTags sets most DICOM tags automatically. However, it is possible to overwrite the default assignment or to set additional tags:


where n,m specifies the ID of the tag (see a list of all available DICOM tags here).

Various macros can be used for setting the tags. Using the @ operator, it is possible to reference values from the Twix file. For example, @PatientName returns the patient name. Values contained in the measurement protocol can be referenced using @mrpot. For example, @mrprot.adFlipAngleDegree[0] returns the flip angle of the first pulse. The original value of the DICOM tag can be accessed via #keep (thus, using #keep will preserve the original value instead of overwriting the DICOM tag).

Using the # operator, it is possible to access helper variables that are calculated by SetDCMTags. For example, #series returns the current series number. Using the $ operator, helper functions can be called for manipulating the value: $EXT allows appending information. For example, $EXT(@ProtocolName,_modified) appends the string “_modified” to the protocol name. $DIV divides the value by an integer (as, e.g., needed when converting between ms and sec). For example, $DIV(@mrprot.alTE[0],1000,2) divides the TE time from the protocol by 1000 and keeps 2 digits.

The list of available helper variables can be seen in this file, while the list of values parsed from the Twix file can be found on the bottom of this file. The default assignment that SetDCMTags uses can be seen in this file.

Setting series-specific tags

The values defined in the [SetDCMTags] section will be appied to all series. It is also possible to define values only for certain series. This can be done by adding a section to the .mode file where the series number is appended to the section name. In the following example, these settings would only be applied to series 2:

Setting tags dynamically

Settings for SetDCMTags can be written into the .mode file, so that different settings can be defined for every reconstruction mode. However, sometimes it is necessary to set DICOM tags depending on the result of the indiviudal reconstruction. This is possible by writing these dynamic settings into a new text file that is created by the reconstruction module in the “work” folder %rid (where also the raw-data file is located). The name of the file has to be passed to SetDCMTags via the -d option. SetDCMTags then reads these settings as last step (overwriting all previously defined settings).

 PACSTransfer  Transfer
Author: Kai Tobias Block
Version: 0.4g


Sends all reconstructed DICOM images to one or multiple DICOM nodes (PACS or DICOM workstation). Requires installation of the OFFIS dcmtk package on the server.


PACSTransfer [mode file] [directory with DICOMs]

Typical call:

Args=%mc %td


In .mode file:

IP=#IP of PACS, e.g.
Port=#Port of PACS, e.g. 104
AET=#AET to be used, e.g. YARRA

If the images should be sent to multiple DICOM nodes (up to 20), add to .mode file:

AEC_1=#AEC of PACS 1
IP_1=#IP of PACS 1, e.g.
Port_1=#Port of PACS 1, e.g. 104
AET_1=#AET to be used, e.g. YARRA
AEC_2=#AEC of PACS 2
IP_2=#IP of PACS 2, e.g.
Port_2=#Port of PACS 2, e.g. 104
AET_2=#AET to be used, e.g. YARRA

By default, the PACSTransfer module sends the images one file at a time in the right series order. This is required for some of the PACS systems to ensure that the series are correctly ordered. However, sometimes it is also necessary to send the whole directory all at once (e.g., for recent Syngo.via versions). The latter can be enforced by writing the statement DirMode=true into the respective PACS section (i.e. if multple nodes are used, use DirMode_n=true respectively).

Open Chat