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

Method read

ij/src/main/java/ij/plugin/TextReader.java:144–172  ·  view source on GitHub ↗
(Reader r, int size, float[] pixels)

Source from the content-addressed store, hash-verified

142 }
143
144 void read(Reader r, int size, float[] pixels) throws IOException {
145 StreamTokenizer tok = new StreamTokenizer(r);
146 tok.resetSyntax();
147 tok.wordChars(43, 43);
148 tok.wordChars(45, 127);
149 tok.whitespaceChars(0, 42);
150 tok.whitespaceChars(44, 44);
151 //tok.wordChars(33, 127);
152 //tok.whitespaceChars(0, ' ');
153 tok.whitespaceChars(128, 255);
154 //tok.parseNumbers();
155
156 int i = 0;
157 int inc = size/20;
158 if (inc<1)
159 inc = 1;
160 while (tok.nextToken() != StreamTokenizer.TT_EOF) {
161 if (tok.ttype==StreamTokenizer.TT_WORD) {
162 if (i==0)
163 firstTok = tok.sval;
164 pixels[i++] = (float)Tools.parseDouble(tok.sval, Double.NaN);
165 if (i==size)
166 break;
167 if (i%inc==0)
168 IJ.showProgress(0.5+((double)i/size)/2.0);
169 }
170 }
171 IJ.showProgress(1.0);
172 }
173
174}

Callers 1

openMethod · 0.95

Calls 3

parseDoubleMethod · 0.95
showProgressMethod · 0.95
nextTokenMethod · 0.45

Tested by

no test coverage detected