Exemplo n.º 1
0
FeatureVectorListPtr  FeatureFileIO::LoadFile (const KKStr&      _fileName,
                                               FileDescConstPtr  _fileDesc,
                                               MLClassList&      _classes, 
                                               istream&          _in,
                                               OptionUInt32      _maxCount,    // Maximum # images to load.
                                               VolConstBool&     _cancelFlag,
                                               bool&             _changesMade,
                                               KKStr&            _errorMessage,
                                               RunLog&           _log
                                              )
{
  _errorMessage = "Driver '" + DriverName () + "' does not implemenet  'LoadFile'  method.";
  _log.Level (10) << endl
      << "FeatureFileIO::LoadFile   ***ERROR***   " << _errorMessage << endl
      << "    _fileName   : " << _fileName << endl
      << "    _fileDesc   : " << _fileDesc->NumOfFields () << endl
      << "    _classes    : " << _classes.ToCommaDelimitedStr () << endl
      << "    _in.flags   : " << _in.flags () << endl
      << "    _maxCount   : " << _maxCount << endl
      << "    _cancelFlag : " << _cancelFlag << endl
      << "    _changesMade: " << _changesMade << endl
      << endl;

  _errorMessage = "ROBERTS read functionality not implemented.";
  return NULL;
}
FeatureNumList::FeatureNumList (FileDescConstPtr  _fileDesc):
  featureNums              (NULL),
  featureNumsAllocatedSize (0),
  maxFeatureNum            (0),
  numOfFeatures            (0)
{
  if  (_fileDesc)
    maxFeatureNum = (IntType)(_fileDesc->NumOfFields () - 1);
  AllocateArraySize ((IntType)10);
}
/**
 *@details  A static method that will return a instance of 'FeatureNumList' that will have all non 'Ignore' features 
 * in '_fileDesc' selected.
 */
FeatureNumList   FeatureNumList::AllFeatures (FileDescConstPtr  _fileDesc)
{
  IntType  maxFeatureNum = (IntType)(_fileDesc->NumOfFields () - 1);
  FeatureNumList  features (maxFeatureNum);

  const AttributeTypeVector&   attributeTypes = _fileDesc->AttributeVector ();
  for  (IntType fn = 0;  fn <= maxFeatureNum;  ++fn)
  {
    if  (attributeTypes[fn] != AttributeType::Ignore)
      features.AddFeature (fn);
  }

  return  features;
}  /* AllFeatures */
KKStr   FeatureNumList::ToHexString (FileDescConstPtr  fileDesc)  const
{
  BitString  bs (fileDesc->NumOfFields ());
  ToBitString (bs);
  return  bs.HexStr ();
}  /* ToHexString */
bool  FeatureNumList::AllFeaturesSelected (FileDescConstPtr  fileDesc)  const
{
  if  (numOfFeatures >= (kkint32)fileDesc->NumOfFields ())
    return true;
  return false;
}  /* AllFeaturesSelected */