User Tools

Site Tools


documents:120206pyip_cooking:python_imagej_cookbook

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
documents:120206pyip_cooking:python_imagej_cookbook [2017/06/07 03:13] – github username changed kotadocuments:120206pyip_cooking:python_imagej_cookbook [2017/12/03 14:08] – [Automatic Brightness/Contrast Button] human language explanation added kota
Line 973: Line 973:
       - if the count is larger than "threshold", then that value is the maximum.        - if the count is larger than "threshold", then that value is the maximum. 
  
-The jython script shown below is the re-written version based on original Java code. You could see the Java code [[https://github.com/fiji/imagej/blob/master/ij/plugin/frame/ContrastAdjuster.java|in the git repo]], line 739-767+Explanation in human language: this algorithm first determines two values "limit" and "Threshold".  
 + 
 +"Threshold" is the parameter that actually sets the min and the max of the contrast curve for the automatic enhancement. Starting from the lowest pixel value (0) or the highest value (255), the algorithm determines the number of pixels with that pixel value. If the number exceeds 0.02% of total pixel number, then that pixel value becomes wither the min or the max for enhancing the contrast. For this decision to ignore background pixels, the algorithm also needs to have another decision determining the background pixel value.  
 + 
 +"limit" actually is a fixed number for each image to decide which of black (0) or white (255) is the background. If the number of pixels with current pixel value is more than 10% of total pixel number, then that value is considered to be the background of the image. For example, when the number of pixels with the value of 0 is 15%, then pixels with 0 values are background. In the next step, if pixels with the value of 1 are still over 10% like 11%, then pixels with values <= 1 are background. When the background is white, then similar decision takes place in the second loop.  
 + 
 +The Jython script shown below is the re-written version based on original Java code. You could see the Java code of method "autoadjust"  [[https://github.com/imagej/imagej1/blob/master/ij/plugin/frame/ContrastAdjuster.java#L780-L829|in the git repo]], line 780-829
  
 <code python linenums:1> <code python linenums:1>
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki