NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

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: imagej2-b7-ndim-data
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1661


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.

Change History

comment:1 Changed 2013-05-17T14:46:09-05:00 by bdezonia

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

Last edited 2013-05-17T14:46:36-05:00 by bdezonia

comment:2 Changed 2013-06-05T15:35:58-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

Merged. Closing.