Commit in CDMS/src/CDMS/Partridge on MAIN
Cluster/Cluster.java+3-31.1 -> 1.2
       /SeededNNClustering.java+7-91.2 -> 1.3
ImageAlignment/AlignImagesTest.java+25-171.1 -> 1.2
ImageComparison/CompareImages.java+2-21.3 -> 1.4
+37-31
4 modified files
Latest versions

CDMS/src/CDMS/Partridge/Cluster
Cluster.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- Cluster.java	11 Oct 2010 00:25:43 -0000	1.1
+++ Cluster.java	15 Oct 2010 21:34:46 -0000	1.2
@@ -52,9 +52,9 @@
     }
 
     /**
-     * Return a map linking the pixels in the cluster to their deviations.
+     * Return a map linking the pixels in the cluster to the pixel data.
      *
-     * @return map of pixels to deviations
+     * @return map of pixels to pixel data
      */
     public Map<Long, Integer> getPixelMap() {
         return _pixmap;
@@ -70,7 +70,7 @@
     }
 
     /**
-     * Return the center of gravity for the cluster.
+     * Return the unweigthed center of gravity for the cluster.
      *
      * @return center of gravity coordinates (0 = x, 1 = y)
      */

CDMS/src/CDMS/Partridge/Cluster
SeededNNClustering.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SeededNNClustering.java	11 Oct 2010 00:34:01 -0000	1.2
+++ SeededNNClustering.java	15 Oct 2010 21:34:46 -0000	1.3
@@ -14,7 +14,9 @@
 
 /**
  * This class uses a nearest neighbor algorithm to find clusters of pixels
- * that are different between two images.
+ * that are different between two images.  A map that specifies a deviation
+ * for each pixel to be clustered is used to quantify the difference between
+ * the two images.
  *
  * The algorithm first finds possible cluster seeds that are above the seed
  * threshold.  Starting from a seed, the neighbor pixels are searched
@@ -101,7 +103,7 @@
      * @param pixmap map containing deviations for pixels selected for clustering
      * @return list of clusters, with a cluster being a list of pixels
      */
