MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / pad

Method pad

ij/src/main/java/ij/plugin/FFT.java:337–361  ·  view source on GitHub ↗
(ImageProcessor ip)

Source from the content-addressed store, hash-verified

335 }
336
337 ImageProcessor pad(ImageProcessor ip) {
338 originalWidth = ip.getWidth();
339 originalHeight = ip.getHeight();
340 int maxN = Math.max(originalWidth, originalHeight);
341 int i = 2;
342 while(i<maxN) i *= 2;
343 if (i==maxN && originalWidth==originalHeight) {
344 padded = false;
345 return ip;
346 }
347 maxN = i;
348 showStatus("Padding to "+ maxN + "x" + maxN);
349 if (maxN>=65536) {
350 IJ.error("FFT", "Padded image is too large ("+maxN+"x"+maxN+")");
351 return null;
352 }
353 ImageStatistics stats = ImageStatistics.getStatistics(ip, MEAN, null);
354 ImageProcessor ip2 = ip.createProcessor(maxN, maxN);
355 ip2.setValue(stats.mean);
356 ip2.fill();
357 ip2.insert(ip, 0, 0);
358 padded = true;
359 Undo.reset();
360 return ip2;
361 }
362
363 void showStatus(String msg) {
364 if (stackSize>1)

Callers 1

newFHTMethod · 0.95

Calls 11

showStatusMethod · 0.95
errorMethod · 0.95
getStatisticsMethod · 0.95
setValueMethod · 0.95
fillMethod · 0.95
insertMethod · 0.95
resetMethod · 0.95
getWidthMethod · 0.45
getHeightMethod · 0.45
maxMethod · 0.45
createProcessorMethod · 0.45

Tested by

no test coverage detected