(ImagePlus imp1, ImagePlus imp2)
| 80 | } |
| 81 | |
| 82 | public void doMath(ImagePlus imp1, ImagePlus imp2) { |
| 83 | FHT h1, h2=null; |
| 84 | ImageProcessor fht1, fht2; |
| 85 | fht1 = (ImageProcessor)imp1.getProperty("FHT"); |
| 86 | if (fht1!=null) |
| 87 | h1 = new FHT(fht1); |
| 88 | else { |
| 89 | IJ.showStatus("Converting to float"); |
| 90 | ImageProcessor ip1 = imp1.getProcessor(); |
| 91 | h1 = new FHT(ip1); |
| 92 | } |
| 93 | fht2 = (ImageProcessor)imp2.getProperty("FHT"); |
| 94 | if (fht2!=null) |
| 95 | h2 = new FHT(fht2); |
| 96 | else { |
| 97 | ImageProcessor ip2 = imp2.getProcessor(); |
| 98 | if (imp2!=imp1) |
| 99 | h2 = new FHT(ip2); |
| 100 | } |
| 101 | if (!h1.powerOf2Size()) { |
| 102 | IJ.error("FFT Math", "Images must be a power of 2 size (256x256, 512x512, etc.)"); |
| 103 | return; |
| 104 | } |
| 105 | if (imp1.getWidth()!=imp2.getWidth()) { |
| 106 | IJ.error("FFT Math", "Images must be the same size"); |
| 107 | return; |
| 108 | } |
| 109 | if (fht1==null) { |
| 110 | IJ.showStatus("Transform image1"); |
| 111 | h1.transform(); |
| 112 | } |
| 113 | if (fht2==null) { |
| 114 | if (h2==null) |
| 115 | h2 = new FHT(h1.duplicate()); |
| 116 | else { |
| 117 | IJ.showStatus("Transform image2"); |
| 118 | h2.transform(); |
| 119 | } |
| 120 | } |
| 121 | FHT result=null; |
| 122 | switch (operation) { |
| 123 | case CONJUGATE_MULTIPLY: |
| 124 | IJ.showStatus("Complex conjugate multiply"); |
| 125 | result = h1.conjugateMultiply(h2); |
| 126 | break; |
| 127 | case MULTIPLY: |
| 128 | IJ.showStatus("Fourier domain multiply"); |
| 129 | result = h1.multiply(h2); |
| 130 | break; |
| 131 | case DIVIDE: |
| 132 | IJ.showStatus("Fourier domain divide"); |
| 133 | result = h1.divide(h2); |
| 134 | break; |
| 135 | } |
| 136 | ImagePlus imp3 = null; |
| 137 | if (doInverse) { |
| 138 | IJ.showStatus("Inverse transform"); |
| 139 | result.inverseTransform(); |
no test coverage detected