isis/src/control/apps/cnetstats/cnetstats.cpp
void cnetstats(ControlNet &innet, QString &serialNumFile, UserInterface &ui, Pvl *log) {
    try {
      // Get the DefFile
      QString sDefFile = "";
      QString sOutFile = "";
      Pvl pvlDefFile;
      if (ui.WasEntered("DEFFILE")) {
        sDefFile = ui.GetFileName("DEFFILE");
        sOutFile = ui.GetFileName("FLATFILE");
        pvlDefFile = Pvl(sDefFile);

        // Log the DefFile - Cannot log Object... only by Group
        for (int i=0; i<pvlDefFile.objects(); i++) {
          PvlObject pvlObj = pvlDefFile.object(i);
          for (int j=0; j<pvlObj.groups(); j++) {
            log->addGroup(pvlObj.group(j));
          }
        }

        // Verify DefFile comparing with the Template
        Pvl pvlTemplate("$ISISROOT/appdata/templates/cnetstats/cnetstats.def");
        Pvl pvlResults;
        pvlTemplate.validatePvl(pvlDefFile, pvlResults);
        if(pvlResults.objects() != 0 || pvlResults.groups() != 0 || pvlResults.keywords() != 0){
          for (int i=0; i<pvlResults.objects(); i++) {
            PvlObject pvlObj = pvlResults.object(i);
            for (int j=0; j<pvlObj.groups(); j++) {
              log->addGroup(pvlObj.group(j));
            }
          }
          QString sErrMsg = "Invalid Deffile\n";
          throw IException(IException::User, sErrMsg, _FILEINFO_);
        }
      }

      // Get the Image Stats File
      QString sImageFile= "";
      if (ui.WasEntered("CREATE_IMAGE_STATS") && ui.GetBoolean("CREATE_IMAGE_STATS")) {
        sImageFile = ui.GetFileName("IMAGE_STATS_FILE");
      }

      // Get the Point Stats File
      QString sPointFile="";
      if (ui.WasEntered("CREATE_POINT_STATS") && ui.GetBoolean("CREATE_POINT_STATS")) {
        sPointFile = ui.GetFileName("POINT_STATS_FILE");
      }

       // Get the original control net internalized
      Progress progress;
      // ControlNet cNet(ui.GetFileName("CNET"), &progress);

      Progress statsProgress;
      ControlNetFilter cNetFilter(&innet, serialNumFile, &statsProgress);

      // Log the summary of the input Control Network
      PvlGroup statsGrp;
      cNetFilter.GenerateControlNetStats(statsGrp);
      log->addGroup(statsGrp);

      // Run Filters using Deffile
      if (ui.WasEntered("DEFFILE")) {
        cNetFilter.SetOutputFile(sOutFile);
        ReadDefFile(cNetFilter, pvlDefFile);
      }

      // Run Image Stats
      if (ui.WasEntered("CREATE_IMAGE_STATS") && ui.GetBoolean("CREATE_IMAGE_STATS")) {
        cNetFilter.GenerateImageStats();
        cNetFilter.PrintImageStats(sImageFile);
      }

      // Run Point Stats
      if (ui.WasEntered("CREATE_POINT_STATS") && ui.GetBoolean("CREATE_POINT_STATS")) {
        cNetFilter.GeneratePointStats(sPointFile);
      }
    } // REFORMAT THESE ERRORS INTO ISIS TYPES AND RETHROW
    catch(IException &) {
      throw;
    }
  }
/**
    * Given some control network and criteria passed in through the UI, 
    * return some stats on the control network and its images.
    *
    * @param net A control network object.
    *
    * @param serialNumFile A QString of the name of the file containing the serial
    *        numbers for all cubes within the network often generated from
    *        a filelist.
    *
    * @param ui UserInterface object generated using the cnetwinnow.xml file.
    *
    * @param log A pvl object used to store log information.
    *
    */
Given some control network and criteria passed in through the UI,
return some stats on the control network and its images.

@param net A control network object.

@param serialNumFile A QString of the name of the file containing the serial
numbers for all cubes within the network often generated from
a filelist.

@param ui UserInterface object generated using the cnetwinnow.xml file.

