{"action":"created","comment":{"url":"https://api.github.com/repos/nipy/nipy/pulls/comments/78484867","id":78484867,"diff_hunk":"@@ -86,6 +86,20 @@ def guess_slice_axis_and_direction(slice_info, affine):\n         slice_direction = int(slice_info[1])\n     return slice_axis, slice_direction\n \n+def tr_from_header(images):\n+    if isinstance(images, list):\n+        no_init_value = True\n+        for image in images:\n+            tr = image.header.get_zooms()[-1]\n+            if no_init_value:\n+                images_tr = tr\n+                no_init_value = False\n+            if tr != images_tr:\n+                raise ValueError('TR inconsistent between images.')\n+        else:\n+            return images_tr","path":"nipy/algorithms/registration/groupwise_registration.py","position":15,"original_position":15,"commit_id":"16695da77e755e65024e92908fda05cdf3962f51","original_commit_id":"16695da77e755e65024e92908fda05cdf3962f51","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":"The `else` is a bit confusing here, you usually use this to run something when there was no `break` in the for loop.  Of course there isn't here, but an experienced programmer will look for one.  How about something like:\r\n\r\n```\r\ndef tr_from_header(images):\r\n    \"\"\" A good docstring \"\"\"\r\n    if not isinstance(images, list):\r\n        images = [images]\r\n    images_tr = None\r\n    for image in images:\r\n        tr = image.header.get_zooms()[3]\r\n        if images_tr is None:\r\n            images_tr = tr\r\n        if tr != images_tr:\r\n            raise ValueError('TR inconsistent between images.')\r\n    return images_tr\r\n```","created_at":"2016-09-13T01:45:19Z","updated_at":"2016-09-13T01:45:19Z","html_url":"https://github.com/nipy/nipy/pull/410#discussion_r78484867","pull_request_url":"https://api.github.com/repos/nipy/nipy/pulls/410","_links":{"self":{"href":"https://api.github.com/repos/nipy/nipy/pulls/comments/78484867"},"html":{"href":"https://github.com/nipy/nipy/pull/410#discussion_r78484867"},"pull_request":{"href":"https://api.github.com/repos/nipy/nipy/pulls/410"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/nipy/pulls/410","id":84588730,"html_url":"https://github.com/nipy/nipy/pull/410","diff_url":"https://github.com/nipy/nipy/pull/410.diff","patch_url":"https://github.com/nipy/nipy/pull/410.patch","issue_url":"https://api.github.com/repos/nipy/nipy/issues/410","number":410,"state":"open","locked":false,"title":"Realign4d TR from header","user":{"login":"TheChymera","id":950524,"avatar_url":"https://avatars.githubusercontent.com/u/950524?v=3","gravatar_id":"","url":"https://api.github.com/users/TheChymera","html_url":"https://github.com/TheChymera","followers_url":"https://api.github.com/users/TheChymera/followers","following_url":"https://api.github.com/users/TheChymera/following{/other_user}","gists_url":"https://api.github.com/users/TheChymera/gists{/gist_id}","starred_url":"https://api.github.com/users/TheChymera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheChymera/subscriptions","organizations_url":"https://api.github.com/users/TheChymera/orgs","repos_url":"https://api.github.com/users/TheChymera/repos","events_url":"https://api.github.com/users/TheChymera/events{/privacy}","received_events_url":"https://api.github.com/users/TheChymera/received_events","type":"User","site_admin":false},"body":"with \"fail-save\" caveats. addressing https://github.com/nipy/nipy/issues/409","created_at":"2016-09-09T03:30:35Z","updated_at":"2016-09-13T01:45:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9688f9b17329f5d5d05dd1254c7e0b9dc0065cdd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nipy/nipy/pulls/410/commits","review_comments_url":"https://api.github.com/repos/nipy/nipy/pulls/410/comments","review_comment_url":"https://api.github.com/repos/nipy/nipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nipy/nipy/issues/410/comments","statuses_url":"https://api.github.com/repos/nipy/nipy/statuses/16695da77e755e65024e92908fda05cdf3962f51","head":{"label":"TheChymera:master","ref":"master","sha":"16695da77e755e65024e92908fda05cdf3962f51","user":{"login":"TheChymera","id":950524,"avatar_url":"https://avatars.githubusercontent.com/u/950524?v=3","gravatar_id":"","url":"https://api.github.com/users/TheChymera","html_url":"https://github.com/TheChymera","followers_url":"https://api.github.com/users/TheChymera/followers","following_url":"https://api.github.com/users/TheChymera/following{/other_user}","gists_url":"https://api.github.com/users/TheChymera/gists{/gist_id}","starred_url":"https://api.github.com/users/TheChymera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheChymera/subscriptions","organizations_url":"https://api.github.com/users/TheChymera/orgs","repos_url":"https://api.github.com/users/TheChymera/repos","events_url":"https://api.github.com/users/TheChymera/events{/privacy}","received_events_url":"https://api.github.com/users/TheChymera/received_events","type":"User","site_admin":false},"repo":{"id":67755496,"name":"nipy","full_name":"TheChymera/nipy","owner":{"login":"TheChymera","id":950524,"avatar_url":"https://avatars.githubusercontent.com/u/950524?v=3","gravatar_id":"","url":"https://api.github.com/users/TheChymera","html_url":"https://github.com/TheChymera","followers_url":"https://api.github.com/users/TheChymera/followers","following_url":"https://api.github.com/users/TheChymera/following{/other_user}","gists_url":"https://api.github.com/users/TheChymera/gists{/gist_id}","starred_url":"https://api.github.com/users/TheChymera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheChymera/subscriptions","organizations_url":"https://api.github.com/users/TheChymera/orgs","repos_url":"https://api.github.com/users/TheChymera/repos","events_url":"https://api.github.com/users/TheChymera/events{/privacy}","received_events_url":"https://api.github.com/users/TheChymera/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TheChymera/nipy","description":"Neuroimaging in Python FMRI analysis package","fork":true,"url":"https://api.github.com/repos/TheChymera/nipy","forks_url":"https://api.github.com/repos/TheChymera/nipy/forks","keys_url":"https://api.github.com/repos/TheChymera/nipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheChymera/nipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheChymera/nipy/teams","hooks_url":"https://api.github.com/repos/TheChymera/nipy/hooks","issue_events_url":"https://api.github.com/repos/TheChymera/nipy/issues/events{/number}","events_url":"https://api.github.com/repos/TheChymera/nipy/events","assignees_url":"https://api.github.com/repos/TheChymera/nipy/assignees{/user}","branches_url":"https://api.github.com/repos/TheChymera/nipy/branches{/branch}","tags_url":"https://api.github.com/repos/TheChymera/nipy/tags","blobs_url":"https://api.github.com/repos/TheChymera/nipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheChymera/nipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheChymera/nipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheChymera/nipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheChymera/nipy/statuses/{sha}","languages_url":"https://api.github.com/repos/TheChymera/nipy/languages","stargazers_url":"https://api.github.com/repos/TheChymera/nipy/stargazers","contributors_url":"https://api.github.com/repos/TheChymera/nipy/contributors","subscribers_url":"https://api.github.com/repos/TheChymera/nipy/subscribers","subscription_url":"https://api.github.com/repos/TheChymera/nipy/subscription","commits_url":"https://api.github.com/repos/TheChymera/nipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheChymera/nipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheChymera/nipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheChymera/nipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheChymera/nipy/contents/{+path}","compare_url":"https://api.github.com/repos/TheChymera/nipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheChymera/nipy/merges","archive_url":"https://api.github.com/repos/TheChymera/nipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheChymera/nipy/downloads","issues_url":"https://api.github.com/repos/TheChymera/nipy/issues{/number}","pulls_url":"https://api.github.com/repos/TheChymera/nipy/pulls{/number}","milestones_url":"https://api.github.com/repos/TheChymera/nipy/milestones{/number}","notifications_url":"https://api.github.com/repos/TheChymera/nipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheChymera/nipy/labels{/name}","releases_url":"https://api.github.com/repos/TheChymera/nipy/releases{/id}","deployments_url":"https://api.github.com/repos/TheChymera/nipy/deployments","created_at":"2016-09-09T01:48:59Z","updated_at":"2016-09-09T01:49:02Z","pushed_at":"2016-09-13T01:26:26Z","git_url":"git://github.com/TheChymera/nipy.git","ssh_url":"git@github.com:TheChymera/nipy.git","clone_url":"https://github.com/TheChymera/nipy.git","svn_url":"https://github.com/TheChymera/nipy","homepage":"http://nipy.org/nipy","size":36492,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nipy:master","ref":"master","sha":"91d91f5495a63d42c3e9452ac7b7dd97f6545052","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":642344,"name":"nipy","full_name":"nipy/nipy","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/nipy","description":"Neuroimaging in Python FMRI analysis package","fork":false,"url":"https://api.github.com/repos/nipy/nipy","forks_url":"https://api.github.com/repos/nipy/nipy/forks","keys_url":"https://api.github.com/repos/nipy/nipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nipy/nipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nipy/nipy/teams","hooks_url":"https://api.github.com/repos/nipy/nipy/hooks","issue_events_url":"https://api.github.com/repos/nipy/nipy/issues/events{/number}","events_url":"https://api.github.com/repos/nipy/nipy/events","assignees_url":"https://api.github.com/repos/nipy/nipy/assignees{/user}","branches_url":"https://api.github.com/repos/nipy/nipy/branches{/branch}","tags_url":"https://api.github.com/repos/nipy/nipy/tags","blobs_url":"https://api.github.com/repos/nipy/nipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nipy/nipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nipy/nipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nipy/nipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nipy/nipy/statuses/{sha}","languages_url":"https://api.github.com/repos/nipy/nipy/languages","stargazers_url":"https://api.github.com/repos/nipy/nipy/stargazers","contributors_url":"https://api.github.com/repos/nipy/nipy/contributors","subscribers_url":"https://api.github.com/repos/nipy/nipy/subscribers","subscription_url":"https://api.github.com/repos/nipy/nipy/subscription","commits_url":"https://api.github.com/repos/nipy/nipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nipy/nipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nipy/nipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nipy/nipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/nipy/nipy/contents/{+path}","compare_url":"https://api.github.com/repos/nipy/nipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nipy/nipy/merges","archive_url":"https://api.github.com/repos/nipy/nipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nipy/nipy/downloads","issues_url":"https://api.github.com/repos/nipy/nipy/issues{/number}","pulls_url":"https://api.github.com/repos/nipy/nipy/pulls{/number}","milestones_url":"https://api.github.com/repos/nipy/nipy/milestones{/number}","notifications_url":"https://api.github.com/repos/nipy/nipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nipy/nipy/labels{/name}","releases_url":"https://api.github.com/repos/nipy/nipy/releases{/id}","deployments_url":"https://api.github.com/repos/nipy/nipy/deployments","created_at":"2010-05-02T10:00:33Z","updated_at":"2016-09-09T14:00:04Z","pushed_at":"2016-09-13T01:26:27Z","git_url":"git://github.com/nipy/nipy.git","ssh_url":"git@github.com:nipy/nipy.git","clone_url":"https://github.com/nipy/nipy.git","svn_url":"https://github.com/nipy/nipy","homepage":"http://nipy.org/nipy","size":39019,"stargazers_count":155,"watchers_count":155,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":82,"mirror_url":null,"open_issues_count":32,"forks":82,"open_issues":32,"watchers":155,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/nipy/pulls/410"},"html":{"href":"https://github.com/nipy/nipy/pull/410"},"issue":{"href":"https://api.github.com/repos/nipy/nipy/issues/410"},"comments":{"href":"https://api.github.com/repos/nipy/nipy/issues/410/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/nipy/pulls/410/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/nipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nipy/nipy/pulls/410/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/nipy/statuses/16695da77e755e65024e92908fda05cdf3962f51"}}}}
{"actor":{"display_login":"matthew-brett"}}