import java.awt.*; import java.awt.Panel; import java.awt.Button; import java.awt.event.*; import javax.swing.*; import ij.*; import ij.gui.*; import ij.plugin.filter.*; import ij.process.*; import ij.gui.WaitForUserDialog; /** * This ImageJ plugin calculates the 3D-noise from a sequence * of images. The 3D-noise algorithm follows that developed by * the Night Vision Lab (or Night Vision Electronic Sensor Directorate) * at Fort Belvoir, VA. * see "Infrared Focal Plane Noise Parameter Definitions" * by J. G. Zeibel & R.T. Littleton at NVESD, October 2003 * * Useage: * 1) Open an image sequence or video file and selects an ROI. * 2) Run this plug-in * 3) Verify the ROI. * 4) Input a Signal Transfer function (SiTF). * This plugin was developed to analyze the 3D-noise * of infrared images. Thus, the SiTF has units to convert * image signal to degrees-Centigrade. * * Output: * The ImageJ Results Window is loaded with * a) Eight 3D-noise components and the temporal noise. * If an SiTF is entered, the units are milli-Kelvin. * b) The SiTF (if used) * c) The mean image signal within the ROI * d) Size of the "Data Cube": height, width, # frames * * Author = Dwight Urban Bartholomew * L3 Communications Infrared Products * February 2008 */ public class Calculate_3D_Noise implements PlugInFilter, ActionListener { int iX; int iY; int iXROI; int iYROI; int iSlice; int Nt; int Nv; int Nh; boolean bAbort; ImagePlus imp; char Tab; char Sigma; double SiTF; boolean bSiTF; GenericDialog TheGD; Rectangle r; Button TheButton; /** * Called by ImageJ when the filter is loaded */ public int setup(String arg, ImagePlus imp) { this.imp = imp; if (arg.equals("about")) {showAbout(); return DONE;} if (IJ.versionLessThan("1.39r")) return DONE; return DOES_8G+DOES_16+DOES_32+ROI_REQUIRED+NO_CHANGES; } /** * Called by ImageJ to process the image */ public void run(ImageProcessor ip) { bAbort = false; r = ip.getRoi(); Nt = imp.getNSlices(); Nv = r.height; Nh = r.width; iXROI = r.x; iYROI = r.y; iSlice = imp.getCurrentSlice(); Tab = (char)9; Sigma = (char)963; SiTF = 0.0; bSiTF = false; //################################################# //Ask User to verify the Region of Interest (ROI) to analyze get3DnoiseROI(); if (bAbort) return; iX = iXROI; iY = iYROI; //Display the ROI as a rectangle on the image imp.setRoi(iX, iY, Nh, Nv); //################################################# //Ask User for a Signal Transfer Function (SITF) Object info = imp.getProperty("Info"); Object DefVal = null; double oldSiTF = 0.0; if (info!=null && info instanceof String) { //oldSiTF = Double.valueOf((String)info).doubleValue(); oldSiTF = ij.util.Tools.parseDouble((String)info, 0.0); } SiTF = getSiTF(oldSiTF); // Store the SiTF within the image information property imp.setProperty("Info", ""+SiTF); //################################################# //Place the ROI into a 3D array Stvh, the "data cube" int t, v, h, cSlice; double[][][] Stvh = new double[Nt][Nv][Nh]; cSlice = imp.getCurrentSlice(); for(t=0; t