Skip to content

Conversation

@minnerbe
Copy link
Contributor

@minnerbe minnerbe commented Jun 9, 2025

This PR fixes a minor off-by-one error of the "fast CLAHE" algorithm: the last column and row were not corrected before. I noticed this when correcting and reslicing a stack, which resulted in the last slice not being corrected.

This is a zoom-in of the lower right corner of the 'boats' image, treated with fast CLAHE (left) and normal CLAHE (right). Note the dark right and bottom pixels.

image

To reproduce, execute this:

final ImageJ ij = new ImageJ();
final ImagePlus imp = IJ.openImage("http://imagej.net/images/boats.gif");
imp.setRoi(26,20,668,543);
final ImagePlus cropped = imp.resize(668, 543, "bilinear");
cropped.setTitle("Original");
cropped.show();

final ImagePlus clahed = cropped.duplicate();
clahed.setTitle("CLAHE");
Flat.getInstance().run(clahed, 127, 256, 3.0f, null, false);
clahed.show();

final ImagePlus fastClahed = cropped.duplicate();
fastClahed.setTitle("Fast CLAHE");
Flat.getFastInstance().run(fastClahed, 127, 256, 3.0f, null, false);
fastClahed.show();

Tagging @axtimwalde and @StephanPreibisch for discussion.

@axtimwalde axtimwalde merged commit 140c36e into axtimwalde:master Jun 9, 2025
1 check passed
@minnerbe minnerbe deleted the fix/fast-clahe branch June 9, 2025 23:35
@minnerbe
Copy link
Contributor Author

minnerbe commented Jun 9, 2025

Thanks, @axtimwalde ! You might want to hold off deploying if you planned on doing that, since I'm still working on another aspect of the CLAHE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants