Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::SampleUtils Class Reference

#include <SampleUtils.h>

List of all members.


Detailed Description

The class SampleUtils includes fuction for handling and making sample sets.


Static Public Methods

template<class T, class I, class C> void readFromFile (std::string file, util::List< Sample< T, I, C > > &sampleList) throw (io::IOException&)
 Reads a sample list form a file.

template<class T, class I, class C> void writeToFile (std::string file, const util::List< Sample< T, I, C > > &sampleList) throw (io::IOException&)
 Write a sample list to a file.

template<class T, class I, class C> void combineSets (util::List< Sample< util::List< T >, I, C > > &combinedSet, const util::List< util::List< Sample< T, I, C > > * > &sets) throw (util::InvalidArgumentException&)
 Combines the set to the one set.

template<class T, class U> util::List< Sample< T, std::string,
int > > 
makeSamples (const util::Matrix< T > &mat, const util::Matrix< U > &mask, const util::List< U > &values, FeatureExtractor< int, util::Matrix< T > > &extractor, int width, int height, std::string matrixName)
 This fuction makes samples from the Matrix mat.

util::List< Sample< int, ImageSampleIdentifier,
int > > 
readIdsSampleSet (std::string sampleSet) throw (util::io::IOException&)
 The fuction reads the Inspection Development System (IDS) TIP_SAMPLE_SET and TIP_DSAMPLE_SET files and converts them to the format this library undestands.

util::List< Sample< int, ImageSampleIdentifier,
int > > 
readIdsSampleSet (std::string sampleSet, util::List< std::string > &classes, util::List< std::string > &features) throw (util::io::IOException&)
 The fuction reads the Inspection Development System (IDS) TIP_SAMPLE_SET and TIP_DSAMPLE_SET files and converts them to the format this library undestands.

template<class T, class I, class C> void prune (util::List< Sample< T, I, C > > &samples, const util::List< int > &enabledFeatures)
 Create a new sample set out of samples by removing all features whose index is not listed in enabledFeatures.

template<class T, class I, class C> int countClasses (const util::List< Sample< T, I, C > > &samples)
 Returns the maximum true class index in samples plus one.


Member Function Documentation

template<class T, class I, class C>
void prapi::SampleUtils::combineSets util::List< Sample< util::List< T >, I, C > > &    combinedSet,
const util::List< util::List< Sample< T, I, C > > * > &    sets
throw (util::InvalidArgumentException&) [static]
 

Combines the set to the one set.

Parameters:
combinedSet  The set which includes all featureVectors.
sets  The List of sample sets which are wanted to combine.

template<class T, class U>
util::List< Sample< T, std::string, int > > prapi::SampleUtils::makeSamples const util::Matrix< T > &    mat,
const util::Matrix< U > &    mask,
const util::List< U > &    values,
FeatureExtractor< int, util::Matrix< T > > &    extractor,
int    width,
int    height,
std::string    matrixName
[static]
 

This fuction makes samples from the Matrix mat.

In the mask matrix there are every class marked at the specified color/grayscale. The funtion works like this first it takes the the second number from the list values (second therefore that the first place in the list is background) and then finds the same areas from the mask matrix and cuts pieces out from the Matrix mat as many as it can and then it calculates the featureVector with the extractor and the sets it to the new sample and then sets the identifier from the names list to the sample. The class given to the sample will be the same as the index in the values list.

Note: If values contain value -1 it means that the class will be skipped (samples which are in that area wont be made at all.

Parameters:
mat  The original matrix.
mask  The matrix which includes the painted classes.
values  Contain the information of color/crayscale values.
extractor  The FeatureExtractor which calculates the featureVectors.
width  The width of sample "matrix".
height  The height of sample "matrix".
matrixName  The name of matrix (will be placed for every sample).

template<class T, class I, class C>
void prapi::SampleUtils::prune util::List< Sample< T, I, C > > &    samples,
const util::List< int > &    enabledFeatures
[static]
 

Create a new sample set out of samples by removing all features whose index is not listed in enabledFeatures.

Parameters:
samples  the sample set to be modified
enabledFeatures  the indices of the enabled features. Make sure these indices are smaller than the number of features in each sample.
Returns:
a pruned sample set with disabled features removed

List< Sample< int, ImageSampleIdentifier, int > > prapi::SampleUtils::readIdsSampleSet std::string    sampleSet,
util::List< std::string > &    classes,
util::List< std::string > &    features
throw (util::io::IOException&) [static]
 

The fuction reads the Inspection Development System (IDS) TIP_SAMPLE_SET and TIP_DSAMPLE_SET files and converts them to the format this library undestands.

Parameters:
sampleSet  The IDS sampleSet file.
classes  The name of classes.
features  The name of features.

util::List<Sample<int,ImageSampleIdentifier,int> > prapi::SampleUtils::readIdsSampleSet std::string    sampleSet throw (util::io::IOException&) [inline, static]
 

The fuction reads the Inspection Development System (IDS) TIP_SAMPLE_SET and TIP_DSAMPLE_SET files and converts them to the format this library undestands.

Parameters:
sampleSet  The IDS sampleSet file.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.