55 const bool allocate =
true);
57 const bool linear = 0);
62 unsigned int GetSize(
const unsigned int index)
const;
67 T
GetField(
const unsigned int index)
const;
71 const T &
operator [] (
const unsigned int index)
const;
76 void PutField(
const T &value,
const unsigned int index);
87 const unsigned int num_dimensions);
92 const unsigned int num_scales,
93 const unsigned int num_dimensions);
95 const unsigned int num_scales,
100 unsigned int &subband_scale);
109 const unsigned int max_num_scales)
const;
118 virtual void PrintSelf(
const int tabbing)
const;
144 this->
Field = std::vector<T>();
162 return(!this->
Field.empty());
191 std::copy(field.
Field.begin(),
193 this->
Field.begin());
210 unsigned int total_size = size.
Product();
217 this->
Field.insert(this->
Field.begin(), total_size, value);
227 if (this->
Size == size)
231 old_field.
Copy(*
this);
236 std::copy(old_field.
Field.begin(),
237 old_field.
Field.begin() +
238 std::min(this->
Field.size(), old_field.
Field.size()),
239 this->
Field.begin());
249 if (address[dimension] >= old_field.
Size[dimension])
252 (*this)[address] = old_field[address];
301 return(this->
Field.size());
308 return(this->
Field[index]);
315 unsigned int dimension;
319 for (dimension = this->
NumDimensions - 1; dimension >= 1; dimension--)
320 index = (index + address.
Get(dimension)) * this->
Size.
Get(dimension - 1);
321 index += address.
Get(0);
323 return(this->
Field[index]);
330 return(this->
Field[index]);
337 return(this->
Field[index]);
344 unsigned int dimension;
348 for (dimension = this->
NumDimensions - 1; dimension >= 1; dimension--)
349 index = (index + address.
Get(dimension)) * this->
Size.
Get(dimension - 1);
350 index += address.
Get(0);
352 return(this->
Field[index]);
359 unsigned int dimension;
363 for (dimension = this->
NumDimensions - 1; dimension >= 1; dimension--)
364 index = (index + address.
Get(dimension)) * this->
Size.
Get(dimension - 1);
365 index += address.
Get(0);
367 return(this->
Field[index]);
374 std::fill(this->
Field.begin(),
383 this->
Field[index] = value;
390 unsigned int dimension;
396 index = (index + address.
Get(dimension)) * this->
Size.
Get(dimension - 1);
397 index += address.
Get(0);
399 this->
Field[index] = value;
409 std::fill(this->
Field.begin(),
420 if (this->GetFieldMean(mean))
427 this->
Field[index] = this->
Field[index] - mean;
445 this->
Field[index] = this->
Field[index] + mean;
457 double distortion = 0.0;
470 for (index = 0; index < size; index++)
472 difference = this->
Field[index] - field.
Field[index];
473 distortion += difference * difference;
484 const unsigned int num_dimensions)
486 int subband_constant;
488 if (num_dimensions == 0)
491 subband_constant = (1 << num_dimensions) - 1;
493 return(num_scales * subband_constant + 1);
503 int subband_constant;
505 if (num_dimensions == 0)
508 if (num_subbands == 0)
511 subband_constant = (1 << num_dimensions) - 1;
513 if ((num_subbands - 1) % subband_constant)
516 return((num_subbands - 1) / subband_constant);
522 const unsigned int num_scales,
526 int subband_constant;
528 if (num_dimensions == 0)
531 subband_constant = (1 << num_dimensions) - 1;
539 return(num_scales - (subband - 1)/subband_constant);
545 const unsigned int num_scales,
550 unsigned int &subband_scale)
552 unsigned int dimension;
553 unsigned int subband_constant;
554 unsigned int subband_code;
559 subband_size = baseband_size;
560 subband_offset = baseband_size;
562 if (num_dimensions == 0)
565 subband_constant = (1 << num_dimensions) - 1;
572 for (dimension = 0; dimension < num_dimensions; dimension++)
573 baseband_size[dimension] =
574 QccWAVWaveletDWTSubbandLength(field_size[dimension],
576 field_origin[dimension],
581 for (dimension = 0; dimension < num_dimensions; dimension++)
583 subband_offset[dimension] = 0;
584 subband_size[dimension] = baseband_size[dimension];
589 subband_code = ((subband - 1) % subband_constant) + 1;
590 for (dimension = 0; dimension < num_dimensions; dimension++)
592 if (subband_code & 1)
594 subband_size[dimension] =
595 QccWAVWaveletDWTSubbandLength(field_size[dimension],
597 field_origin[dimension],
599 subband_offset[dimension] = baseband_size[dimension];
603 subband_size[dimension] =
604 QccWAVWaveletDWTSubbandLength(field_size[dimension],
606 field_origin[dimension],
608 subband_offset[dimension] = 0;
620 unsigned int dimension;
622 for (dimension = 0; dimension < subband_size.
GetNumDimensions(); dimension++)
623 if (subband_size.
Get(dimension) <= 0)
638 unsigned int subband_scale;
656 unsigned int subband;
657 for (index = 0, subband = 0;
675 address = counter + subband_origin;
678 field[index++] = (*this)[address];
680 while (!counter.
Increment(subband_size));
708 const unsigned int max_num_scales)
const 710 unsigned int subband;
716 unsigned int subband_scale;
727 for (index = 0, subband = 0; subband < field.
NumSubbands; subband++)
744 address = counter + subband_origin;
747 field[address] = (*
this)[index++];
749 while (!counter.
Increment(subband_size));
764 unsigned int subband_scale;
765 unsigned int subband;
769 int previous_scale = -1;
771 for (subband = 0, start = 0, length = 0;
792 length = subband_size.
Product();
793 scale_info.
Append(scale + 1, start, length);
796 previous_scale = scale;
799 if (scale != previous_scale)
801 scale_info.
Append(previous_scale, start, length);
804 length = subband_size.
Product();
805 previous_scale = scale;
808 length += subband_size.
Product();
811 scale_info.
Append(scale, start, length);
826 unsigned int subband_scale;
852 if (field.
SetSize(subband_size))
858 unsigned int index = 0;
862 address = counter + subband_origin;
864 field[index++] = (*this)[address];
866 while (!counter.
Increment(subband_size));
878 unsigned int baseband_scale;
913 this->
Copy(baseband);
925 std::ostream_iterator<T> out(std::cout,
" ");
935 if (this->
Field.empty())
936 std::cout <<
"<NULL>" << std::endl;
938 std::copy(this->
Field.begin(),
943 std::cout << std::endl;
unsigned int GetNumScales(void) const
Definition: evField.h:271
void SetNumScales(const unsigned int num_scales)
Definition: evField.h:262
void Increment(const unsigned int dimension)
Definition: evAddress.h:210
void evPrintWithTab(const int tabbing, const char *format,...)
void PutField(const T &value)
Definition: evField.h:372
void Deallocate(void)
Definition: evField.h:142
static unsigned int NumSubbandsToNumScales(const unsigned int num_subbands, const unsigned int num_dimensions)
Definition: evField.h:498
void Print(const int tabbing) const
Definition: evObject.h:43
T & operator[](const unsigned int index)
Definition: evField.h:328
evField< int > evMapField
Definition: evField.h:137
unsigned int NumSubbands
Definition: evField.h:133
evAddress Size
Definition: evField.h:124
virtual int InverseRasterScan(evField< T > &field, const evAddress &field_origin) const
Definition: evField.h:688
static int SubbandInfo(const unsigned int subband, const unsigned int num_scales, const evAddress &field_size, const evAddress &field_origin, evAddress &subband_size, evAddress &subband_origin, unsigned int &subband_scale)
Definition: evField.h:544
virtual int SetSize(const evAddress &size, const bool allocate=true)
Definition: evField.h:203
Definition: evAddress.h:37
int Copy(const evField &field)
Definition: evField.h:174
void ZeroField(void)
Definition: evField.h:404
virtual int GetScaleInfo(evFieldScaleInfo &scale_info, const evAddress &field_origin) const
Definition: evField.h:757
virtual ~evField(void)
Definition: evField.h:41
static unsigned int GetNumSubbands(const unsigned int num_scales, const unsigned int num_dimensions)
Definition: evField.h:483
Definition: evDataObject.h:31
evAddress GetSize(void) const
Definition: evField.h:292
unsigned int NumScales
Definition: evField.h:132
int * Get(void)
Definition: evAddress.h:124
bool IsSameSize(const evField &field) const
Definition: evField.h:167
std::vector< T > Field
Definition: evField.h:125
T GetField(const unsigned int index) const
Definition: evField.h:306
static unsigned int CalcScaleFromSubband(const unsigned int subband, const unsigned int num_scales, const unsigned int num_dimensions)
Definition: evField.h:521
unsigned int NumDimensions
Definition: evField.h:123
virtual int RasterScan(evField< T > &field, const evAddress &field_origin) const
Definition: evField.h:631
evField< unsigned char > evFlagField
Definition: evField.h:138
virtual void PrintSelf(const int tabbing) const
Definition: evField.h:923
unsigned int GetNumDimensions(void) const
Definition: evField.h:278
int AddMean(const T mean)
Definition: evField.h:434
Definition: evFieldScaleInfo.h:37
virtual void Initialize(void)
Definition: evField.h:150
virtual const evString GetClassName(void) const
Definition: evField.h:44
virtual int ExtractSubband(const unsigned int subband, evField< T > &field, const evAddress &field_origin) const
Definition: evField.h:818
evErrorHandler ErrorHandler
int NullSubband(const evAddress &subband_size) const
Definition: evField.h:618
void Append(const unsigned int scale, const unsigned int start, const unsigned int length)
Definition: evFieldScaleInfo.h:149
int SubtractMean(T &mean)
Definition: evField.h:416
#define EVPRINT_NOFORMAT
Definition: evMiscRoutines.h:34
void ErrorMessage(const char *format,...)
int PreserveBaseband(const evAddress &field_origin)
Definition: evField.h:876
unsigned int GetNumDimensions(void) const
Definition: evAddress.h:148
bool IsAllocated(void) const
Definition: evField.h:160
virtual int Resize(const evAddress &size, const bool linear=0)
Definition: evField.h:224
int Product(void) const
Definition: evAddress.h:256
Definition: evString.h:30
evField(void)
Definition: evField.h:37
double DistortionMSE(const evField &field) const
Definition: evField.h:452
unsigned int GetTotalSize(void) const
Definition: evField.h:299