Title: Disappointing Converter behavior · Issue #197 · scijava/scijava · GitHub
Open Graph Title: Disappointing Converter behavior · Issue #197 · scijava/scijava
X Title: Disappointing Converter behavior · Issue #197 · scijava/scijava
Description: I am starting with this 16-bit image: If I convert it with Image > Type > 8-bit in Fiji I get: If I denoise this image I get this result (which I'm happy with): But if I try to convert it with e.g. result = ops.unary("convert.int8").inpu...
Open Graph Description: I am starting with this 16-bit image: If I convert it with Image > Type > 8-bit in Fiji I get: If I denoise this image I get this result (which I'm happy with): But if I try to convert it with e.g....
X Description: I am starting with this 16-bit image: If I convert it with Image > Type > 8-bit in Fiji I get: If I denoise this image I get this result (which I'm happy with): But if I try to convert it...
Opengraph URL: https://github.com/scijava/scijava/issues/197
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Disappointing Converter behavior","articleBody":"I am starting with this 16-bit image:\r\n\u003cimg width=\"685\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/129555b1-8250-4a73-b17e-1ffa587e38e3\"\u003e\r\n\r\nIf I convert it with `Image \u003e Type \u003e 8-bit` in Fiji I get:\r\n\u003cimg width=\"682\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/236dfedd-b6a4-4a55-ae9a-e5790d44834d\"\u003e\r\n\r\nIf I denoise this image I get this result (which I'm happy with):\r\n\u003cimg width=\"679\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/0adc3d19-7c01-4ca7-b210-399c32dbf98f\"\u003e\r\n\r\nBut if I try to convert it with e.g. `result = ops.unary(\"convert.int8\").input(img).apply()` I get.. a `32-bit` image??\r\n\u003cimg width=\"687\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/eb10677c-efb4-4c47-819e-70dc0ef0843f\"\u003e\r\n\r\n`convert.uint8` is 8-bit, at least..\r\n\u003cimg width=\"681\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/8597583e-2962-451c-b7d3-b2b4abd5e788\"\u003e\r\n\r\n\r\nSmoothing the uint-8 version requires bumping up the smoothing strength significantly and it still doesn't look great:\r\n\u003cimg width=\"691\" alt=\"image\" src=\"https://github.com/scijava/scijava/assets/1123809/3e13ae29-e027-4dbb-8b22-6457236e080b\"\u003e\r\n\r\nSo, how I account for this behavior is:\r\n- In the ImageJ type conversion, values are scaled proportionately to the new range\r\n- In the SJ Ops type conversion, values are directly translated. This can result in type overflow (note the split tails in both the `int8` and `uint8` conversions) which **fundamentally changes the behavior of subsequent image processing**.\r\n- These [byte casts](https://github.com/scijava/incubator/blob/a969114d2f047a47dffb3ca2d189a3263d56d98a/scijava-ops-image/src/main/java/org/scijava/ops/image/convert/ConvertTypes.java#L111-L125) are perhaps not working as intended?\r\n\r\n@gselzer @ctrueden Is there rationale for not scaling the converters to the target data range?","author":{"url":"https://github.com/hinerm","@type":"Person","name":"hinerm"},"datePublished":"2024-03-12T19:01:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/197/scijava/issues/197"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c8e6f97f-547a-5c69-04a3-d1ea7a0f9474 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBFA:8D142:2C255E9:39E4C36:696B2F44 |
| html-safe-nonce | 57994046368596d2d6e50a9fbfcf45963b838a266756040a66352c29fa915a76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkZBOjhEMTQyOjJDMjU1RTk6MzlFNEMzNjo2OTZCMkY0NCIsInZpc2l0b3JfaWQiOiI4NTc0MDQ1NjcxNDk0NzI1NDQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c39d5069b1004b9e612fa9ff986202976dcb396a97763177e92c53bc2dfd9d43 |
| hovercard-subject-tag | issue:2182470754 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scijava/scijava/197/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c9eacebff3f29754351f5f0b87c314d2c1b5228e5ca72c35f300e5e2a34628b/scijava/scijava/issues/197 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c9eacebff3f29754351f5f0b87c314d2c1b5228e5ca72c35f300e5e2a34628b/scijava/scijava/issues/197 |
| og:image:alt | I am starting with this 16-bit image: If I convert it with Image > Type > 8-bit in Fiji I get: If I denoise this image I get this result (which I'm happy with): But if I try to convert it with e.g.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hinerm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/scijava/scijava git https://github.com/scijava/scijava.git |
| octolytics-dimension-user_id | 1262770 |
| octolytics-dimension-user_login | scijava |
| octolytics-dimension-repository_id | 85618439 |
| octolytics-dimension-repository_nwo | scijava/scijava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 85618439 |
| octolytics-dimension-repository_network_root_nwo | scijava/scijava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width