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 #545 (closed defect: fixed)

Opened 2011-05-26T14:18:59-05:00

Last modified 2011-10-12T14:27:58-05:00

Enhance Contrast doesn't

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b1-initial
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:


Running legacy plugin Process :: Enhance Contrast does not work unless you are using a color Dataset. Note that color Datasets synchronize data by value while all others synchronize data by reference. Might be a legacy layer issue.

Change History

comment:1 Changed 2011-05-31T15:27:47-05:00 by bdezonia

Code inspection did not turn anything up immediately. Verified that the various processors munge pixel data and do not just play with LUT. applyTable() seems to be getting called. (Note that an example Dataset that doesn't work is Boats).

comment:2 Changed 2011-06-01T11:58:50-05:00 by bdezonia

  • Milestone changed from biweekly-2011: May-23 to Jun-03 to imagej-2.0-beta1

Stepped through with debugger. The exact conditions to show problem entail using an unsigned byte image and making sure the Normalize option in the called plugin is false. If its false the only code that is run changes the display range and redraws. For color images or when normalizing eventually ip.applyTable() is called instead which will munge pixels and thus avoid the problem.

This points out a need to either track the resetting of the display range in LegacyManager and update it in IJ2 or else we need to write a pure IJ2 implementation of the ContrastEnhancer plugin.

comment:3 Changed 2011-06-21T13:57:59-05:00 by bdezonia

See ContrastEnhancer::stretchHistogram(ImageProcessor ip, double saturated, ImageStatistics stats) to see where normalize() (which munges pixels) is only called if checkbox set. Otherwise just ip.setMinAndMax() is called that has no effect on pixel values.

comment:4 Changed 2011-06-29T14:46:53-05:00 by bdezonia

After discussions have determined that we will need to capture the setting of the discplay range in the legacy layer. Probably via ip.setMinAndMax(). When captured we'll need to set the display range for the correct Display (or display view).

comment:5 Changed 2011-06-29T14:47:27-05:00 by bdezonia

Waiting for display <--> imageplus mapping in legacy layer to be completed.

comment:6 Changed 2011-09-02T14:06:38-05:00 by bdezonia

Capture this method of ImageProcessor?
public void setThreshold(double minThreshold, double maxThreshold, int lutUpdate)

Or this method of ImageProcessor?
abstract public void setMinAndMax() ?

Will tracking this cause performance issues?

comment:7 Changed 2011-10-11T16:25:15-05:00 by bdezonia

Need to think about the tricky issue: how to go from an ImageProcessor to an ImagePlus so we can eventually get back to a Display.

comment:8 Changed 2011-10-11T16:30:49-05:00 by bdezonia

  • Owner changed from bdezonia to afraser
  • Status changed from new to assigned

Testing with 4def5b7e289d3c0c62405f5fbd415ee56b4f3467 can no longer duplicate the problem. Perhaps Adam changed something with his recent brightness/contrast work. Passing on for clarification.

comment:9 Changed 2011-10-12T14:25:02-05:00 by bdezonia

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

This appears fixed with Curtis recent changes for setting diplay mins/maxes from IJ1. I have extended code in legacy layer with commit 9f56a63c98ac6bda648c131c8a1c80013b90910a that completes the range setting from IJ2 to IJ1.

comment:10 Changed 2011-10-12T14:27:50-05:00 by bdezonia

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:11 Changed 2011-10-12T14:27:55-05:00 by bdezonia

  • Owner changed from afraser to bdezonia
  • Status changed from reopened to assigned

comment:12 Changed 2011-10-12T14:27:58-05:00 by bdezonia

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