{"action":"created","comment":{"url":"https://api.github.com/repos/nipy/nibabel/pulls/comments/79529717","id":79529717,"diff_hunk":"@@ -0,0 +1,952 @@\n+# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-\n+# vi: set ft=python sts=4 ts=4 sw=4 et:\n+# ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##\n+#\n+#   See COPYING file distributed along with the NiBabel package for the\n+#   copyright and license terms.\n+#\n+# ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##\n+\"\"\"Reading / writing functions for Brainvoyager (BV) file formats.\n+\n+please look at the support site of BrainInnovation for further informations\n+about the file formats: http://support.brainvoyager.com/\n+\n+This file implements basic functionality for BV file formats. Look into bv_*.py\n+files for implementations of the different file formats.\n+\n+Author: Thomas Emmerling\n+\"\"\"\n+from __future__ import division\n+import numpy as np\n+\n+from ..volumeutils import array_to_file, array_from_file, make_dt_codes\n+from ..spatialimages import Header, HeaderDataError, SpatialImage\n+from ..fileholders import copy_file_map\n+from ..arrayproxy import CArrayProxy\n+from .. import imageglobals as imageglobals\n+from ..batteryrunners import BatteryRunner, Report\n+from struct import pack, unpack, calcsize\n+from ..externals import OrderedDict\n+\n+_dtdefs = (  # code, conversion function, equivalent dtype, aliases\n+    (1, 'int16', np.uint16),\n+    (2, 'float32', np.float32),\n+    (3, 'uint8', np.uint8))\n+\n+# Make full code alias bank, including dtype column\n+data_type_codes = make_dt_codes(_dtdefs)\n+\n+# Set example hdr_dict_proto for BV file formats\n+BV_HDR_DICT_PROTO = (\n+    ('resolution', 'h', 3),\n+    ('x_start', 'h', 57),\n+    ('x_end', 'h', 231),\n+    ('y_start', 'h', 52),\n+    ('y_end', 'h', 172),\n+    ('z_start', 'h', 59),\n+    ('z_end', 'h', 197),\n+)\n+\n+\n+def readCString(f, nStrings=1, bufsize=1000, startPos=None, strip=True,\n+                rewind=False):\n+    \"\"\"Read a zero-terminated string from a file object.\n+\n+    Read and return a zero-terminated string from a file object.\n+\n+    Parameters\n+    ----------\n+    f : fileobj\n+       File object to use\n+    nStrings: int, optional\n+       Number of strings to search (and return). Default is 1.\n+    bufsize: int, optional\n+       Define the buffer size that should be searched for the string.\n+       Default is 1000 bytes.\n+    startPos: int, optional\n+       Define the start file position from which to search. If None then start\n+       where the file object currently points to. Default is None.\n+    strip : bool, optional\n+       Whether to strip the trailing zero from the returned string.\n+       Default is True.\n+    rewind: bool, optional\n+       Whether the fileobj f should be returned to the initial position after\n+       reading. Default is False.\n+\n+    Returns\n+    -------\n+    str_list : generator of string(s)\n+    \"\"\"\n+    currentPos = f.tell()","path":"nibabel/brainvoyager/bv.py","position":80,"original_position":80,"commit_id":"aaa9a95d2d046e63e4059f1e1ba0896801801ff8","original_commit_id":"aaa9a95d2d046e63e4059f1e1ba0896801801ff8","user":{"login":"matthew-brett","id":67612,"avatar_url":"https://avatars.githubusercontent.com/u/67612?v=3","gravatar_id":"","url":"https://api.github.com/users/matthew-brett","html_url":"https://github.com/matthew-brett","followers_url":"https://api.github.com/users/matthew-brett/followers","following_url":"https://api.github.com/users/matthew-brett/following{/other_user}","gists_url":"https://api.github.com/users/matthew-brett/gists{/gist_id}","starred_url":"https://api.github.com/users/matthew-brett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthew-brett/subscriptions","organizations_url":"https://api.github.com/users/matthew-brett/orgs","repos_url":"https://api.github.com/users/matthew-brett/repos","events_url":"https://api.github.com/users/matthew-brett/events{/privacy}","received_events_url":"https://api.github.com/users/matthew-brett/received_events","type":"User","site_admin":false},"body":"PEP8 naming conventions `current_pos` for `currentPos` etc.","created_at":"2016-09-20T03:09:44Z","updated_at":"2016-09-20T03:24:29Z","html_url":"https://github.com/nipy/nibabel/pull/216#discussion_r79529717","pull_request_url":"https://api.github.com/repos/nipy/nibabel/pulls/216","_links":{"self":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/comments/79529717"},"html":{"href":"https://github.com/nipy/nibabel/pull/216#discussion_r79529717"},"pull_request":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/216"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/nibabel/pulls/216","id":10473905,"html_url":"https://github.com/nipy/nibabel/pull/216","diff_url":"https://github.com/nipy/nibabel/pull/216.diff","patch_url":"https://github.com/nipy/nibabel/pull/216.patch","issue_url":"https://api.github.com/repos/nipy/nibabel/issues/216","number":216,"state":"open","locked":false,"title":"Support for BrainVoyager VTC, MSK, VMR and NR-VMP files","user":{"login":"thomastweets","id":2376790,"avatar_url":"https://avatars.githubusercontent.com/u/2376790?v=3","gravatar_id":"","url":"https://api.github.com/users/thomastweets","html_url":"https://github.com/thomastweets","followers_url":"https://api.github.com/users/thomastweets/followers","following_url":"https://api.github.com/users/thomastweets/following{/other_user}","gists_url":"https://api.github.com/users/thomastweets/gists{/gist_id}","starred_url":"https://api.github.com/users/thomastweets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomastweets/subscriptions","organizations_url":"https://api.github.com/users/thomastweets/orgs","repos_url":"https://api.github.com/users/thomastweets/repos","events_url":"https://api.github.com/users/thomastweets/events{/privacy}","received_events_url":"https://api.github.com/users/thomastweets/received_events","type":"User","site_admin":false},"body":"After talking to Emanuele Olivetti and Yaroslav Halchenko about it I submit this pull request for implementing support for BrainVoyager QX files. I started out with VTC, MSK, and NR-VMP files and read and write does work. As this is my first major pull request I would really appreciate some comments or help. I did not write nose tests yet and the code is not thoroughly tested yet either.\r\n\r\nI hope that my implementation is not too \"dirty\" as it was a little difficult for me to implement the variable-length header of BrainVoyager files...","created_at":"2013-12-03T14:51:22Z","updated_at":"2016-09-20T03:24:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51ce1d23ad590d4b506d0769630f50738dedb70e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nipy/nibabel/pulls/216/commits","review_comments_url":"https://api.github.com/repos/nipy/nibabel/pulls/216/comments","review_comment_url":"https://api.github.com/repos/nipy/nibabel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nipy/nibabel/issues/216/comments","statuses_url":"https://api.github.com/repos/nipy/nibabel/statuses/aaa9a95d2d046e63e4059f1e1ba0896801801ff8","head":{"label":"thomastweets:master","ref":"master","sha":"aaa9a95d2d046e63e4059f1e1ba0896801801ff8","user":{"login":"thomastweets","id":2376790,"avatar_url":"https://avatars.githubusercontent.com/u/2376790?v=3","gravatar_id":"","url":"https://api.github.com/users/thomastweets","html_url":"https://github.com/thomastweets","followers_url":"https://api.github.com/users/thomastweets/followers","following_url":"https://api.github.com/users/thomastweets/following{/other_user}","gists_url":"https://api.github.com/users/thomastweets/gists{/gist_id}","starred_url":"https://api.github.com/users/thomastweets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomastweets/subscriptions","organizations_url":"https://api.github.com/users/thomastweets/orgs","repos_url":"https://api.github.com/users/thomastweets/repos","events_url":"https://api.github.com/users/thomastweets/events{/privacy}","received_events_url":"https://api.github.com/users/thomastweets/received_events","type":"User","site_admin":false},"repo":{"id":14773412,"name":"nibabel","full_name":"thomastweets/nibabel","owner":{"login":"thomastweets","id":2376790,"avatar_url":"https://avatars.githubusercontent.com/u/2376790?v=3","gravatar_id":"","url":"https://api.github.com/users/thomastweets","html_url":"https://github.com/thomastweets","followers_url":"https://api.github.com/users/thomastweets/followers","following_url":"https://api.github.com/users/thomastweets/following{/other_user}","gists_url":"https://api.github.com/users/thomastweets/gists{/gist_id}","starred_url":"https://api.github.com/users/thomastweets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomastweets/subscriptions","organizations_url":"https://api.github.com/users/thomastweets/orgs","repos_url":"https://api.github.com/users/thomastweets/repos","events_url":"https://api.github.com/users/thomastweets/events{/privacy}","received_events_url":"https://api.github.com/users/thomastweets/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thomastweets/nibabel","description":"Python package to access a cacophony of neuro-imaging file formats","fork":true,"url":"https://api.github.com/repos/thomastweets/nibabel","forks_url":"https://api.github.com/repos/thomastweets/nibabel/forks","keys_url":"https://api.github.com/repos/thomastweets/nibabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thomastweets/nibabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thomastweets/nibabel/teams","hooks_url":"https://api.github.com/repos/thomastweets/nibabel/hooks","issue_events_url":"https://api.github.com/repos/thomastweets/nibabel/issues/events{/number}","events_url":"https://api.github.com/repos/thomastweets/nibabel/events","assignees_url":"https://api.github.com/repos/thomastweets/nibabel/assignees{/user}","branches_url":"https://api.github.com/repos/thomastweets/nibabel/branches{/branch}","tags_url":"https://api.github.com/repos/thomastweets/nibabel/tags","blobs_url":"https://api.github.com/repos/thomastweets/nibabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thomastweets/nibabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thomastweets/nibabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/thomastweets/nibabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thomastweets/nibabel/statuses/{sha}","languages_url":"https://api.github.com/repos/thomastweets/nibabel/languages","stargazers_url":"https://api.github.com/repos/thomastweets/nibabel/stargazers","contributors_url":"https://api.github.com/repos/thomastweets/nibabel/contributors","subscribers_url":"https://api.github.com/repos/thomastweets/nibabel/subscribers","subscription_url":"https://api.github.com/repos/thomastweets/nibabel/subscription","commits_url":"https://api.github.com/repos/thomastweets/nibabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/thomastweets/nibabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/thomastweets/nibabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/thomastweets/nibabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/thomastweets/nibabel/contents/{+path}","compare_url":"https://api.github.com/repos/thomastweets/nibabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thomastweets/nibabel/merges","archive_url":"https://api.github.com/repos/thomastweets/nibabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thomastweets/nibabel/downloads","issues_url":"https://api.github.com/repos/thomastweets/nibabel/issues{/number}","pulls_url":"https://api.github.com/repos/thomastweets/nibabel/pulls{/number}","milestones_url":"https://api.github.com/repos/thomastweets/nibabel/milestones{/number}","notifications_url":"https://api.github.com/repos/thomastweets/nibabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thomastweets/nibabel/labels{/name}","releases_url":"https://api.github.com/repos/thomastweets/nibabel/releases{/id}","deployments_url":"https://api.github.com/repos/thomastweets/nibabel/deployments","created_at":"2013-11-28T09:56:47Z","updated_at":"2016-08-23T05:00:39Z","pushed_at":"2016-08-18T15:22:09Z","git_url":"git://github.com/thomastweets/nibabel.git","ssh_url":"git@github.com:thomastweets/nibabel.git","clone_url":"https://github.com/thomastweets/nibabel.git","svn_url":"https://github.com/thomastweets/nibabel","homepage":"http://nipy.org/nibabel/","size":8302,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"nipy:master","ref":"master","sha":"42959a33fc65e8b27b9b8ec8f8b44cc34627d774","user":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"repo":{"id":791352,"name":"nibabel","full_name":"nipy/nibabel","owner":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nipy/nibabel","description":"Python package to access a cacophony of neuro-imaging file formats","fork":false,"url":"https://api.github.com/repos/nipy/nibabel","forks_url":"https://api.github.com/repos/nipy/nibabel/forks","keys_url":"https://api.github.com/repos/nipy/nibabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nipy/nibabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nipy/nibabel/teams","hooks_url":"https://api.github.com/repos/nipy/nibabel/hooks","issue_events_url":"https://api.github.com/repos/nipy/nibabel/issues/events{/number}","events_url":"https://api.github.com/repos/nipy/nibabel/events","assignees_url":"https://api.github.com/repos/nipy/nibabel/assignees{/user}","branches_url":"https://api.github.com/repos/nipy/nibabel/branches{/branch}","tags_url":"https://api.github.com/repos/nipy/nibabel/tags","blobs_url":"https://api.github.com/repos/nipy/nibabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nipy/nibabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nipy/nibabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/nipy/nibabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nipy/nibabel/statuses/{sha}","languages_url":"https://api.github.com/repos/nipy/nibabel/languages","stargazers_url":"https://api.github.com/repos/nipy/nibabel/stargazers","contributors_url":"https://api.github.com/repos/nipy/nibabel/contributors","subscribers_url":"https://api.github.com/repos/nipy/nibabel/subscribers","subscription_url":"https://api.github.com/repos/nipy/nibabel/subscription","commits_url":"https://api.github.com/repos/nipy/nibabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/nipy/nibabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/nipy/nibabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/nipy/nibabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/nipy/nibabel/contents/{+path}","compare_url":"https://api.github.com/repos/nipy/nibabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nipy/nibabel/merges","archive_url":"https://api.github.com/repos/nipy/nibabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nipy/nibabel/downloads","issues_url":"https://api.github.com/repos/nipy/nibabel/issues{/number}","pulls_url":"https://api.github.com/repos/nipy/nibabel/pulls{/number}","milestones_url":"https://api.github.com/repos/nipy/nibabel/milestones{/number}","notifications_url":"https://api.github.com/repos/nipy/nibabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nipy/nibabel/labels{/name}","releases_url":"https://api.github.com/repos/nipy/nibabel/releases{/id}","deployments_url":"https://api.github.com/repos/nipy/nibabel/deployments","created_at":"2010-07-22T16:28:30Z","updated_at":"2016-09-04T15:51:05Z","pushed_at":"2016-09-14T01:29:27Z","git_url":"git://github.com/nipy/nibabel.git","ssh_url":"git@github.com:nipy/nibabel.git","clone_url":"https://github.com/nipy/nibabel.git","svn_url":"https://github.com/nipy/nibabel","homepage":"http://nipy.org/nibabel/","size":20861,"stargazers_count":118,"watchers_count":118,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":109,"mirror_url":null,"open_issues_count":64,"forks":109,"open_issues":64,"watchers":118,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/216"},"html":{"href":"https://github.com/nipy/nibabel/pull/216"},"issue":{"href":"https://api.github.com/repos/nipy/nibabel/issues/216"},"comments":{"href":"https://api.github.com/repos/nipy/nibabel/issues/216/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/216/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/216/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/nibabel/statuses/aaa9a95d2d046e63e4059f1e1ba0896801801ff8"}}}}
{"actor":{"display_login":"matthew-brett"}}