Updated ContrastAdjuster.java
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 786
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
I updated the ContrastAdjuster.java file to show the image histogram with the LUT colors of the image (if image has LUT). This is especially useful when dealing with atomic force microscopy images.

See the movie below for more details.
Note: these changes are based in part on code from ThresholdAdjuster.java.
Updated ContrastAdjuster.java:
- If image has LUT the image histogram is rendered using the LUT colors.
- The histogram is rendered with LUT accordingly to the current minimum and maximum values (or Contrast and Brightness and so on).
- Added a checkbox for render the histogram with a logarithmic scale.
- Moreover, the title of the "Color Balance..." window is set to "LUT color" and only one channel ("LUT scale") is available for modification when the active image is GREY8 or GREY16 or GREY32 (and is not composite).
- Corrected a bug when there are no open images, the "Color Balance..." window is open and the channel is changed (e.g. from “Red” to “Green”).
_Start of debug log when this error is triggered:
ImageJ 1.54p; Java 1.8.0_345 [64-bit]; Mac OS X 10.16; 22MB of 3000MB (<1%)
java.lang.NullPointerException
at ij.plugin.frame.ContrastAdjuster.itemStateChanged(ContrastAdjuster.java:1200)
at java.awt.Choice.processItemEvent(Choice.java:631) …_
These changes are useful when dealing with atomic force microscopy images, but may be also of interest for other users.
If this is the case, I can make a pull request.
Lorenzo
https://github.com/user-attachments/assets/fd234748-bd6d-4b0f-8a7e-ec2e8d33e8b3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ij/plugin/frame/ContrastAdjuster.java and compare the relevant behavior with ThresholdAdjuster.java. Reproduce the no-open-image channel-change case from the reported stack trace, then verify LUT-colored histograms, logarithmic scaling, and the Color Balance window behavior for GREY8, GREY16, and GREY32 images.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100