Skip to content

Commit 4699742

Browse files
committed
First implementation. Copy of LabeledWrapStruct without inheritance.
Implement Vtc File NF: implement read and write for BrainVoyager QX VTC files NF+RF: implement read and write support for BrainVoyager QX MSK files and refactor bv.py NF: implement read and write support for BrainVoyager QX NR-VMP files TST: add test data for BrainVoyager QX files (VTC, MSK, and NR-VMP files) RF: create additional CArrayProxy class to work with C array memory layouts. RF: BvFileHeader inherits from LabeledWrapStruct BF: implement default_structarr for VMP files; NF: implement new set_shape method (with alternative propoerty zyx) for BrainVoyager file formats NF+BF+RF+TST: major refactor of BV formats implementation. Add tests for BV formats. Add affine for BV formats. RF: change side effect of update_header methods NF: VMP files can change shape (with _add_submap and _rem_submap) BF: change default values for vmp submaps; look for value (instead of key) when setting a string in the header BF: save old hdr when for transferring keys when changing the number of maps BF: change dtype of RGB fields to u1 BF: correct they way that nested dtypes of strings (length) are changed for VMP files BF: default_structarr for VMP header fills map1 and not map2 BF: in __setitem__ check for basestring; remove setString method NF: Implement basic support for some BrainVoyager QX file formats. This is a squashed commit for implementing basic BrainVoyager QX files support. See below for the single commit messages. First implementation. Copy of LabeledWrapStruct without inheritance. Implement Vtc File NF: implement read and write for BrainVoyager QX VTC files NF+RF: implement read and write support for BrainVoyager QX MSK files and refactor bv.py NF: implement read and write support for BrainVoyager QX NR-VMP files TST: add test data for BrainVoyager QX files (VTC, MSK, and NR-VMP files) RF: create additional CArrayProxy class to work with C array memory layouts. RF: BvFileHeader inherits from LabeledWrapStruct BF: implement default_structarr for VMP files; NF: implement new set_shape method (with alternative propoerty zyx) for BrainVoyager file formats NF+BF+RF+TST: major refactor of BV formats implementation. Add tests for BV formats. Add affine for BV formats. RF: change side effect of update_header methods NF: VMP files can change shape (with _add_submap and _rem_submap) BF: change default values for vmp submaps; look for value (instead of key) when setting a string in the header BF: save old hdr when for transferring keys when changing the number of maps BF: change dtype of RGB fields to u1 BF: correct they way that nested dtypes of strings (length) are changed for VMP files BF: default_structarr for VMP header fills map1 and not map2 BF: in __setitem__ check for basestring; remove setString method RF+TEST: Change the header parsing for BV file formats and implement tests. The BV file headers are now parsed using an OrderedDict. Tests are implemented for VtcImage. Only the VtcImage class is adapted to the new header parsing. DOC+PL+RF: Adding documentation and linting to bv.py. Let readCString return a list instead of a generator. PL: Removing blank lines. RF: Simplify and centralize the bv hdr prototype. Header prototypes are defined per BV filetype as nested tuples. The creation of an OrderedDict header is done centrally for all filetypes in bv.py based on these prototypes. WIP: separating prototype and default header Refactor the prototype format to make it a little easier to use. Pass the prototype into functions working with the header, to provide read / write format information. Return headers with (key, value) pairs, where the `value` is a value or a list, rather than a dict. WIP: Adapt BV MSK file implementation to new hdr. STY: flake8-compatible code. RF: move files into brainvoyager subdirectory. STY: Prepend "Bv" to all brainvoyager classes. BF: merge new protoHeader implementation into refactored bv files. BF: fix automatic filetype guessing for BV formats. NF : support for VMR file format TEST: add test_bv_vmr TEST: add test_bv_vmr TEST: add test_bv_vmr TEST: add test_bv_vmr Update check_vmr.txt TEST: add test_bv_vmr TEST: add test_bv_vmr TEST: add test_bv_vmr BF: BvVmr __init__ imports correct. BF: Adapt naming convention in bv_vmr.py. BF: Change set_data_shape() to include start values. BF: Change set_data_shape() to include start values in bv_msk.py. BF: Adapt bv_vmp to new hdr_dict format. WIP: Adapt bv_vmr implementation to naming standards. TST: Add image_api tests for BrainVoyager file formats. PL: Lint bv_vmr.py. PL: Lint bv_msk.py. BF: Add nibabel.brainvoyager to setup.py. BF: Enable automatic filetype guessing for bv_vmr. TEST: Adapt test_bv.py to new naming convention. TEST: Fix and clean test_bv_vmr.py. BF: Delete double function definitions in bv.py. TEST: Move get_base_affine docstring text to test_bv_vtc. PL: Lint all BV modules. BF: Correct parameter order for BvVmrHeader methods (ZYX). TEST: Move BV tests into brainvoyager/tests. DOC: Correct docstring for get_base_affine in BvFileHeader. TEST: Fix import paths after move of BV tests. TEST: Fix file handling error in test_bv. TEST: Fix test_bv file read ('rb'). TEST: Add BV file formats to more test cases. OPT: Make MGHHeader raise HeaderDataError in set_data_dtype instead of MGHError. BF: Raise HeaderDataError in BV file formats and continue when parsing conditional BV header fields. NF: Add function to check for supported dimensions in spatialimages. TEST: Fix test_files_interface tests for file formats with unsupported dtypes/dimensions. TEST: test_bad_dtype_mgh asserts an HeaderDataError. TEST+BF: Fix tests for BV and MGH file formats. Add update_BV_header function to account for nested header fields. NF: Compute combined inverse spatial transformation for BV VMR files. BF: correct import for BV EXAMPLE_IMAGES. TEST: Correct test_image_api for BV VMR file format. BF: Fix import of nibabel.brainvoyager.tests module. BF: Correct usage of bytes literals in bv.py and corresponding tests. TEST: Fix BV tests for Python 3.x TEST: Remove del command from BV test. TEST: Add temporary debug prints to test_image_api. TEST: Add file close command to test_bv. TEST: Fix supported_dimensions tests for numpy>=1.12. PL: Correct BV files. PL: Correct bv_vmr.py. OPT: Make BV variable names and header fields more pythonic. TEST: Fix numpy.rint warning issue in test_image_api. TEST+BF: Add a lot of BV tests.
1 parent 42959a3 commit 4699742

