{"action":"created","comment":{"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments/139808959","pull_request_review_id":63792865,"id":139808959,"diff_hunk":"@@ -354,6 +358,143 @@ public void handle(int x, int y) {\n \n     }\n \n+    public ShapeStats [] getStatsRestricted(\n+            List<Long> shapeIds, \n+            int zForUnattached, int tForUnattached,\n+            int[] channels) {\n+        if (shapeIds == null || shapeIds.isEmpty()) \n+            throw new ApiUsageException(\"Provide a non empty list of shape ids.\");\n+\n+        final Session session = factory.getSession();\n+        final List<ShapeStats> shapeStats = \n+            new ArrayList<ShapeStats>(shapeIds.size());\n+        // we lump together shapes that belong to the same z/t\n+        // in order to not have to read the same z/t twice\n+        final Map<String, List<ome.model.roi.Shape>> zt_lookup =\n+            new HashMap<String, List<ome.model.roi.Shape>>();\n+\n+       // fetch shapes from db and perform some basic checks\n+       List results = \n+           session.createQuery(\n+               \"select distinct s from Shape s \" +\n+               \"left join fetch s.transform t left join fetch s.roi r \" +\n+               \"join fetch r.image i join fetch i.pixels p \" +\n+               \"where s.id in (:ids)\").\n+           setParameterList(\"ids\", shapeIds).list();\n+       if (results.size() != shapeIds.size()) {\n+           throw new ApiUsageException(\"Given shape id(s) invalid\");\n+       }\n+\n+       ome.model.core.Image image = null;\n+       ome.model.core.Pixels pixels = null;\n+       for (final Object r : results) {\n+           final ome.model.roi.Shape shape = (ome.model.roi.Shape) r;\n+           final ome.model.roi.Roi roi = shape.getRoi();\n+           final ome.model.core.Image img = roi.getImage();\n+           \n+           // check if all shapes come from the same image\n+           if (image == null) {\n+               image = img;\n+               pixels = image.getPrimaryPixels();\n+           } else if (!image.getId().equals(img.getId()))\n+               throw new ApiUsageException(\"All shapes have to be from the same image\");\n+           // check if z/t unattached fallback values are not out of bounds\n+           if (zForUnattached < 0 || zForUnattached >= pixels.getSizeZ() ||\n+               tForUnattached < 0 || tForUnattached >= pixels.getSizeT())\n+               throw new ApiUsageException(\n+                   \"Fallback value(s) for unattached z/t shapes are out of bounds\");","path":"components/blitz/src/ome/services/roi/GeomTool.java","position":85,"original_position":85,"commit_id":"866b161eae1170309f1af092c7ea61cfd5c2d8f1","original_commit_id":"866b161eae1170309f1af092c7ea61cfd5c2d8f1","user":{"login":"jburel","id":1022396,"avatar_url":"https://avatars1.githubusercontent.com/u/1022396?v=4","gravatar_id":"","url":"https://api.github.com/users/jburel","html_url":"https://github.com/jburel","followers_url":"https://api.github.com/users/jburel/followers","following_url":"https://api.github.com/users/jburel/following{/other_user}","gists_url":"https://api.github.com/users/jburel/gists{/gist_id}","starred_url":"https://api.github.com/users/jburel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jburel/subscriptions","organizations_url":"https://api.github.com/users/jburel/orgs","repos_url":"https://api.github.com/users/jburel/repos","events_url":"https://api.github.com/users/jburel/events{/privacy}","received_events_url":"https://api.github.com/users/jburel/received_events","type":"User","site_admin":false},"body":"should we go for something less aggressive and set the value to ``0 if < 0``\r\nor to ``pixels.getSizeZ/T-1`` if >=pixels.getSizeZ/T``\r\nsince we support ``null`` array of channels?\r\n","created_at":"2017-09-19T20:29:25Z","updated_at":"2017-09-19T20:47:20Z","html_url":"https://github.com/openmicroscopy/openmicroscopy/pull/5465#discussion_r139808959","pull_request_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments/139808959"},"html":{"href":"https://github.com/openmicroscopy/openmicroscopy/pull/5465#discussion_r139808959"},"pull_request":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465"}}},"pull_request":{"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465","id":137143023,"html_url":"https://github.com/openmicroscopy/openmicroscopy/pull/5465","diff_url":"https://github.com/openmicroscopy/openmicroscopy/pull/5465.diff","patch_url":"https://github.com/openmicroscopy/openmicroscopy/pull/5465.patch","issue_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/5465","number":5465,"state":"open","locked":false,"title":"Shape stats minimal","user":{"login":"waxenegger","id":1559229,"avatar_url":"https://avatars0.githubusercontent.com/u/1559229?v=4","gravatar_id":"","url":"https://api.github.com/users/waxenegger","html_url":"https://github.com/waxenegger","followers_url":"https://api.github.com/users/waxenegger/followers","following_url":"https://api.github.com/users/waxenegger/following{/other_user}","gists_url":"https://api.github.com/users/waxenegger/gists{/gist_id}","starred_url":"https://api.github.com/users/waxenegger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waxenegger/subscriptions","organizations_url":"https://api.github.com/users/waxenegger/orgs","repos_url":"https://api.github.com/users/waxenegger/repos","events_url":"https://api.github.com/users/waxenegger/events{/privacy}","received_events_url":"https://api.github.com/users/waxenegger/received_events","type":"User","site_admin":false},"body":"With clients other than insight potentially wanting to query some basic stats regarding intensity under rois there was a need to turn to the already deprecated RoiService in order to not reinvent the wheel.\r\n\r\nThere was a good deal there but some things needed fixing/changig:\r\n- A new rois service method was created: 'getShapeStatsRestricted'\r\n- the original sql in the old getShapeStats referenced a column that was not there.\r\n- not all SmartShapes implemented the method 'public void areaPoints(PointCallback cb)' needed for point iteration/stats accumulation but threw an error instead.\r\n- transforms were not integrated in the calculation\r\n- the old point iteration requested the same row of data a countless number of times and looped inefficiently\r\n- the old method allowed querying of big, tiled source which it could not cope with, the new one disallows it for now (perhaps tiled iteration is an option later)\r\n- the old method used the entire z/t range if shapes were not linked to a particular z/t, the new one forces 'fallback' z/t as parameters (the idea is that the z/t that one is looking at is used instead of going through all z*t combinations.\r\n- the new method restricts to using only rois on the same image in one call and groups rois by common z/t/c before looping so that that common combination is not requested from the reader more than once.\r\n\r\nTEST: check that the integration test (testStatsBasicUsageAndInputChecks) in https://ci.openmicroscopy.org/view/DEV/job/OMERO-DEV-merge-integration-java/lastCompletedBuild/testngreports/integration/RoiServiceTest/ passes.","created_at":"2017-08-23T06:57:05Z","updated_at":"2017-09-19T20:47:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2095d3fd982080b218939b9fdd77db3caa75967","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465/commits","review_comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465/comments","review_comment_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/5465/comments","statuses_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/866b161eae1170309f1af092c7ea61cfd5c2d8f1","head":{"label":"waxenegger:shape_stats_minimal","ref":"shape_stats_minimal","sha":"866b161eae1170309f1af092c7ea61cfd5c2d8f1","user":{"login":"waxenegger","id":1559229,"avatar_url":"https://avatars0.githubusercontent.com/u/1559229?v=4","gravatar_id":"","url":"https://api.github.com/users/waxenegger","html_url":"https://github.com/waxenegger","followers_url":"https://api.github.com/users/waxenegger/followers","following_url":"https://api.github.com/users/waxenegger/following{/other_user}","gists_url":"https://api.github.com/users/waxenegger/gists{/gist_id}","starred_url":"https://api.github.com/users/waxenegger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waxenegger/subscriptions","organizations_url":"https://api.github.com/users/waxenegger/orgs","repos_url":"https://api.github.com/users/waxenegger/repos","events_url":"https://api.github.com/users/waxenegger/events{/privacy}","received_events_url":"https://api.github.com/users/waxenegger/received_events","type":"User","site_admin":false},"repo":{"id":71335808,"name":"openmicroscopy","full_name":"waxenegger/openmicroscopy","owner":{"login":"waxenegger","id":1559229,"avatar_url":"https://avatars0.githubusercontent.com/u/1559229?v=4","gravatar_id":"","url":"https://api.github.com/users/waxenegger","html_url":"https://github.com/waxenegger","followers_url":"https://api.github.com/users/waxenegger/followers","following_url":"https://api.github.com/users/waxenegger/following{/other_user}","gists_url":"https://api.github.com/users/waxenegger/gists{/gist_id}","starred_url":"https://api.github.com/users/waxenegger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waxenegger/subscriptions","organizations_url":"https://api.github.com/users/waxenegger/orgs","repos_url":"https://api.github.com/users/waxenegger/repos","events_url":"https://api.github.com/users/waxenegger/events{/privacy}","received_events_url":"https://api.github.com/users/waxenegger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/waxenegger/openmicroscopy","description":"OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data. A joint project between universities, research establishments and industry in Europe and the USA, OME has over 20 active researchers with strong links to the microscopy community. Funded by private and public research grants, OME has been a major force on the international microscopy stage since 2000.","fork":true,"url":"https://api.github.com/repos/waxenegger/openmicroscopy","forks_url":"https://api.github.com/repos/waxenegger/openmicroscopy/forks","keys_url":"https://api.github.com/repos/waxenegger/openmicroscopy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/waxenegger/openmicroscopy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/waxenegger/openmicroscopy/teams","hooks_url":"https://api.github.com/repos/waxenegger/openmicroscopy/hooks","issue_events_url":"https://api.github.com/repos/waxenegger/openmicroscopy/issues/events{/number}","events_url":"https://api.github.com/repos/waxenegger/openmicroscopy/events","assignees_url":"https://api.github.com/repos/waxenegger/openmicroscopy/assignees{/user}","branches_url":"https://api.github.com/repos/waxenegger/openmicroscopy/branches{/branch}","tags_url":"https://api.github.com/repos/waxenegger/openmicroscopy/tags","blobs_url":"https://api.github.com/repos/waxenegger/openmicroscopy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/waxenegger/openmicroscopy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/waxenegger/openmicroscopy/git/refs{/sha}","trees_url":"https://api.github.com/repos/waxenegger/openmicroscopy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/waxenegger/openmicroscopy/statuses/{sha}","languages_url":"https://api.github.com/repos/waxenegger/openmicroscopy/languages","stargazers_url":"https://api.github.com/repos/waxenegger/openmicroscopy/stargazers","contributors_url":"https://api.github.com/repos/waxenegger/openmicroscopy/contributors","subscribers_url":"https://api.github.com/repos/waxenegger/openmicroscopy/subscribers","subscription_url":"https://api.github.com/repos/waxenegger/openmicroscopy/subscription","commits_url":"https://api.github.com/repos/waxenegger/openmicroscopy/commits{/sha}","git_commits_url":"https://api.github.com/repos/waxenegger/openmicroscopy/git/commits{/sha}","comments_url":"https://api.github.com/repos/waxenegger/openmicroscopy/comments{/number}","issue_comment_url":"https://api.github.com/repos/waxenegger/openmicroscopy/issues/comments{/number}","contents_url":"https://api.github.com/repos/waxenegger/openmicroscopy/contents/{+path}","compare_url":"https://api.github.com/repos/waxenegger/openmicroscopy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/waxenegger/openmicroscopy/merges","archive_url":"https://api.github.com/repos/waxenegger/openmicroscopy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/waxenegger/openmicroscopy/downloads","issues_url":"https://api.github.com/repos/waxenegger/openmicroscopy/issues{/number}","pulls_url":"https://api.github.com/repos/waxenegger/openmicroscopy/pulls{/number}","milestones_url":"https://api.github.com/repos/waxenegger/openmicroscopy/milestones{/number}","notifications_url":"https://api.github.com/repos/waxenegger/openmicroscopy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/waxenegger/openmicroscopy/labels{/name}","releases_url":"https://api.github.com/repos/waxenegger/openmicroscopy/releases{/id}","deployments_url":"https://api.github.com/repos/waxenegger/openmicroscopy/deployments","created_at":"2016-10-19T08:32:03Z","updated_at":"2016-10-19T08:32:21Z","pushed_at":"2017-09-19T15:17:54Z","git_url":"git://github.com/waxenegger/openmicroscopy.git","ssh_url":"git@github.com:waxenegger/openmicroscopy.git","clone_url":"https://github.com/waxenegger/openmicroscopy.git","svn_url":"https://github.com/waxenegger/openmicroscopy","homepage":"http://www.openmicroscopy.org","size":1974098,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"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":"develop"}},"base":{"label":"openmicroscopy:develop","ref":"develop","sha":"b4d78e58457d73b9bbf10dfd2f68f3555c9522bf","user":{"login":"openmicroscopy","id":975861,"avatar_url":"https://avatars2.githubusercontent.com/u/975861?v=4","gravatar_id":"","url":"https://api.github.com/users/openmicroscopy","html_url":"https://github.com/openmicroscopy","followers_url":"https://api.github.com/users/openmicroscopy/followers","following_url":"https://api.github.com/users/openmicroscopy/following{/other_user}","gists_url":"https://api.github.com/users/openmicroscopy/gists{/gist_id}","starred_url":"https://api.github.com/users/openmicroscopy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmicroscopy/subscriptions","organizations_url":"https://api.github.com/users/openmicroscopy/orgs","repos_url":"https://api.github.com/users/openmicroscopy/repos","events_url":"https://api.github.com/users/openmicroscopy/events{/privacy}","received_events_url":"https://api.github.com/users/openmicroscopy/received_events","type":"Organization","site_admin":false},"repo":{"id":2228226,"name":"openmicroscopy","full_name":"openmicroscopy/openmicroscopy","owner":{"login":"openmicroscopy","id":975861,"avatar_url":"https://avatars2.githubusercontent.com/u/975861?v=4","gravatar_id":"","url":"https://api.github.com/users/openmicroscopy","html_url":"https://github.com/openmicroscopy","followers_url":"https://api.github.com/users/openmicroscopy/followers","following_url":"https://api.github.com/users/openmicroscopy/following{/other_user}","gists_url":"https://api.github.com/users/openmicroscopy/gists{/gist_id}","starred_url":"https://api.github.com/users/openmicroscopy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmicroscopy/subscriptions","organizations_url":"https://api.github.com/users/openmicroscopy/orgs","repos_url":"https://api.github.com/users/openmicroscopy/repos","events_url":"https://api.github.com/users/openmicroscopy/events{/privacy}","received_events_url":"https://api.github.com/users/openmicroscopy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmicroscopy/openmicroscopy","description":"OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data. A joint project between universities, research establishments and industry in Europe and the USA, OME has over 20 active researchers with strong links to the microscopy community. Funded by private and public research grants, OME has been a major force on the international microscopy stage since 2000.","fork":false,"url":"https://api.github.com/repos/openmicroscopy/openmicroscopy","forks_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/forks","keys_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/teams","hooks_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/hooks","issue_events_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/events{/number}","events_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/events","assignees_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/assignees{/user}","branches_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/branches{/branch}","tags_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/tags","blobs_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/{sha}","languages_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/languages","stargazers_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/stargazers","contributors_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/contributors","subscribers_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/subscribers","subscription_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/subscription","commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/contents/{+path}","compare_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/merges","archive_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/downloads","issues_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues{/number}","pulls_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls{/number}","milestones_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/milestones{/number}","notifications_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/labels{/name}","releases_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/releases{/id}","deployments_url":"https://api.github.com/repos/openmicroscopy/openmicroscopy/deployments","created_at":"2011-08-18T14:26:02Z","updated_at":"2017-08-30T15:14:46Z","pushed_at":"2017-09-19T19:22:23Z","git_url":"git://github.com/openmicroscopy/openmicroscopy.git","ssh_url":"git@github.com:openmicroscopy/openmicroscopy.git","clone_url":"https://github.com/openmicroscopy/openmicroscopy.git","svn_url":"https://github.com/openmicroscopy/openmicroscopy","homepage":"http://www.openmicroscopy.org/omero","size":1975378,"stargazers_count":103,"watchers_count":103,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":79,"mirror_url":null,"open_issues_count":31,"forks":79,"open_issues":31,"watchers":103,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465"},"html":{"href":"https://github.com/openmicroscopy/openmicroscopy/pull/5465"},"issue":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/5465"},"comments":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/issues/5465/comments"},"review_comments":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465/comments"},"review_comment":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/pulls/5465/commits"},"statuses":{"href":"https://api.github.com/repos/openmicroscopy/openmicroscopy/statuses/866b161eae1170309f1af092c7ea61cfd5c2d8f1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jburel"}}