Ticket #1871 (closed defect: fixed)
Opened 2013-05-15T13:37:22-05:00
Last modified 2013-06-05T15:35:58-05:00
Change how binary data is checked and synchronized
Reported by: | bdezonia | Owned by: | bdezonia |
---|---|---|---|
Priority: | major | Milestone: |
|
Component: | Legacy Compatibility | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1661 |
Description
The isBinary() code that is utilized in the legacy layer ir problematic:
- it can be expensive since it potentially checks every pixel of an image
- it can call getProcessor() a number of times which messes up virtual stack caching
- it can change images that are all black or all white into 1-bit data
We should simplify this code:
1) avoid unnecessary isBinary() class by only checking this code when IJ2 started as 1-bit and only then do we type munge the output. If the IJ1 data is no longer binary we could ignore and clamp to 1 bit (relative to 0 or 128 as we see fit). (never translate back 8-bit nonbinary data)
2) isBinary could change in the future to return true only is it has all 0's and 255's but with at least one of each. This avoid patholgical cases like all 0 image becoming 1-bit image.
3) isBinary could also be less thorough only checking the one loaded plane. This would improve performance for cases like big virtual stacks.
The decision was made to entirely eliminate isBinary() tracking. This simplifies harmonization code and speeds it also. The code is currently on the scifiocells branch as commit 1eb7b90f77d05e900320197eda927a9a9e5a8359