31 files changed

+2900
-39
lines changed

nibabel/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
from .nifti2 import Nifti2Header, Nifti2Image, Nifti2Pair
5252
from .minc1 import Minc1Image
5353
from .minc2 import Minc2Image
54+
from .brainvoyager import (BvMskHeader, BvMskImage, BvVmpHeader, BvVmpImage,
55+
BvVtcHeader, BvVtcImage, BvVmrHeader, BvVmrImage)
5456
# Deprecated backwards compatiblity for MINC1
5557
from .deprecated import ModuleProxy as _ModuleProxy
5658
minc = _ModuleProxy('nibabel.minc')

nibabel/arrayproxy.py

+5
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,8 @@ def is_proxy(obj):
164164
return obj.is_proxy
165165
except AttributeError:
166166
return False
167+
168+
169+
class CArrayProxy(ArrayProxy):
170+
# Assume C array memory layout
171+
order = 'C'

nibabel/brainvoyager/__init__.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
2+
# vi: set ft=python sts=4 ts=4 sw=4 et:
3+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
4+
#
5+
# See COPYING file distributed along with the NiBabel package for the
6+
# copyright and license terms.
7+
#
8+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
9+
''' Support for BrainVoyager file formats '''
10+
from .bv_msk import BvMskHeader, BvMskImage
11+
from .bv_vmp import BvVmpHeader, BvVmpImage
12+
from .bv_vtc import BvVtcHeader, BvVtcImage
13+
from .bv_vmr import BvVmrHeader, BvVmrImage
14+
15+
__all__ = ('BvMskHeader', 'BvMskImage',
16+
'BvVmpHeader', 'BvVmpImage',
17+
'BvVtcHeader', 'BvVtcImage',
18+
'BvVmrHeader', 'BvVmrImage')

0 commit comments

Comments
 (0)