Skip to content

Commit

Permalink
2018.06.20 (1.52e7)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Jun 22, 2018
1 parent 01f235f commit 5137096
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion ij/IJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -2195,7 +2195,7 @@ public static String[] getLuts() {
ArrayList list = new ArrayList();
Hashtable commands = Menus.getCommands();
Menu lutsMenu = Menus.getImageJMenu("Image>Lookup Tables");
if (lutsMenu==null)
if (commands==null || lutsMenu==null)
return new String[0];
for (int i=0; i<lutsMenu.getItemCount(); i++) {
MenuItem menuItem = lutsMenu.getItem(i);
Expand Down
2 changes: 1 addition & 1 deletion ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.52e";
public static final String BUILD = "6";
public static final String BUILD = "7";
public static Color backgroundColor = new Color(237,237,237);
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
Expand Down
2 changes: 2 additions & 0 deletions ij/Menus.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,8 @@ void addJarErrorHeading(String jar) {

/** Returns the specified ImageJ menu (e.g., "File>New") or null if it is not found. */
public static Menu getImageJMenu(String menuPath) {
if (menus==null)
return null;
if (menus.get(menuPath)!=null)
return getMenu(menuPath, false);
else
Expand Down
36 changes: 20 additions & 16 deletions ij/process/ImageProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ public ColorModel getColorModel() {
return cm;
}

private IndexColorModel getIndexColorModel() {
ColorModel cm2 = baseCM;
if (cm2==null)
cm2 = cm;
if (cm2!=null && (cm2 instanceof IndexColorModel))
return (IndexColorModel)cm2;
else
return null;
}

/** Returns the current color model, which may have
been modified by setMinAndMax() or setThreshold(). */
public ColorModel getCurrentColorModel() {
Expand Down Expand Up @@ -280,15 +290,9 @@ public int getBestIndex(Color c) {
public boolean isInvertedLut() {
if (inversionTested)
return invertedLut;
ColorModel cm2 = baseCM;
if (cm2==null)
cm2 = cm;
if (cm2==null || !(cm2 instanceof IndexColorModel)) {
invertedLut = false;
inversionTested = true;
return invertedLut;
}
IndexColorModel icm = (IndexColorModel)cm2;
IndexColorModel icm = getIndexColorModel();
if (icm==null)
return false;
boolean hasAscendingStep = false;
int v1, v2;
for (int i=1; i<255; i++) {
Expand All @@ -313,9 +317,9 @@ public boolean isGrayscale() {

/** Returns true if this image uses a color LUT. */
public boolean isColorLut() {
if (cm==null || !(cm instanceof IndexColorModel))
IndexColorModel icm = getIndexColorModel();
if (icm==null)
return false;
IndexColorModel icm = (IndexColorModel)cm;
int mapSize = icm.getMapSize();
byte[] reds = new byte[mapSize];
byte[] greens = new byte[mapSize];
Expand All @@ -336,11 +340,11 @@ public boolean isColorLut() {
/** Returns true if this image uses a pseudocolor or grayscale LUT,
in other words, is this an image that can be filtered. */
public boolean isPseudoColorLut() {
if (cm==null || !(cm instanceof IndexColorModel))
IndexColorModel icm = getIndexColorModel();
if (icm==null)
return false;
if (getMinThreshold()!=NO_THRESHOLD)
return true;
IndexColorModel icm = (IndexColorModel)cm;
int mapSize = icm.getMapSize();
if (mapSize!=256)
return false;
Expand Down Expand Up @@ -376,9 +380,9 @@ public boolean isPseudoColorLut() {
public boolean isDefaultLut() {
if (cm==null)
makeDefaultColorModel();
if (!(cm instanceof IndexColorModel))
return false;
IndexColorModel icm = (IndexColorModel)cm;
IndexColorModel icm = getIndexColorModel();
if (icm==null)
return false;
int mapSize = icm.getMapSize();
if (mapSize!=256)
return false;
Expand Down
6 changes: 3 additions & 3 deletions release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
(<a href="http://wsr.imagej.net/macros/FFT_Filter.js">example</a>).
<li> The open("/path/to/file.avi") macro function and the IJ.openImage("/path/to/file.avi")
method now open AVI files by default as virtual stacks.
<li> Thanks to Volko Straub and Michael Schmid, fixed a bug that caused the
ImageProcessor.isInvertedLut() method to sometimes incorrectly return 'false'
with thresholded images.
<li> Thanks to Volko Straub and Michael Schmid, fixed bugs that caused the
ImageProcessor.isInvertedLut() and ImageProcessor.isColorLut() methods
to sometimes incorrectly return 'true' with thresholded images.
</ul>

<li> <u>1.52d 11 June 2018</u>
Expand Down

0 comments on commit 5137096

Please sign in to comment.