-
Notifications
You must be signed in to change notification settings - Fork 21
Examples
Sebastiano Ferraris edited this page Aug 14, 2017
·
24 revisions
A dataset of MR Bruker images where to test the code can be found here (thanks to Mikaël Naveau).
In the following lines we will convert the images accessing bruker2nifti via
- Python command shell,
- Command Line Utility (CLI) to integrate it in a bash script,
- Graphical User Interface (GUI).
All you need:
- The dataset provided downloaded in a
data_folder
. - A python release with bruker2nifti installed
All in the same Python module:
import os
from bruker2nifti.converter import Bruker2Nifti
if __name__ == '__main__':
root_dir = '/path/to/bruker2nifti/repo'
pfo_study_in = os.path.join(root_dir, 'test_data', 'bru_banana')
pfo_study_out = '/path/to/some/existing/folder/where/conversion/will/happen'
# instantiate a converter - if you do not want to use the default study name in visu_pars set the study name here.
bru = Bruker2Nifti(pfo_study_in, pfo_study_out, study_name='banana')
# select the options (attributes) you may want to change - the one shown below are the default one:
bru.verbose = 2
bru.correct_slope = True
bru.get_acqp = False
bru.get_method = False
bru.get_reco = False
bru.nifti_version = 1
bru.qform_code = 1
bru.sform_code = 2
bru.save_human_readable = True
bru.save_b0_if_dwi = True
bru.correct_slope = False
# Check that the list of scans and the scans names automatically selected makes some sense:
print(bru.scans_list)
print(bru.list_new_name_each_scan)
print(bru.list_new_nifti_file_names)
# call the function convert, to convert the study:
bru.convert()
Type
python parsers/bruker2nii -h
for help and see the options.
Check the next wiki-page to convert the data_set examples with the GUI.