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

Method getData

ij/src/main/java/ij/plugin/frame/Fitter.java:146–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144 double sqr(double x) {return x*x;}
145
146 boolean getData() {
147 textArea.selectAll();
148 String text = textArea.getText();
149 text = zapGremlins(text);
150 textArea.select(0,0);
151 StringTokenizer st = new StringTokenizer(text, " \t\n\r,");
152 int nTokens = st.countTokens();
153 if (nTokens<4 || (nTokens%2)!=0) {
154 IJ.showStatus("Data error: min. two (x,y) pairs needed");
155 return false;
156 }
157 int n = nTokens/2;
158 x = new double[n];
159 y = new double[n];
160 for (int i=0; i<n; i++) {
161 String xString = st.nextToken();
162 String yString = st.nextToken();
163 x[i] = Tools.parseDouble(xString);
164 y[i] = Tools.parseDouble(yString);
165 if (Double.isNaN(x[i]) || Double.isNaN(y[i])) {
166 IJ.showStatus("Data error: Bad number at "+i+": "+xString+" "+yString);
167 return false;
168 }
169 }
170 return true;
171 }
172
173 /** create a duplicate of an image where the fit function is applied to the pixel values */
174 void applyFunction() {

Callers 7

doFitMethod · 0.95
runMethod · 0.45
ByteProcessorMethod · 0.45
ShortProcessorMethod · 0.45
get16BitBufferedImageMethod · 0.45

Calls 7

zapGremlinsMethod · 0.95
showStatusMethod · 0.95
parseDoubleMethod · 0.95
selectAllMethod · 0.45
getTextMethod · 0.45
selectMethod · 0.45
nextTokenMethod · 0.45

Tested by

no test coverage detected