-    public List<Cluster> findClusters(PixelArray pixarray, Map<Long, Integer> pixmap) {
+    public List<Cluster> findClusters(PixelArray pixarray, Map<Long, Double> pixmap) {
 
         //  Check that the seed threshold is at least as large as  the neighbor threshold
         if (_seed_threshold < _neighbor_threshold)
@@ -115,14 +117,10 @@
         List<Long> cluster_seeds = new ArrayList<Long>();
 
         //  Loop over the input pixels and mark pixels available for clustering and find cluster seeds
-        for (Entry<Long, Integer> entry : pixmap.entrySet()) {
+        for (Entry<Long, Double> entry : pixmap.entrySet()) {
 
-            Long pixel = entry.getKey();
-            int RGB = Math.abs(entry.getValue());
-            int red = RGB & 0xff0000 >> 16;
-            int green = RGB & 0xff00 >> 8;
-            int blue = RGB & 0xff;
-            double deviation = Math.sqrt(red*red + green*green + blue*blue);
+            long pixel = entry.getKey();
+            double deviation = entry.getValue();
 
             //  Mark this hit as available for clustering if it is above the neighbor threshold
             clusterable.put(pixel, deviation >= _neighbor_threshold);

CDMS/src/CDMS/Partridge/ImageAlignment
AlignImagesTest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- AlignImagesTest.java	11 Oct 2010 00:25:44 -0000	1.1
+++ AlignImagesTest.java	15 Oct 2010 21:34:46 -0000	1.2
@@ -34,10 +34,10 @@
 
         ParseAutorunFile parser = new ParseAutorunFile(autorunfile);
         List<Double[]> coordinatelist = parser.getImageCoordinates();
-//        int ifirst = 1000;
-//        int ilast = 1100;
-        int ifirst = 1;
-        int ilast = 8585;
+        int ifirst = 1000;
+        int ilast = 1200;
+//        int ifirst = 1;
+//        int ilast = 8585;
         double rmax = 35.;
 
         int nrow = 480;
@@ -45,25 +45,31 @@
         double dx = 0.0001396;
         double dy = dx;
 
-        for (int i = ifirst ; i <= ilast; i++) {
+        for (String refname : flat.getBlankFileNames()) {
+//        for (int i = ifirst ; i <= ilast; i++) {
 
-            if (i % 100 == 0) System.out.println("Processing image "+i);
+//            if (i % 100 == 0) System.out.println("Processing image "+i);
             
-            Double[] pos = coordinatelist.get(i-1);
-            double xc = pos[0];
-            double yc = pos[1];
+//            Double[] pos = coordinatelist.get(i-1);
+//            double xc = pos[0];
+//            double yc = pos[1];
 //            System.out.println("Image: "+i+" xc: "+xc+" yc: "+yc);
-            double r = Math.sqrt(xc*xc + yc*yc);
-            if (r > rmax) continue;
-            
-            String refname = refbase+i+".png";
-            String testname = testbase + i +".png";
+//            double r = Math.sqrt(xc*xc + yc*yc);
+//            if (r > rmax) continue;
+
+            double xc = 0.;
+            double yc = 0.;
+            String testname = refname.replaceAll("G47_Side1_PKG", "G16K_Side1");
+//            String refname = refbase+i+".png";
+//            String testname = testbase + i +".png";
             GeImage refimage = new GeImage(refname, xc, yc, dx, dy);
             GeImage testimage = new GeImage(testname, xc, yc, dx, dy);
 
             List<FeatureDef> fdefs = new ArrayList<FeatureDef>();
             FeatureDef fdblack = new FeatureDef("Black", 0, 130, 10);
-            fdefs.add(fdblack);
+            FeatureDef fdall = new FeatureDef("All", 0, 256, 1);
+//            fdefs.add(fdblack);
+            fdefs.add(fdall);
 
             AlignImages align = new AlignImages(fdefs);
             align.setBorder(10);
@@ -74,13 +80,15 @@
             if (pars.getFitStatus() == FitStatus.MinuitFit) minstat = "Minuit Fit";
             if (pars.getFitStatus() == FitStatus.StepFit) minstat = "Step Fit";
 
+            System.out.println("xoffset: "+pars.getXOffset()+" yoffset: "+pars.getYOffset());
+            
             aida.cloud1D("Vertical offset - "+minstat).fill(pars.getYOffset());
             aida.cloud1D("Horizontal offset - "+minstat).fill(pars.getXOffset());
             aida.cloud1D("Chisq - "+minstat).fill(pars.getChisq());
-            aida.cloud2D("Horizontal offset vs vertical offset - "+minstat).fill(pars.getXOffset(), pars.getYOffset());
+            aida.cloud2D("Vertical offset vs horizontal offset - "+minstat).fill(pars.getXOffset(), pars.getYOffset());
             aida.cloud1D("Number of pixels used for fit - "+minstat).fill(((double) pars.getNPixels()));
         }
 
-        aida.saveAs("c:/CDMS/newnudge.aida");
+        aida.saveAs("c:/CDMS/newnudge_allpixels.aida");
     }
 }

CDMS/src/CDMS/Partridge/ImageComparison
CompareImages.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- CompareImages.java	11 Oct 2010 00:25:43 -0000	1.3
+++ CompareImages.java	15 Oct 2010 21:34:46 -0000	1.4
@@ -132,9 +132,9 @@
         SeededNNClustering clusterer = new SeededNNClustering();
         clusterer.setNeighborThreshold(_neighbor_threshold);
         clusterer.setSeedThreshold(_seed_threshold);
-//        List<Cluster> clusters = clusterer.findClusters(mother, devmap);
+        List<Cluster> clusters = clusterer.findClusters(mother, devmap);
 
-//        return clusters;
+        return clusters;
         return null;
     }
 
CVSspam 0.2.8