10 #ifndef BRAINRAT_DATA_MEASUREVECTOR_H 11 #define BRAINRAT_DATA_MEASUREVECTOR_H 17 #include <aims/def/assert.h> 18 #include <cartobase/object/object.h> 19 #include <cartobase/object/property.h> 20 #include <cartobase/smart/rcptr.h> 51 const_iterator
begin()
const;
53 const_iterator
end()
const;
64 const size_type
size()
const;
96 for (int32_t i = 0; i < this->
size(); i++)
98 (&*_data)[i] = values[i];
103 template <
typename T>
107 _size = other.
size();
108 _data =
new T[other.
size()];
112 for(it1 = other.
begin(), it2 =
begin(); it1 < e; it1++, it2++ ) {
135 return (&*_data) +
size();
142 return (&*_data) +
size();
164 for (int32_t i = 0; i <
size(); i++)
165 (*
this)[i] = other[i];
173 for (int32_t i = 0; i <
size(); i++)
183 for (int32_t i = 0; i <
size(); i++)
184 (*
this)[i] += other[i];
193 for (int32_t i = 0; i <
size(); i++)
194 (*
this)[i] -= other[i];
202 for (int32_t i = 0; i <
size(); i++)
212 for (int32_t i = 0; i <
size(); i++)
223 for (int32_t i = 0; i <
size(); i++) {
224 result += (aa[i] - (*this)[i]) * (aa[i] - (*
this)[i]);
227 return( sqrt( result ) );
278 std::ostream& operator << (std::ostream &out, const bio::BaseMeasureVector<T> &aa) {
280 for (int32_t i = 0; i < aa.size(); i++) {
281 out << carto::toString(aa[i]);
282 if (i < (aa.size() - 1))
292 template<
typename T >
294 void printVector( std::ostream& os,
const std::vector<T> & thing )
296 typename std::vector<T>::const_iterator i, e = thing.end();
298 for(i = thing.begin(); i < e; ++i)
309 inline std::ostream& operator << ( std::ostream& os, const carto::Array<double> & thing )
311 printVector<double>(os, thing);
315 inline std::ostream& operator << ( std::ostream& os, const carto::Array<int> & thing )
317 printVector<int>(os, thing);
const T * const_iterator
basic constant iterator
BaseMeasureVector< T > operator+(const BaseMeasureVector< T > &aa, const BaseMeasureVector< T > &bb)
ptrdiff_t difference_type
difference type
ImageProcessors<AimsRGB, double> p(data, mask, "rgbm", options, ImageProcessorMode::Init); ImageProce...
BaseMeasureVector< T > & operator*=(const T &val)
double distance(const BaseMeasureVector< T > &aa) const
BaseMeasureVector< T > & operator/=(const T &val)
const T & const_reference
basic constant reference
BaseMeasureVector< T > operator-(const BaseMeasureVector< T > &aa, const BaseMeasureVector< T > &bb)
BaseMeasureVector< T > & operator-=(const BaseMeasureVector< T > &other)
BaseMeasureVector< T > & operator+=(const BaseMeasureVector< T > &other)
BaseMeasureVector< T > operator*(const BaseMeasureVector< T > &aa, const T &bb)
T & operator[](unsigned x)
BaseMeasureVector(const size_type size, const T *=NULL)
bio::BaseMeasureVector< double > MeasureVector
size_t size_type
size of the basic type
void printVector(std::ostream &os, const std::vector< T > &thing)
BaseMeasureVector< T > & operator=(const BaseMeasureVector< T > &other)
T & reference
basic reference
const size_type size() const
BaseMeasureVector< T > operator/(const BaseMeasureVector< T > &aa, const T &bb)
T * iterator
basic iterator