{"action":"created","comment":{"url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/comments/40492599","id":40492599,"diff_hunk":"@@ -6,8 +6,246 @@\n \n #include \"mri_core_utility.h\"\n #include \"hoNDArray_elemwise.h\"\n+#include \"mri_core_kspace_filter.h\"\n+#include <ctime>\n \n namespace Gadgetron\n {\n+    template <typename T>\n+    void detect_readout_sampling_status(const hoNDArray<T>& data, hoNDArray<float>& sampled)\n+    {\n+        try\n+        {\n+            typedef typename realType<T>::Type value_type;\n \n+            size_t RO = data.get_size(0);\n+            size_t E1 = data.get_size(1);\n+            size_t E2 = data.get_size(2);\n+            size_t CHA = data.get_size(3);\n+            size_t N = data.get_size(4);\n+            size_t S = data.get_size(5);\n+            size_t SLC = data.get_size(6);\n+\n+            sampled.create(E1, E2, N, S, SLC);\n+            Gadgetron::clear(sampled);\n+\n+            size_t slc, s, n, e2, e1;\n+\n+            for (slc = 0; slc < SLC; slc++)\n+            {\n+                for (s = 0; s < S; s++)\n+                {\n+                    for (n = 0; n < N; n++)\n+                    {\n+                        for (e2 = 0; e2 < E2; e2++)\n+                        {\n+                            for (e1 = 0; e1 < E1; e1++)\n+                            {\n+                                value_type v = 0;\n+                                const T* pData = &(data(0, e1, e2, 0, n, s, slc));\n+\n+                                size_t ro;\n+                                for (ro = 0; ro < RO; ro++)\n+                                {\n+                                    v += std::abs(pData[ro]);\n+                                }\n+\n+                                if (v > 0)\n+                                {\n+                                    sampled(e1, e2, n, s, slc) = 1;\n+                                }\n+                            }\n+                        }\n+                    }\n+                }\n+            }\n+        }\n+        catch (...)\n+        {\n+            GADGET_THROW(\"Errors in detect_readout_sampling_status(...) ... \");\n+        }\n+    }\n+\n+    template EXPORTMRICORE void detect_readout_sampling_status(const hoNDArray< float >& data, hoNDArray<float>& sampled);\n+    template EXPORTMRICORE void detect_readout_sampling_status(const hoNDArray< double >& data, hoNDArray<float>& sampled);\n+    template EXPORTMRICORE void detect_readout_sampling_status(const hoNDArray< std::complex<float> >& data, hoNDArray<float>& sampled);\n+    template EXPORTMRICORE void detect_readout_sampling_status(const hoNDArray< std::complex<double> >& data, hoNDArray<float>& sampled);\n+\n+    // ------------------------------------------------------------------------\n+\n+    template <typename T>\n+    void detect_sampled_region_E1(const hoNDArray<T>& data, size_t& start_E1, size_t& end_E1)","path":"toolboxes/mri_core/mri_core_utility.cpp","position":72,"original_position":72,"commit_id":"363dad78fc7afee5689e461f667257885541f21e","original_commit_id":"363dad78fc7afee5689e461f667257885541f21e","user":{"login":"hansenms","id":1149740,"avatar_url":"https://avatars.githubusercontent.com/u/1149740?v=3","gravatar_id":"","url":"https://api.github.com/users/hansenms","html_url":"https://github.com/hansenms","followers_url":"https://api.github.com/users/hansenms/followers","following_url":"https://api.github.com/users/hansenms/following{/other_user}","gists_url":"https://api.github.com/users/hansenms/gists{/gist_id}","starred_url":"https://api.github.com/users/hansenms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansenms/subscriptions","organizations_url":"https://api.github.com/users/hansenms/orgs","repos_url":"https://api.github.com/users/hansenms/repos","events_url":"https://api.github.com/users/hansenms/events{/privacy}","received_events_url":"https://api.github.com/users/hansenms/received_events","type":"User","site_admin":false},"body":"Agreed.","created_at":"2015-09-26T10:54:58Z","updated_at":"2015-09-26T10:54:58Z","html_url":"https://github.com/gadgetron/gadgetron/pull/208#discussion_r40492599","pull_request_url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208","_links":{"self":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/comments/40492599"},"html":{"href":"https://github.com/gadgetron/gadgetron/pull/208#discussion_r40492599"},"pull_request":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208"}}},"pull_request":{"url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208","id":44816295,"html_url":"https://github.com/gadgetron/gadgetron/pull/208","diff_url":"https://github.com/gadgetron/gadgetron/pull/208.diff","patch_url":"https://github.com/gadgetron/gadgetron/pull/208.patch","issue_url":"https://api.github.com/repos/gadgetron/gadgetron/issues/208","number":208,"state":"open","locked":false,"title":"Single recon gadget","user":{"login":"xueh2","id":7012710,"avatar_url":"https://avatars.githubusercontent.com/u/7012710?v=3","gravatar_id":"","url":"https://api.github.com/users/xueh2","html_url":"https://github.com/xueh2","followers_url":"https://api.github.com/users/xueh2/followers","following_url":"https://api.github.com/users/xueh2/following{/other_user}","gists_url":"https://api.github.com/users/xueh2/gists{/gist_id}","starred_url":"https://api.github.com/users/xueh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xueh2/subscriptions","organizations_url":"https://api.github.com/users/xueh2/orgs","repos_url":"https://api.github.com/users/xueh2/repos","events_url":"https://api.github.com/users/xueh2/events{/privacy}","received_events_url":"https://api.github.com/users/xueh2/received_events","type":"User","site_admin":false},"body":"\r\nA single recon gadget for grappa is added.\r\n\r\nAn example is given for T2W data, Generic_Cartesian_Grappa_T2W.xml, which works with integration test data meas_MID00057_T2w.dat\r\n\r\nThe changes on BucketToBufferGadget are still needed to make sure kspace is buffered in the correct location. This PR includes the changes in PR #204.\r\n\r\nPlease focus on the main gadget GenericCartesianGrappaReconGadget\r\n\r\nThe recon kernel and other status is stored in GenericCartesianGrappaReconObj for every encoding space. Therefore, the incoming reconbit without ref data can be processed with buffered kernel and coil maps.\r\n\r\nThe recon chain consists of \r\n\r\n        a) ensure the recon image to have squared pixel, therefore zero-padding resizing is not needed for E1. This avoids ringing in the final images. \r\n       b) prepare the ref data. Gadget can control to whether averaging all N or all S for ref data.\r\n       c) estimate coil map\r\n       d) calibration\r\n       e) unwrapping or coil combination\r\n       f) compute image header\r\n       g) send out the recon results, gfactor can be sent out\r\n\r\nA few utilities functions are added into mri_core to detect sampled kspace region.\r\n\r\nAfter combining comments, i will put in the integration test cases\r\n","created_at":"2015-09-11T18:52:26Z","updated_at":"2015-09-26T10:54:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"19994bc3a90b186f2fc99d5cc3f14ad08355dce6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208/commits","review_comments_url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208/comments","review_comment_url":"https://api.github.com/repos/gadgetron/gadgetron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gadgetron/gadgetron/issues/208/comments","statuses_url":"https://api.github.com/repos/gadgetron/gadgetron/statuses/363dad78fc7afee5689e461f667257885541f21e","head":{"label":"xueh2:single_recon_gadget","ref":"single_recon_gadget","sha":"363dad78fc7afee5689e461f667257885541f21e","user":{"login":"xueh2","id":7012710,"avatar_url":"https://avatars.githubusercontent.com/u/7012710?v=3","gravatar_id":"","url":"https://api.github.com/users/xueh2","html_url":"https://github.com/xueh2","followers_url":"https://api.github.com/users/xueh2/followers","following_url":"https://api.github.com/users/xueh2/following{/other_user}","gists_url":"https://api.github.com/users/xueh2/gists{/gist_id}","starred_url":"https://api.github.com/users/xueh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xueh2/subscriptions","organizations_url":"https://api.github.com/users/xueh2/orgs","repos_url":"https://api.github.com/users/xueh2/repos","events_url":"https://api.github.com/users/xueh2/events{/privacy}","received_events_url":"https://api.github.com/users/xueh2/received_events","type":"User","site_admin":false},"repo":{"id":28673013,"name":"gadgetron","full_name":"xueh2/gadgetron","owner":{"login":"xueh2","id":7012710,"avatar_url":"https://avatars.githubusercontent.com/u/7012710?v=3","gravatar_id":"","url":"https://api.github.com/users/xueh2","html_url":"https://github.com/xueh2","followers_url":"https://api.github.com/users/xueh2/followers","following_url":"https://api.github.com/users/xueh2/following{/other_user}","gists_url":"https://api.github.com/users/xueh2/gists{/gist_id}","starred_url":"https://api.github.com/users/xueh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xueh2/subscriptions","organizations_url":"https://api.github.com/users/xueh2/orgs","repos_url":"https://api.github.com/users/xueh2/repos","events_url":"https://api.github.com/users/xueh2/events{/privacy}","received_events_url":"https://api.github.com/users/xueh2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xueh2/gadgetron","description":"","fork":true,"url":"https://api.github.com/repos/xueh2/gadgetron","forks_url":"https://api.github.com/repos/xueh2/gadgetron/forks","keys_url":"https://api.github.com/repos/xueh2/gadgetron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xueh2/gadgetron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xueh2/gadgetron/teams","hooks_url":"https://api.github.com/repos/xueh2/gadgetron/hooks","issue_events_url":"https://api.github.com/repos/xueh2/gadgetron/issues/events{/number}","events_url":"https://api.github.com/repos/xueh2/gadgetron/events","assignees_url":"https://api.github.com/repos/xueh2/gadgetron/assignees{/user}","branches_url":"https://api.github.com/repos/xueh2/gadgetron/branches{/branch}","tags_url":"https://api.github.com/repos/xueh2/gadgetron/tags","blobs_url":"https://api.github.com/repos/xueh2/gadgetron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xueh2/gadgetron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xueh2/gadgetron/git/refs{/sha}","trees_url":"https://api.github.com/repos/xueh2/gadgetron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xueh2/gadgetron/statuses/{sha}","languages_url":"https://api.github.com/repos/xueh2/gadgetron/languages","stargazers_url":"https://api.github.com/repos/xueh2/gadgetron/stargazers","contributors_url":"https://api.github.com/repos/xueh2/gadgetron/contributors","subscribers_url":"https://api.github.com/repos/xueh2/gadgetron/subscribers","subscription_url":"https://api.github.com/repos/xueh2/gadgetron/subscription","commits_url":"https://api.github.com/repos/xueh2/gadgetron/commits{/sha}","git_commits_url":"https://api.github.com/repos/xueh2/gadgetron/git/commits{/sha}","comments_url":"https://api.github.com/repos/xueh2/gadgetron/comments{/number}","issue_comment_url":"https://api.github.com/repos/xueh2/gadgetron/issues/comments{/number}","contents_url":"https://api.github.com/repos/xueh2/gadgetron/contents/{+path}","compare_url":"https://api.github.com/repos/xueh2/gadgetron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xueh2/gadgetron/merges","archive_url":"https://api.github.com/repos/xueh2/gadgetron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xueh2/gadgetron/downloads","issues_url":"https://api.github.com/repos/xueh2/gadgetron/issues{/number}","pulls_url":"https://api.github.com/repos/xueh2/gadgetron/pulls{/number}","milestones_url":"https://api.github.com/repos/xueh2/gadgetron/milestones{/number}","notifications_url":"https://api.github.com/repos/xueh2/gadgetron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xueh2/gadgetron/labels{/name}","releases_url":"https://api.github.com/repos/xueh2/gadgetron/releases{/id}","created_at":"2014-12-31T19:06:56Z","updated_at":"2014-12-31T19:06:58Z","pushed_at":"2015-09-25T19:56:38Z","git_url":"git://github.com/xueh2/gadgetron.git","ssh_url":"git@github.com:xueh2/gadgetron.git","clone_url":"https://github.com/xueh2/gadgetron.git","svn_url":"https://github.com/xueh2/gadgetron","homepage":null,"size":33402,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"gadgetron:master","ref":"master","sha":"68b400f2c3ae1e7a71881ee7eec226add4e23100","user":{"login":"gadgetron","id":9702817,"avatar_url":"https://avatars.githubusercontent.com/u/9702817?v=3","gravatar_id":"","url":"https://api.github.com/users/gadgetron","html_url":"https://github.com/gadgetron","followers_url":"https://api.github.com/users/gadgetron/followers","following_url":"https://api.github.com/users/gadgetron/following{/other_user}","gists_url":"https://api.github.com/users/gadgetron/gists{/gist_id}","starred_url":"https://api.github.com/users/gadgetron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gadgetron/subscriptions","organizations_url":"https://api.github.com/users/gadgetron/orgs","repos_url":"https://api.github.com/users/gadgetron/repos","events_url":"https://api.github.com/users/gadgetron/events{/privacy}","received_events_url":"https://api.github.com/users/gadgetron/received_events","type":"Organization","site_admin":false},"repo":{"id":26652340,"name":"gadgetron","full_name":"gadgetron/gadgetron","owner":{"login":"gadgetron","id":9702817,"avatar_url":"https://avatars.githubusercontent.com/u/9702817?v=3","gravatar_id":"","url":"https://api.github.com/users/gadgetron","html_url":"https://github.com/gadgetron","followers_url":"https://api.github.com/users/gadgetron/followers","following_url":"https://api.github.com/users/gadgetron/following{/other_user}","gists_url":"https://api.github.com/users/gadgetron/gists{/gist_id}","starred_url":"https://api.github.com/users/gadgetron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gadgetron/subscriptions","organizations_url":"https://api.github.com/users/gadgetron/orgs","repos_url":"https://api.github.com/users/gadgetron/repos","events_url":"https://api.github.com/users/gadgetron/events{/privacy}","received_events_url":"https://api.github.com/users/gadgetron/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gadgetron/gadgetron","description":"Gadgetron - Medical Image Reconstruction Framework","fork":false,"url":"https://api.github.com/repos/gadgetron/gadgetron","forks_url":"https://api.github.com/repos/gadgetron/gadgetron/forks","keys_url":"https://api.github.com/repos/gadgetron/gadgetron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gadgetron/gadgetron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gadgetron/gadgetron/teams","hooks_url":"https://api.github.com/repos/gadgetron/gadgetron/hooks","issue_events_url":"https://api.github.com/repos/gadgetron/gadgetron/issues/events{/number}","events_url":"https://api.github.com/repos/gadgetron/gadgetron/events","assignees_url":"https://api.github.com/repos/gadgetron/gadgetron/assignees{/user}","branches_url":"https://api.github.com/repos/gadgetron/gadgetron/branches{/branch}","tags_url":"https://api.github.com/repos/gadgetron/gadgetron/tags","blobs_url":"https://api.github.com/repos/gadgetron/gadgetron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gadgetron/gadgetron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gadgetron/gadgetron/git/refs{/sha}","trees_url":"https://api.github.com/repos/gadgetron/gadgetron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gadgetron/gadgetron/statuses/{sha}","languages_url":"https://api.github.com/repos/gadgetron/gadgetron/languages","stargazers_url":"https://api.github.com/repos/gadgetron/gadgetron/stargazers","contributors_url":"https://api.github.com/repos/gadgetron/gadgetron/contributors","subscribers_url":"https://api.github.com/repos/gadgetron/gadgetron/subscribers","subscription_url":"https://api.github.com/repos/gadgetron/gadgetron/subscription","commits_url":"https://api.github.com/repos/gadgetron/gadgetron/commits{/sha}","git_commits_url":"https://api.github.com/repos/gadgetron/gadgetron/git/commits{/sha}","comments_url":"https://api.github.com/repos/gadgetron/gadgetron/comments{/number}","issue_comment_url":"https://api.github.com/repos/gadgetron/gadgetron/issues/comments{/number}","contents_url":"https://api.github.com/repos/gadgetron/gadgetron/contents/{+path}","compare_url":"https://api.github.com/repos/gadgetron/gadgetron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gadgetron/gadgetron/merges","archive_url":"https://api.github.com/repos/gadgetron/gadgetron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gadgetron/gadgetron/downloads","issues_url":"https://api.github.com/repos/gadgetron/gadgetron/issues{/number}","pulls_url":"https://api.github.com/repos/gadgetron/gadgetron/pulls{/number}","milestones_url":"https://api.github.com/repos/gadgetron/gadgetron/milestones{/number}","notifications_url":"https://api.github.com/repos/gadgetron/gadgetron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gadgetron/gadgetron/labels{/name}","releases_url":"https://api.github.com/repos/gadgetron/gadgetron/releases{/id}","created_at":"2014-11-14T18:44:25Z","updated_at":"2015-09-24T01:14:36Z","pushed_at":"2015-09-25T19:56:39Z","git_url":"git://github.com/gadgetron/gadgetron.git","ssh_url":"git@github.com:gadgetron/gadgetron.git","clone_url":"https://github.com/gadgetron/gadgetron.git","svn_url":"https://github.com/gadgetron/gadgetron","homepage":"http://gadgetron.github.io/","size":36526,"stargazers_count":26,"watchers_count":26,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":20,"forks":21,"open_issues":20,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208"},"html":{"href":"https://github.com/gadgetron/gadgetron/pull/208"},"issue":{"href":"https://api.github.com/repos/gadgetron/gadgetron/issues/208"},"comments":{"href":"https://api.github.com/repos/gadgetron/gadgetron/issues/208/comments"},"review_comments":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208/comments"},"review_comment":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gadgetron/gadgetron/pulls/208/commits"},"statuses":{"href":"https://api.github.com/repos/gadgetron/gadgetron/statuses/363dad78fc7afee5689e461f667257885541f21e"}}}}