Skip to content

Python module to handle Bruker Paravision MRI files (parameter files, raw data, processed data).

License

Notifications You must be signed in to change notification settings

rniilartey/brukerMRI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brukerMRI

Python module to read in Bruker MRI files (parameter files, raw data, processed data). Reconstruction of the raw data is currently only supported for the FLASH method.

/img/brukerMRI.PNG

Requirements

The python module numpy is required (tested with version 1.6.2). The code itself is designed for python 2.7.

Running the example

  • Copy the files brukerMRI.py, example.py and the folder example_dataset into a directory.
  • Switch to that directory and run the example from the shell using
python example.py

Usage

Installation

Copy the file brukerMRI.py to your working directory or add it to PYTHONPATH.

Loading a MRI experiment

Import the brukerMRI module with the statement

import BrukerMRI as bruker

Bruker Paravision stores the MRI experiments in separate folders, which are consecutively numbered. To load an experiment, specify both the main folder, and the experiment number, e.g.

MainDir = "/opt/data/usr/nmr/exp1/"
ExpNum = 100
Experiment = bruker.ReadExperiment(MainDir, ExpNum)

Experiment is now an instance of the class BrukerData. The most important attributes of that class are listed below.

AttributeTypeDescription
methoddictmethod parameters
acqpdictacquisition parameters
recodictreco parameters
raw_fidnumpy arraycomplex raw data
proc_datanumpy arraydata as processed in Paravision
k_datanumpy arraycomplex k-space data
reco_datanumpy arraycomplex reconstruction of k-space

To display e.g. the echo time of the currently loaded experiment, type

print Experiment.method["PVM_EchoTime"]

When an experiment is loaded with bruker.ReadExperiment(), the parameter files as well as the raw data and the processed data are read in. However, no reconstruction on the raw data is performed. This is described in the next section.

Reconstruction of an MRI experiment

To reconstruct the raw data of an experiment, simply type

Experiment.ReconstructKspace()

This will first call the function GenerateKspace(), which reorders the raw data to obtain a valid k-space. Then, the function _ReconstructKspace() is called, which decides, based on the experiment’s method, which function has to be called to reconstruct the data properly. The k-space and the reconstructed image data are then stored in the class attributes k_data and reco_data, respectively.

Note that both ReconstructKspace() and GenerateKspace() can only be called if the corresponding method is supported. Up to now, this is only the case for the FLASH method and for the UFZ_CEST_RARE method (ultrafast z-spectroscopy as described in this publication).

Loading a parameter file

Parameter files can also be loaded without loading the experiment by using the function ReadParamFile:

import BrukerMRI as bruker
FilePath = "example_dataset/100/method"
method_dict = bruker.ReadParamFile(FilePath)

About

Python module to handle Bruker Paravision MRI files (parameter files, raw data, processed data).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%