@param log A pvl object used to store log information.
Given some control network and criteria passed in through the UI return some stats on the control network and its images . @param net A control network object . @param serialNumFile A QString of the name of the file containing the serial numbers for all cubes within the network often generated from a filelist . @param ui UserInterface object generated using the cnetwinnow . xml file . @param log A pvl object used to store log information .
void cnetstats(ControlNet &innet, QString &serialNumFile, UserInterface &ui, Pvl *log) {
    try {
      QString sDefFile = "";
      QString sOutFile = "";
      Pvl pvlDefFile;
      if (ui.WasEntered("DEFFILE")) {
        sDefFile = ui.GetFileName("DEFFILE");
        sOutFile = ui.GetFileName("FLATFILE");
        pvlDefFile = Pvl(sDefFile);
        for (int i=0; i<pvlDefFile.objects(); i++) {
          PvlObject pvlObj = pvlDefFile.object(i);
          for (int j=0; j<pvlObj.groups(); j++) {
            log->addGroup(pvlObj.group(j));
          }
        }
        Pvl pvlTemplate("$ISISROOT/appdata/templates/cnetstats/cnetstats.def");
        Pvl pvlResults;
        pvlTemplate.validatePvl(pvlDefFile, pvlResults);
        if(pvlResults.objects() != 0 || pvlResults.groups() != 0 || pvlResults.keywords() != 0){
          for (int i=0; i<pvlResults.objects(); i++) {
            PvlObject pvlObj = pvlResults.object(i);
            for (int j=0; j<pvlObj.groups(); j++) {
              log->addGroup(pvlObj.group(j));
            }
          }
          QString sErrMsg = "Invalid Deffile\n";
          throw IException(IException::User, sErrMsg, _FILEINFO_);
        }
      }
      QString sImageFile= "";
      if (ui.WasEntered("CREATE_IMAGE_STATS") && ui.GetBoolean("CREATE_IMAGE_STATS")) {
        sImageFile = ui.GetFileName("IMAGE_STATS_FILE");
      }
      QString sPointFile="";
      if (ui.WasEntered("CREATE_POINT_STATS") && ui.GetBoolean("CREATE_POINT_STATS")) {
        sPointFile = ui.GetFileName("POINT_STATS_FILE");
      }
      Progress progress;
      Progress statsProgress;
      ControlNetFilter cNetFilter(&innet, serialNumFile, &statsProgress);
      PvlGroup statsGrp;
      cNetFilter.GenerateControlNetStats(statsGrp);
      log->addGroup(statsGrp);
      if (ui.WasEntered("DEFFILE")) {
        cNetFilter.SetOutputFile(sOutFile);
        ReadDefFile(cNetFilter, pvlDefFile);
      }
      if (ui.WasEntered("CREATE_IMAGE_STATS") && ui.GetBoolean("CREATE_IMAGE_STATS")) {
        cNetFilter.GenerateImageStats();
        cNetFilter.PrintImageStats(sImageFile);
      }
      if (ui.WasEntered("CREATE_POINT_STATS") && ui.GetBoolean("CREATE_POINT_STATS")) {
        cNetFilter.GeneratePointStats(sPointFile);
      }
    } 
    catch(IException &) {
      throw;
    }
  }
void cnetstats ( ControlNet & innet , QString & serialNumFile , UserInterface & ui , Pvl * log ) { try { QString sDefFile = " " ; QString sOutFile = " " ; Pvl pvlDefFile ; if ( ui . WasEntered ( " " ) ) { sDefFile = ui . GetFileName ( " " ) ; sOutFile = ui . GetFileName ( " " ) ; pvlDefFile = Pvl ( sDefFile ) ; for ( int i = 0 ; i < pvlDefFile . objects ( ) ; i ++ ) { PvlObject pvlObj = pvlDefFile . object ( i ) ; for ( int j = 0 ; j < pvlObj . groups ( ) ; j ++ ) { log -> addGroup ( pvlObj . group ( j ) ) ; } } Pvl pvlTemplate ( " " ) ; Pvl pvlResults ; pvlTemplate . validatePvl ( pvlDefFile , pvlResults ) ; if ( pvlResults . objects ( ) != 0 || pvlResults . groups ( ) != 0 || pvlResults . keywords ( ) != 0 ) { for ( int i = 0 ; i < pvlResults . objects ( ) ; i ++ ) { PvlObject pvlObj = pvlResults . object ( i ) ; for ( int j = 0 ; j < pvlObj . groups ( ) ; j ++ ) { log -> addGroup ( pvlObj . group ( j ) ) ; } } QString sErrMsg = " \n " ; throw IException ( IException :: User , sErrMsg , _FILEINFO_ ) ; } } QString sImageFile = " " ; if ( ui . WasEntered ( " " ) && ui . GetBoolean ( " " ) ) { sImageFile = ui . GetFileName ( " " ) ; } QString sPointFile = " " ; if ( ui . WasEntered ( " " ) && ui . GetBoolean ( " " ) ) { sPointFile = ui . GetFileName ( " " ) ; } Progress progress ; Progress statsProgress ; ControlNetFilter cNetFilter ( & innet , serialNumFile , & statsProgress ) ; PvlGroup statsGrp ; cNetFilter . GenerateControlNetStats ( statsGrp ) ; log -> addGroup ( statsGrp ) ; if ( ui . WasEntered ( " " ) ) { cNetFilter . SetOutputFile ( sOutFile ) ; ReadDefFile ( cNetFilter , pvlDefFile ) ; } if ( ui . WasEntered ( " " ) && ui . GetBoolean ( " " ) ) { cNetFilter . GenerateImageStats ( ) ; cNetFilter . PrintImageStats ( sImageFile ) ; } if ( ui . WasEntered ( " " ) && ui . GetBoolean ( " " ) ) { cNetFilter . GeneratePointStats ( sPointFile ) ; } } catch ( IException & ) { throw ; } }
Given some control network and criteria passed in through the UI,
 return some stats on the control network and its images.
Given some control network and criteria passed in through the UI return some stats on the control network and its images .
// Get the DefFile // Log the DefFile - Cannot log Object... only by Group // Verify DefFile comparing with the Template // Get the Image Stats File // Get the Point Stats File // Get the original control net internalized // ControlNet cNet(ui.GetFileName("CNET"), &progress); // Log the summary of the input Control Network // Run Filters using Deffile // Run Image Stats // Run Point Stats // REFORMAT THESE ERRORS INTO ISIS TYPES AND RETHROW