Returns 'true' if the LUTs of the two images differ.
(ImagePlus imp1, ImagePlus imp2)
| 114 | |
| 115 | /** Returns 'true' if the LUTs of the two images differ. */ |
| 116 | public static boolean LutsDiffer(ImagePlus imp1, ImagePlus imp2) { |
| 117 | if (!imp1.isComposite() || !imp2.isComposite()) |
| 118 | return false; |
| 119 | LUT[] luts1 = ((CompositeImage)imp1).getLuts(); |
| 120 | LUT[] luts2 = ((CompositeImage)imp2).getLuts(); |
| 121 | if (luts1==null || luts2==null) |
| 122 | return false; |
| 123 | if (luts1.length!=luts2.length) |
| 124 | return true; |
| 125 | for (int i=0; i<luts1.length; i++) { |
| 126 | if (luts1[i].min!=luts2[i].min) |
| 127 | return true; |
| 128 | if (luts1[i].max!=luts2[i].max) |
| 129 | return true; |
| 130 | byte[] bytes1 = luts1[i].getBytes(); |
| 131 | byte[] bytes2 = luts2[i].getBytes(); |
| 132 | if (bytes1.length!=bytes2.length) |
| 133 | return true; |
| 134 | for (int j=0; j<bytes1.length; j++) { |
| 135 | if (bytes1[j]!=bytes2[j]) |
| 136 | return true; |
| 137 | } |
| 138 | } |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | } |
no test coverage detected