From 27f91bbd414efd450aba0261e92f0b0729a9dbdc Mon Sep 17 00:00:00 2001 From: Omer Faruk Gulban Date: Mon, 27 Feb 2023 13:41:20 +0100 Subject: [PATCH] Cosmetics --- bvbabel/roi.py | 11 ++++++----- bvbabel/sdm.py | 1 + examples/read_write_fmr.py | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bvbabel/roi.py b/bvbabel/roi.py index f0cdfe9..827a06c 100644 --- a/bvbabel/roi.py +++ b/bvbabel/roi.py @@ -2,6 +2,7 @@ import numpy as np + # ============================================================================= def read_roi(filename): """Read BrainVoyager ROI file, FileVersion = 6. @@ -32,7 +33,7 @@ def read_roi(filename): header[content[0]] = int(content[1]) else: header[content[0]] = content[1] - + # ROI data (x, y, z coordinates of voxels) count_roi = -1 data_roi = list() @@ -48,16 +49,16 @@ def read_roi(filename): elif content[0] == "FromSlice": data_roi[count_roi]["FromSlice"] = int(content[1]) - + elif content[0] == "Left": data_roi[count_roi]["Left"] = int(content[1]) - + elif content[0] == "Right": data_roi[count_roi]["Right"] = int(content[1]) - + elif content[0] == "Top": data_roi[count_roi]["Top"] = int(content[1]) - + elif content[0] == "Bottom": data_roi[count_roi]["Bottom"] = int(content[1]) diff --git a/bvbabel/sdm.py b/bvbabel/sdm.py index fc7aa13..816e074 100644 --- a/bvbabel/sdm.py +++ b/bvbabel/sdm.py @@ -139,6 +139,7 @@ def write_sdm(filename, header, data_sdm): else: f.write("\n") + def create_sdm(): """Create BrainVoyager SDM file with default values. diff --git a/examples/read_write_fmr.py b/examples/read_write_fmr.py index 43727d0..c68550f 100644 --- a/examples/read_write_fmr.py +++ b/examples/read_write_fmr.py @@ -2,13 +2,17 @@ import os import bvbabel +from pprint import pprint -FILE = "/home/faruk/Documents/test_bvbabel/fmr/nifti_converted.fmr" +FILE = "/home/faruk/Documents/test_bvbabel/S01_RUN_01_SCSTBL_3DMCTS_LTR_THPGLMF6c_TDTS2.0dp_FLIRT_TU.fmr" # ============================================================================= # Load FMR (and its paired STC file) header, data = bvbabel.fmr.read_fmr(FILE) +# See header information +pprint(header) + # Save FMR (and its paired STC file) basename = FILE.split(os.extsep, 1)[0] outname = "{}_bvbabel.fmr".format(basename)