3 import java.awt.image.*;
16 public void run(String args) {
17 StringTokenizer st =
new StringTokenizer(args,
", \t");
18 int nTokens = st.countTokens();
20 IJ.
write(
"RawReader expects at least 6 arguments: " + args);
23 FileInfo fi =
new FileInfo();
24 fi.fileFormat = fi.RAW;
26 fi.fileName = st.nextToken();
27 fi.width = getNextArg(st);
28 fi.height = getNextArg(st);
29 fi.nImages = getNextArg(st);
30 fi.fileType = (getNextArg(st)==8)?FileInfo.GRAY8:FileInfo.GRAY16_UNSIGNED;
31 fi.offset = getNextArg(st);
32 for (
int i=7; i<=nTokens; i++) {
33 String arg = st.nextToken();
34 if (arg.startsWith(
"white")) fi.whiteIsZero =
true;
35 else if (arg.startsWith(
"black")) fi.whiteIsZero =
false;
36 else if (arg.startsWith(
"little")) fi.intelByteOrder =
true;
37 else if (arg.startsWith(
"big")) fi.intelByteOrder =
false;
39 if (
IJ.debugMode)
IJ.
log(
"RawReader: "+fi);
41 new FileOpener(fi).open();
44 int getNextArg(StringTokenizer st) {
46 try {arg = Integer.parseInt(st.nextToken());}
47 catch (NumberFormatException e) {
IJ.
write(
""+e);}