CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.1 -r1.2
--- ImageMapperII.java 24 Feb 2011 06:03:18 -0000 1.1
+++ ImageMapperII.java 25 Feb 2011 06:37:36 -0000 1.2
@@ -4,7 +4,9 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Formatter;
+import java.util.List;
import javax.imageio.ImageIO;
@@ -14,6 +16,7 @@
public class ImageMapperII {
private static final int INTERESTING_CUT = 1;
+ private static final boolean LEVELLING_ON = true;
private static final double pixWidth = 45.0;
private static final double pixHeight = 33.0;
@@ -125,14 +128,7 @@
for(int j =0; j < nPixHeight; j++){
if(flag[i][j]){
double[] converted = convertCoords(pixWidth*i, pixHeight*j);
-
- Formatter fmt1 = new Formatter();
- Formatter fmt2 = new Formatter();
- fmt1.format("%.6f", converted[0]);
- fmt2.format("%.6f", converted[1]);
-
- if(debug==0) output.write("c:\\Partrtn\\IZipOriginTakePicture_x2_5.RTN,"+fmt1+","+fmt2+",0,0,0,0\n");
- else if(debug==1) output.write(fmt1+","+fmt2+"\n");
+ writeCoord(converted);
// with >13k lines, buffer gets filled; take small performance hit and flush every time
output.flush();
@@ -140,10 +136,45 @@
}// end for j
}// end for i
+ // add the few field levelling images that we want (if we actually want levelling included)
+ if(LEVELLING_ON){
+ List<double[]> fl = getFieldLevellingImages();
+ for(int k = 0; k < fl.size(); k++)
+ writeCoord(fl.get(k));
+ }
+
if(debug==0) output.write("END_RUN\n");
output.close();
}
+ private void writeCoord(double[] coord) throws IOException{
+ //format and print the given coordinate, based on debug status
+ Formatter fmt1 = new Formatter();
+ Formatter fmt2 = new Formatter();
+ fmt1.format("%.6f", coord[0]);
+ fmt2.format("%.6f", coord[1]);
+
+ if(debug==0) output.write("c:\\Partrtn\\IZipOriginTakePicture_x2_5.RTN,"+fmt1+","+fmt2+",0,0,0,0\n");
+ else if(debug==1) output.write(fmt1+","+fmt2+"\n");
+ }
+
+ private List<double[]> getFieldLevellingImages(){
+ List<double[]> out = new ArrayList<double[]>();
+ // this list is good only for iZIP4 geometry: modify for others
+
+ double[] o1 = {15.0, 3.5};
+ double[] o2 = {-18.5, 3.5};
+ double[] o3 = {6.0, -18.0};
+
+ out.add(o1);
+ out.add(o2);
+ out.add(o3);
+
+ if(debug==1) System.out.println("Adding field levelling!");
+
+ return out;
+ }
+
private double[] convertCoords(double xc, double yc){
double halfOffsetX = pixWidth/2;
CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.1 -r1.2
--- ImageMapperIIRun.java 24 Feb 2011 06:03:18 -0000 1.1
+++ ImageMapperIIRun.java 25 Feb 2011 06:37:36 -0000 1.2
@@ -11,7 +11,7 @@
try {
ImageMapperII mapper = new ImageMapperII("/Users/maxinion/Documents/Work/CDMS/imagingII/qets2-hires.jpg",
- "/Users/maxinion/Documents/Work/CDMS/imagingII/out2-23/qets2-out.txt",0);
+ "/Users/maxinion/Documents/Work/CDMS/imagingII/out2-24/qets2-out.csv",1);
mapper.doAll();
} catch (IOException e) {
e.printStackTrace();