BrainVoyager Python Developer Guide 0.9

Creation of Diffusion-Weighted Documents

The following commands are exposed by the general object "BrainVoyager" that is made available to any Python script.

NOTE. New dicom/bids creation commands will be added.


create_dmr(str scanner_file_type, str first_file, int n_volumes, int skip_n_volumes, bool first_volume_amr, int n_slices, str fmr_stc_filename, bool big_endian, int slice_rows, int slice_cols, int bytes_per_pixel, str targetFolder) → PyDoc

Description
Creates a DMR document from specified data source, i.e. files containing a series of diffusion-weighted volumes. The returned document object can be used subsequently to call commands for e.g. preprocessing and diffusion-weighted MRI analysis. Depending on the file types, this command may or may not read and attach the direction table and this should be checked. Note that for Siemens mosaic files, the "create_mosaic_dmr" command should be used (see below).
scanner_file_type (str):
Specifies the type of the raw data, including "DICOM" (default), "ANALYZE", "PHILIPS_REC" and various GE types.
first_file (str):
Specifies 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 "rename_dicoms" 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_volumes (int):
Specifies the number of volumes to read (usually the full number of volumes scanned in the respective scanning run).
skip_n_volumes (int):
Specifies the number of volumes at the begin of the data that will not be included (usually 0); the number of volumes in the created DMR file will be: n_volumes - skip_n_volumes.
first_volume_amr (bool):
Specifies whether a AMR file should be created from the first functional volume (true) or not (false). The created AMR file will be used as the default display of slices when a created (or loaded) DMR document is shown. This is especially useful in case that first volumes have been scanned with T1 saturation providing better grey/white matter contrast. These ("prepartory") T1 saturated volumes are usually skipped using the "skip_n_volumes" parameter. Note that in recent years, scanners remove T1 saturated volumes during preparation of functional scanning so first volumes are usually not T1 saturated and no initial volumes need to be skipped.
n_slices (int):
Specifies the expected number of slices comprising each volume.
dmr_dwi_filename (str):
Name (without extension) of the created DMR (header) and DWI (data) file; note that the DMR file itself contains only meta information and references the actual data DWI file (and other auxiliary files).
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.
target_folder (str):
Specifies the directory where the created FMR project and associated files (e.g. .stc, .amr files) will be stored.

 

create_mosaic_dmr(str first_file, int n_volumes, int skip_n_volumes, bool, first_volume_amr, int n_slices, str dmr_dwi_filename, bool big_endian, int mosaic_rows, int mosaic_cols, int slice_rows, int slice_cols, int bytes_per_pixel, str target_folder) → DocPyBV

Description
Creates a DMR document object from a series of Siemens mosaic files, each containing usually one direction (or b0) volume. This special Siemens format "pretends" each file to be a single image allowing to store all slices of a functional volume in a single "big" DICOM file instead of a set of standard DICOM files; the mosaic arrangement of the individual slices leads to a correct display if displayed as an image, which can be checked in BrainVoyager by creating an AMR document from a mosaic file or by creating a "single slice per file" DMR project (see above). For further processing, the mosaic images need to be decomposed into separate slice images, which is performed by this special DMR document creation function. The returned document object can be used subsequently to call commands for e.g. preprocessing and diffusion-weighted analyses.
first_file (str):
Specifies the first file to use for document creation; the specified file is usually only the first of a series and subsequent files are found on disk by incrementing a corresponding volume number. 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_volumes (int):
Specifies the number of functional volumes to read (usually the full number of volumes scanned in the respective scanning run).
skip_n_volumes (int):
Specifies the number of volumes at the begin of the data that will not be included (usually 0); the number of functional volumes in the created FMR file will be: nrOfVolumes - nrOfVolumesToSkip.
first_volume_amr (bool):
Specifies whether a AMR file should be created from the first functional volume (true) or not (false). The created AMR file will be used as the default display of slices when a created (or loaded) FMR document is shown. This is especially useful in case that first volumes have been scanned with T1 saturation providing better grey/white matter contrast. These T1 saturated volumes are usually skipped using the nrOfSkipVolumes parameter. Note that in recent years, scanners remove T1 saturated volumes during preparation of functional scanning so first volumes are usually not T1 saturated and no initial volumes need to be skipped.
n_slices (int):
Specifies the expected number of slices comprising each functional volume.
dmr_dwi_filename  (str):
Name of the prefix used for the created DMR (header) file and DWI file containing the diffusion-weighted data; note that the DMR file itself contains only meta information referring to the DWI file (and other auxiliary files).
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.
mosaic_rows  (int):
Specifies the number of rows of a mosaic image, which is a multiple of the rows of a single slice. If this value can be retrieved from the DICOM file header, the provided value will be ignored.
mosaic_cols  (int):
Specifies the number of columns of a mosaic image, which is a multiple of the columns of a single slice. If this value can be retrieved from the file DICOM file header, the provided value will be ignored.
slice_rows  (int):
Specifies the number of rows of a single slice inside the mosaic file. 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 inside the mosaic file. 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.
target_folder  (str):
Specifies the directory where the created FMR project and associated files (e.g. .stc, .amr files) will be stored.


Copyright © 2020 Rainer Goebel. All rights reserved.