Example #1
0
void  Strip ()
{
  bool  cancelFlag  = false;
  bool  successful  = false;
  bool  changesMade = false;

  RunLog  log;

  FeatureFileIOPtr driver =  FeatureFileIO::FileFormatFromStr ("C45");

  MLClassList  mlClasses;
  FeatureVectorListPtr  data = 
        driver->LoadFeatureFile ("D:\\Pices\\Reports\\FeatureDataFiles\\AllValidatedImages_ForJonathon\\AllValidatedDataNorm.data",
                                 mlClasses,
                                 -1,
                                 cancelFlag,
                                 successful,
                                 changesMade,
                                 log
                               );

  FeatureVectorListPtr  stripped = new FeatureVectorList (data->FileDesc (), false);

  FeatureVectorList::const_iterator  idx;
  for  (idx = data->begin ();  idx != data->end ();  ++idx)
  {
    FeatureVectorPtr  fv = *idx;
    KKStr  fn = fv->ExampleFileName ();
    if  (fn.StartsWith ("SML")  ||  (fn.StartsWith ("SMP")))
    {
    }
    else
    {
      stripped->PushOnBack (fv);
    }
  }


  kkuint32  numExamplesWritten = 90;
  driver->SaveFeatureFile ("D:\\Pices\\Reports\\FeatureDataFiles\\AllValidatedImages_ForJonathon\\AllValidatedData1209.data",
                           data->AllFeatures (), 
                           *stripped, 
                           numExamplesWritten,
                           cancelFlag,
                           successful,
                           log
                          );



}
Example #2
0
void  ScannerFile::ReportTextMsg (const char*  textBuff, 
                                  kkint32      numTextBytes
                                 )
{
  KKStr  s (textBuff, 0, numTextBytes - 1);
  if  (s.StartsWith ("InstrumentDataWord\t", true))
  {
    s.ExtractToken2 ("\t");
    kkint32  idNum = s.ExtractTokenInt ("\t");
    kkuint32 scanLineNum = s.ExtractTokenUint ("\t");
    kkuint32 dataWord = s.ExtractTokenUint ("\t");
    WordFormat32Bits  w (dataWord);
    ReportInstrumentDataWord (idNum, scanLineNum, w);
  }
  else
  {
    /**
     *@todo  Need to add code to do something with the textBuff message.
     */
  }
}  /* ReportTextMsg */
Example #3
0
void  InstrumentDataGPS::ProcessNMEAInfo (const KKStr& _str)
{
  if  (_str.StartsWith ("$GPGLL"))
    ProcessGPGLL (_str);
}  /* ProcessNMEAInfo */
Example #4
0
void  ImportValidatedClassInfo ()
{
  RunLog  log;

  KKStr  srcFileName = "D:\\Users\\kurt\\OneDrive\\Sipper\\FromAndrewToKurt\\Validation\\2014-09-16\\ValidatedImagesList.txt";
  KKStr  classNameFileName = "D:\\Users\\kurt\\OneDrive\\Sipper\\FromAndrewToKurt\\Validation\\2014-09-16\\ClassList.txt";

  map<int, KKStr>  classNameLookup;
  map<int, KKStr>::iterator  idx;
  FILE* cnl = KKB::osFOPEN(classNameFileName.Str (), "r");
  KKStrPtr line = KKB::osReadNextLine (cnl);
  while  (line)
  {
    if  (!line->Empty())
    {
      auto fields = line->Parse("\t");
      if  (fields.size() > 2)
      {
        int classId = fields[0].ToInt32();
        KKStr className = fields[1];
        classNameLookup.insert(pair<int, KKStr>(classId, className));
      }
    }
    delete line;
    line = KKB::osReadNextLine (cnl);
  }


  ifstream i (srcFileName.Str ());
  if  (!i.is_open ())
    return;

  DataBasePtr  dbConn = new DataBase (log);
  if  (!dbConn)
    return;

  char  buff[20480];

  int  count = 0;

  KKStr  s (1024);
  KKStr  imageFileName;
  int    validatedClassId;
  KKStr  validatedClassName;

  KKStr errMsg = "";

  while  (i.getline (buff, sizeof (buff)))
  {
    count++;
    s = buff;
    imageFileName      = s.ExtractQuotedStr (",\n\t\r", false);
    if  (imageFileName.StartsWith("ETP"))
    {
      validatedClassId   = s.ExtractTokenInt  (",\n\t\r");
      //validatedClassName = s.ExtractQuotedStr (",\n\t\r", false);
      idx = classNameLookup.find(validatedClassId);
      if  (idx != classNameLookup.end())
      {
        validatedClassName = idx->second;

        MLClassPtr  c = MLClass::CreateNewMLClass (validatedClassName);

        dbConn->ImagesUpdateValidatedClass (imageFileName, c);
   
        if  (!dbConn->Valid ())
          errMsg = dbConn->LastErrorDesc ();

        cout << count << "\t" << imageFileName << "\t" << validatedClassName << "\t" << errMsg << endl;
      }
      errMsg = "";
    }
  }
}  /* ImportValidatedClassInfo */