void loadTransformation(String filename, ResultsTable res) { try { String line; FileReader fr = new FileReader(filename); BufferedReader br = new BufferedReader(fr); if (!br.readLine().equals(" Z-Step Raw Width minus Heigh Calibration Width minus Height")) { IJ.error("File does not seam to be an Astigmatism calibration file"); return; } // java.lang.String [] elements = new java.lang.String [3]; java.lang.String[] elements; int counter = 1; res.reset(); while ((line = br.readLine()) != null) { IJ.showStatus("Loading element " + counter + "... sit back and relax."); counter++; line.trim(); elements = line.split("\t"); res.incrementCounter(); res.addValue("Z-Step", Double.parseDouble(elements[1])); res.addValue("Raw Width minus Heigh", Double.parseDouble(elements[2])); res.addValue("Calibration Width minus Height", Double.parseDouble(elements[3])); } fr.close(); } catch (FileNotFoundException e) { IJ.error("File not found exception" + e); return; } catch (IOException e) { IJ.error("IOException exception" + e); return; } catch (NumberFormatException e) { IJ.error("Number format exception" + e); return; } }
public void run() { line.trim(); elements = line.split("\t"); if (elements.length < 14) return; lock.lock(); res.incrementCounter(); res.addValue("Intensity", Double.parseDouble(elements[1])); res.addValue("X (px)", Double.parseDouble(elements[2])); res.addValue("Y (px)", Double.parseDouble(elements[3])); res.addValue("X (nm)", Double.parseDouble(elements[4])); res.addValue("Y (nm)", Double.parseDouble(elements[5])); res.addValue("Z (nm)", Double.parseDouble(elements[6])); res.addValue("Left-StdDev (px)", Double.parseDouble(elements[7])); res.addValue("Right-StdDev (px)", Double.parseDouble(elements[8])); res.addValue("Up-StdDev (px)", Double.parseDouble(elements[9])); res.addValue("Down-StdDev (px)", Double.parseDouble(elements[10])); res.addValue("X Symmetry (%)", Double.parseDouble(elements[11])); res.addValue("Y Symmetry (%)", Double.parseDouble(elements[12])); res.addValue("Width minus Height (px)", Double.parseDouble(elements[13])); res.addValue("Frame Number", Double.parseDouble(elements[14])); lock.unlock(); }