Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ATRMain_quo.java

Go to the documentation of this file.
00001 /*
00002  * ATRMain_quo.java
00003  *
00004  * Copyright (c) 2003 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file ATRMain_quo.java
00014  *
00015  * QuO enabled replacement of the ATR's main class.
00016  */
00017 
00018 import imagerec.corba.*;
00019 
00020 import imagerec.graph.*;
00021 
00022 /**
00023  * A version of the ATRMain class that interacts with QuO.
00024  */
00025 public class ATRMain_quo
00026 {
00027     /** The entry point to the ATR main program.
00028      *
00029      *  @param args Should include parameters for contacting 
00030      *              the CORBA nameservice.
00031      */
00032     public static void main(String args[]) {
00033         /*
00034          * New development of pipelines can be found in {@link Main} 
00035          * (under imagerec.jar).  When pipelines are finished development,
00036          * they will be placed in this file.
00037          */
00038 
00039         if (args.length<4) {
00040             System.out.println("Usage: java -jar ATR.jar");
00041             System.out.println("       <'timer'|'notimer'>");
00042             System.out.println("       <pipeline #>");
00043             System.out.println("       <CORBA name for ATR>");
00044             System.out.println("       <CORBA name for Alert>");
00045             System.out.println("       [CORBA options]");
00046             System.out.println("--or-- ");
00047             System.out.println("       java -jar ATR.jar");
00048             System.out.println("       <'timer'|'notimer'>");
00049             System.out.println("       <pipeline #>");
00050             System.out.println("       <CORBA name for ATR>");
00051             System.out.println("       <CORBA name for Alert>");
00052             System.out.println("       [CORBA options]");
00053             System.out.println("");
00054             System.out.println("For pipelines 1-3, use format #1.");
00055             System.out.println("For pipeline 4, use format #2.");
00056             System.exit(-1);
00057         }
00058         int pipelineNumber = 0;
00059         try {
00060             pipelineNumber = Integer.parseInt(args[1]);
00061         }
00062         catch (NumberFormatException nfe) {
00063             System.out.println("Error: Pipeline argument was not a valid integer.");
00064             System.exit(-1);
00065         }
00066         
00067         if (pipelineNumber <= 0) {
00068             System.out.println("Error: Pipeline # must be > 0 (value was '"+pipelineNumber+")");
00069             System.exit(-1);
00070         }
00071         else {
00072             boolean timer = args[0].equalsIgnoreCase("timer");
00073             Node timer1;
00074             Node timer2;
00075             Node receivingTimer;
00076             Node trackingTimer;
00077             //if timer is requested, then timer1/timer2 are made to be Timer nodes,
00078             //otherwise, they become dummy Nodes, and ImageDatas will just be passed through
00079             //with minimal performance impact
00080             if (timer) {
00081                 timer1 = new Timer(true, false, null);
00082                 timer2 = new Timer(false, true, "Processing", null);
00083                 receivingTimer = new Timer(false, true, "Receiving Frame", null);
00084                 trackingTimer = new Timer(true, false, "Tracking", null);
00085             }
00086             else {
00087                 timer1 = new Node();
00088                 timer2 = new Node();
00089                 receivingTimer = new Node();
00090                 trackingTimer = new Node();
00091             }
00092             Node pipe = null;
00093             Node alert = null;
00094             if ((pipelineNumber == 1)||
00095                 (pipelineNumber == 2)||
00096                 (pipelineNumber == 3)) {
00097                 alert = new Alert(new CORBA_quo(args), args[3]);
00098             }
00099             if (pipelineNumber == 1) {
00100                 Node robCross = new RobertsCross(null);
00101                 Node thresh = new Thresholding(null);
00102                 Label label = new Label(Label.DEFAULT1, null, null);
00103                 label.findOneObject(true);
00104                 Node range = new RangeFind(null);
00105                 pipe = receivingTimer.linkL(timer1.linkL(robCross.linkL(thresh.linkL(label.link(null,
00106                                                                            range.linkL(timer2.linkL(trackingTimer.linkL(alert))))))));
00107                 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00108             }
00109             else if (pipelineNumber == 2) {
00110                 Node labelBlue = new LabelBlue(null, null);
00111                 Node range = new RangeFind(null);
00112                 pipe = receivingTimer.linkL(timer1.linkL(labelBlue.link(null,
00113                                                    range.linkL(timer2.linkL(trackingTimer.linkL(alert))))));
00114                 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00115             }
00116             else if (pipelineNumber == 3) {
00117                 Node cleanCache = new Cache(1, null, null);
00118                 Node n = new Node();
00119                 LabelBlue labelBlue = new LabelBlue(null, null);
00120                 labelBlue.calibrateAndProcessSeparately(true);
00121                 Node calibCmd = new Command(Command.CALIBRATION_IMAGE, null);
00122                 Node noneCmd = new Command(Command.NONE, null);
00123                 Node copy = new Copy(null);
00124                 Node robCross = new RobertsCross(null);
00125                 Node thresh = new Thresholding(null);
00126                 Node hyst = new Hysteresis(null);
00127                 Node label = new Label(null, null);
00128                 Node labelSmCache = new Cache(1, null, null);
00129                 Node getCropCmd = new Command(Command.GET_CROPPED_IMAGE, null);
00130                 Node thin = new Thinning(Thinning.BLUE, null);
00131                 Node range = new RangeFind(null);
00132                 Node getLabelSmCmd = new Command(Command.GET_IMAGE, null);
00133                 pipe = 
00134                 receivingTimer.linkL(timer1.linkL(cleanCache.link(n.link(calibCmd.linkL(labelBlue),
00135                                                     noneCmd.linkL(copy.linkL(robCross.link(null,
00136                                                                                            thresh.link(null,
00137                                                                                                        hyst.link(null,
00138                                                                                                                  label.link(null,
00139                                                                                                                             labelSmCache.link(getCropCmd.linkL(cleanCache),
00140                                                                                                                                               thin.link(null,
00141                                                                                                                                                         range.linkL(timer2.linkL(trackingTimer.linkL(alert)))))))))))),
00142                                             
00143                                              labelBlue.link(null,
00144                                                             getLabelSmCmd.linkL(labelSmCache)))));
00145     
00146                 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00147             }
00148             else if (pipelineNumber == 4) {
00149                 Node cleanCache = new Cache(1, null, null);
00150                 Node n = new Node();
00151                 LabelBlue labelBlue = new LabelBlue(null, null);
00152                 labelBlue.calibrateAndProcessSeparately(true);
00153                 Node calibCmd = new Command(Command.CALIBRATION_IMAGE, null);
00154                 Node noneCmd = new Command(Command.NONE, null);
00155                 Node copy = new Copy(null);
00156                 Node robCross = new RobertsCross(null);
00157                 Node thresh = new Thresholding(null);
00158                 Node hyst = new Hysteresis(null);
00159                 Node label = new Label(null, null);
00160                 Node labelSmCache = new Cache(1, null, null);
00161                 Node getCropCmd = new Command(Command.GET_CROPPED_IMAGE, null);
00162                 Node thin = new Thinning(Thinning.BLUE, null);
00163                 Node range = new RangeFind(null);
00164                 Node getLabelSmCmd = new Command(Command.GET_IMAGE, null);
00165                 pipe = 
00166                 receivingTimer.linkL(timer1.linkL(cleanCache.link(n.link(calibCmd.linkL(labelBlue),
00167                                                     noneCmd.linkL(copy.linkL(robCross.link(null,
00168                                                                                            thresh.link(null,
00169                                                                                                        hyst.link(null,
00170                                                                                                                  label.link(null,
00171                                                                                                                             labelSmCache.link(getCropCmd.linkL(cleanCache),
00172                                                                                                                                               thin.link(null,
00173                                                                                                                                                         range.linkL(timer2.linkL(trackingTimer.linkL(alert)))))))))))),
00174                                             
00175                                              labelBlue.link(null,
00176                                                             getLabelSmCmd.linkL(labelSmCache)))));
00177     
00178             } else {
00179                 System.out.println("Error: Pipeline #"+pipelineNumber+" not implemented yet.");
00180                 System.exit(-1);
00181             }
00182             (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00183         }//else [if(pipelineNumber <= 0)]
00184     }//public static void main()
00185 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1