ODIN
ODIN data processing framework (odindata library)

This page describes the design guidelines of the module Classes of the ODIN data processing framework (odindata library)

Blitz++ for NMR

The Blitz++ library is great for numerical calculations, but it lacks some functionality that is crucial when using it together with NMR data:

  • Convenient input/output of medical image data
  • Numerical routines essential for NMR (FFT, gridding, fitting, ...)
  • Associating large data files on disk with arrays in memory

For this reason, ODIN contains two classes that help dealing with these tasks:

  • Data: A template class derived from the Blitz++ Array class that has the ability to be associated with a raw data file for read and write access. This is done by using the mmap function so that no extra memory is allocated on contstruction. Instead, the task of reading/writing is handled transparently by the operating system. Any changes made to the array in memory are also visible in the file on disk. With this mechanism, arrays that are larger than the available RAM can be handled without extra effort. In addition, member functions Data::autoread() and Data::autowrite() are available to load/store the data in different file formats using the FileIO module (Input/Output of medical image data (odindata library) ).
  • ComplexData: A template class with a fixed storage type of complex numbers. It contains useful functions to deal with NMR data (FFT,...). On construction, it can be associated with raw data on disk (16bit, 32bit, float) and blocks of the file can be loaded subsequently into memory for further processing.

Common Numerical Operations

In order to offer a framework for other numerical calculations, the following functions/classes are available within ODIN:

Gridding

Regridding an array from one Cartesian grid to another can be done using the Data::congrid() member function. In addition, the functor Gridding can be used to data from a non-Cartesian grid to a Cartesian grid.

Coordinate Transformation

Transforming an array to a new coordinate system by rotation, scaling and shifting can be done by using the CoordTransformation functor.

Fourier Transform

FFT of a whole complex data set can be calculated by the ComplexData::fft() member function. If the FFT has to be applied only for certain dimensions, use ComplexData::partial_fft()

Linear Algebra

The functions solve_linear(), pseudo_inverse() and eigenvalues() will solve a sets of linear equations, calculate the pseudo inverse and eigenvalues, respectively.

Non-Linear Function Fitting

Fitting of functions is accomplished by the two classes ModelFunction and FunctionFit. The former is used as a base class to specify the modelling function by implementing its virtual functions. The latter is used to do the actual fitting and to store temporary data of the fit.

Linear Regression

The class LinearFunction can be used for linear fitting.

Polynomial Fit

The function polyniomial_fit() provides pixel-wise fitting of polynomials using the values of neighbouring pixels.

Integration of Functions

Integration of one-dimensional functions can be achieved by the two classes Integrand and FunctionIntegral. The former is used as a base class to specify the function by implementing a virtual functions. The latter is used to do the actual integration and to store temporary data.

Basic Statistics

Simple statistics (mean, standard deviation) can be calculated by the statistics() function.

Correlation Analysis

Correlation of two vectors can be calculated by the correlation() function.

Convenient File Input/Output

The functions inside FileIO (Input/Output of medical image data (odindata library) ) are a convenient way ro read/write 4-dim Arrays, a variety of formats common for medical image are supported.