BrainVoyager Python Developer Guide 0.9

Creation of Anatomical Documents

The following commands are exposed by the BrainVoyager object to enable the creation of anatomical documents from original (scanner) MRI files.

 

create_vmr_dicom(str file_of_series) → DocPyBV

Description
Creates a VMR DocPyBV document object from raw (image space) DICOM MRI file(s). The returned document object can be used subsequently to call commands for e.g. inhomogeneity correction and brain normalization. The command only needs as input a path to one DICOM file of the respective series representing the 3D anatomical scan; all other parameters to create the document will be extracted from the DICOM header. For a more general function reading DICOM as well as other data types, see the description of the "create_vmr()" command below.
file_of_series (str):
A string specifying the file path to one file of the respective DICOM series.

 

create_vmr_dicom_nifti_bids(str file_of_series, int subj_id, int ses_id, str project_folder) → str

Description
Creates a NIfTI file from raw (image space) DICOM MRI file(s). For reading in the data, the command only needs as input a path to one DICOM file of the respective series ('file_of_series') representing the 3D anatomical scan. The parameters 'subj_id', 'ses_id' are used to create a BIDS conform file name and to put the file (plus a sidecar JSON file) in the BIDS conform subfolder inside a project referenced with the 'project_folder' parameter; in case the referenced project does not yet exist in the default projects directory, the project folder is created and the nifti file saved in the subject and session specific sub-folder. On success, the file path of the created NIfTI file is returned, otherwise an empty string.
file_of_series (str):
A string specifying the file path to one file of the respective series.
subj_id (int):
Integer value identifying the subject; note that the provided integer is used to build a "sub-{subj_id}" string, e.g. "sub-07" in case of value 7.
ses_id (int):
Integer value identifying the session to which the scan belongs; note that the provided integer is used to build a "ses-{ses_id}" string, e.g. "ses-01" in case of value 1.
project_folder (str):
A string specifying the name of the project to which the created NIfTI file should be added. If the project does not exist, a new folder with the provided name is created in the projects path (default: "[user]/Documents/BrainVoyager/Projects"). If project_folder contains a full path, the NIfTI data is stored at the indicated location instead of the standard projects path.  

 

create_vmr(str scanner_file_type, str first_file, int n_slices, bool big_endian, int slice_rows, int slice_cols, int bytes_per_pixel) → DocPyBV

Description
Creates a VMR DocPyBV document object from specified data source, i.e. raw MRI file(s). The returned document object can be used subsequently to call commands for e.g. inhomogeneity correction and brain normalization.
scanner_file_type (str):
A string specifying the type of the raw data, including "DICOM" (default), "ANALYZE", "PHILIPS_REC" and various GE formats.
first_file (str):
Specifies the location and name of the first file to use for project creation; in case that a document should be created from multiple files (usual case for DICOM files), this file is only the first of a sequence and subsequent files are found on disk by incrementing a corresponding file number. For Dicom files it is recommended to run the "RenameDicom" command in a data source folder so that the file numbers are interpretable by BrainVoyager. If the provided filename does not include a full path, make sure that the current directory is set appropriately.
n_slices (int):
Specifies the expected number o slices comprising the 3D anatomical volume scan.
big_endian (bool):
Specifies whether the imported data has little endian byte order (false, recommended as default) or big endian byte order (true). In case that imported images look like salt and pepper noise, try switching this flag. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
slice_rows (int):
Specifies the number of rows of a single slice. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
slice_cols (int):
Specifies the number of columns of a single slice. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
bytes_per_pixel (int):
Specifies how many bytes represent the intensity value of a pixel (usually 2). If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.

 

create_amr(str scanner_file_type, str first_file, int n_slices, bool big_endian, int slice_rows, int slice_cols, int bytes_per_pixel) → DocPyBV

Description
Creates a AMR DocPyBV document object from specified data source, i.e. raw MRI file(s). AMR documents can be used to visualize any (anatomical) multi-slice MRI data as a set of slices. AMR files are also used in the context of FMR projects to visualize slices of a reference volume as background for functional data visualization usually with better resolution (interpolated) and/or from a T1 saturated functional volume.
file_type (str):
A string specifying the type of the raw data, including "DICOM" (default), "ANALYZE", "PHILIPS_REC" and various GE formats.
first_file (str):
Specifies the location and name of the first file to use for project creation; in case that a document should be created from multiple files (usual case for DICOM files), this file is only the first of a sequence and subsequent files are found on disk by incrementing a corresponding file number. For Dicom files it is recommended to run the "RenameDicom" command in a data source folder so that the file numbers are interpretable by BrainVoyager. If the provided filename does not include a full path, make sure that the current directory is set appropriately.
n_slices (int):
Specifies the expected number o slices comprising the 3D anatomical volume scan.
big_endian (bool):
Specifies whether the imported data has little endian byte order (false, recommended as default) or big endian byte order (true). In case that imported images look like salt and pepper noise, try switching this flag. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
slice_rows (int):
Specifies the number of rows of a single slice. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
slice_cols (int):
Specifies the number of columns of a single slice. If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.
bytes_per_pixel (int):
Specifies how many bytes represent the intensity value of a pixel (usually 2). If this value can be retrieved from the file header (e.g. for DICOM data), the provided value will be ignored.

 

Copyright © 2020 Rainer Goebel. All rights reserved.