SMIL  0.9.1
DMeasures.hpp
1 /*
2  * Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Matthieu FAESSEL, or ARMINES nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 
30 #ifndef _D_MEASURES_HPP
31 #define _D_MEASURES_HPP
32 
33 #include "Core/include/private/DImage.hpp"
34 #include "DBaseMeasureOperations.hpp"
35 #include "DImageArith.hpp"
36 #include "Base/include/DImageDraw.h"
37 
38 #include <map>
39 #include <set>
40 #include <iostream>
41 #include <iterator> // std::back_inserter
42 
43 namespace smil
44 {
45 
52  template <class T>
53  struct measAreaFunc : public MeasureFunctionBase<T, double>
54  {
55  typedef typename Image<T>::lineType lineType;
56 
57  virtual void processSequence(lineType /*lineIn*/, size_t size)
58  {
59  this->retVal += size;
60  }
61  };
62 
69  template <class T>
70  size_t area(const Image<T> &imIn)
71  {
72  measAreaFunc<T> func;
73  return static_cast<size_t>(func(imIn, true));
74  }
75 
76 
77  template <class T>
78  struct measVolFunc : public MeasureFunctionBase<T, double>
79  {
80  typedef typename Image<T>::lineType lineType;
81 
82  virtual void processSequence(lineType lineIn, size_t size)
83  {
84  for (size_t i=0;i<size;i++)
85  this->retVal += double(lineIn[i]);
86  }
87  };
88 
95  template <class T>
96  double vol(const Image<T> &imIn)
97  {
98  measVolFunc<T> func;
99  return func(imIn, false);
100  }
101 
102  template <class T>
103  struct measMeanValFunc : public MeasureFunctionBase<T, Vector_double>
104  {
105  typedef typename Image<T>::lineType lineType;
106  double sum1, sum2;
107  double pixNbr;
108 
109  virtual void initialize(const Image<T> &/*imIn*/)
110  {
111  this->retVal.clear();
112  sum1 = sum2 = pixNbr = 0.;
113  }
114  virtual void processSequence(lineType lineIn, size_t size)
115  {
116  double curV;
117  for (size_t i=0;i<size;i++)
118  {
119  pixNbr += 1;
120  curV = lineIn[i];
121  sum1 += curV;
122  sum2 += curV*curV;
123  }
124  }
125  virtual void finalize(const Image<T> &/*imIn*/)
126  {
127  double mean_val = pixNbr==0 ? 0 : sum1/pixNbr;
128  double std_dev_val = pixNbr==0 ? 0 : sqrt(sum2/pixNbr - mean_val*mean_val);
129 
130  this->retVal.push_back(mean_val);
131  this->retVal.push_back(std_dev_val);
132  }
133  };
134 
135 
136 
144  template <class T>
145  Vector_double meanVal(const Image<T> &imIn, bool onlyNonZero=false)
146  {
147  measMeanValFunc<T> func;
148  return func(imIn, onlyNonZero);
149  }
150 
151 
152  template <class T>
153  struct measMinValFunc : public MeasureFunctionBase<T, T>
154  {
155  typedef typename Image<T>::lineType lineType;
156  virtual void initialize(const Image<T> &/*imIn*/)
157  {
158  this->retVal = numeric_limits<T>::max();
159  }
160  virtual void processSequence(lineType lineIn, size_t size)
161  {
162  for (size_t i=0;i<size;i++)
163  if (lineIn[i] < this->retVal)
164  this->retVal = lineIn[i];
165  }
166  };
167 
168  template <class T>
170  {
171  typedef typename Image<T>::lineType lineType;
172  Point<UINT> pt;
173  virtual void initialize(const Image<T> &/*imIn*/)
174  {
175  this->retVal = numeric_limits<T>::max();
176  }
177  virtual void processSequence(lineType lineIn, size_t size, size_t x, size_t y, size_t z)
178  {
179  for (size_t i=0;i<size;i++,x++)
180  if (lineIn[i] < this->retVal)
181  {
182  this->retVal = lineIn[i];
183  pt.x = x;
184  pt.y = y;
185  pt.z = z;
186  }
187  }
188  };
189 
197  template <class T>
198  T minVal(const Image<T> &imIn, bool onlyNonZero=false)
199  {
200  measMinValFunc<T> func;
201  return func(imIn, onlyNonZero);
202  }
203 
204  template <class T>
205  T minVal(const Image<T> &imIn, Point<UINT> &pt, bool onlyNonZero=false)
206  {
208  func(imIn, onlyNonZero);
209  pt = func.pt;
210  return func.retVal;
211  }
212 
213 
214  template <class T>
215  struct measMaxValFunc : public MeasureFunctionBase<T, T>
216  {
217  typedef typename Image<T>::lineType lineType;
218  virtual void initialize(const Image<T> &/*imIn*/)
219  {
220  this->retVal = numeric_limits<T>::min();
221  }
222  virtual void processSequence(lineType lineIn, size_t size)
223  {
224  for (size_t i=0;i<size;i++)
225  if (lineIn[i] > this->retVal)
226  this->retVal = lineIn[i];
227  }
228  };
229 
230  template <class T>
232  {
233  typedef typename Image<T>::lineType lineType;
234  Point<UINT> pt;
235  virtual void initialize(const Image<T> &/*imIn*/)
236  {
237  this->retVal = numeric_limits<T>::min();
238  }
239  virtual void processSequence(lineType lineIn, size_t size, size_t x, size_t y, size_t z)
240  {
241  for (size_t i=0;i<size;i++,x++)
242  if (lineIn[i] > this->retVal)
243  {
244  this->retVal = lineIn[i];
245  pt.x = x;
246  pt.y = y;
247  pt.z = z;
248  }
249  }
250  };
251 
259  template <class T>
260  T maxVal(const Image<T> &imIn, bool onlyNonZero=false)
261  {
262  measMaxValFunc<T> func;
263  return func(imIn, onlyNonZero);
264  }
265 
266  template <class T>
267  T maxVal(const Image<T> &imIn, Point<UINT> &pt, bool onlyNonZero=false)
268  {
270  func(imIn, onlyNonZero);
271  pt = func.pt;
272  return func.retVal;
273  }
274 
275 
276  template <class T>
277  struct measMinMaxValFunc : public MeasureFunctionBase<T, vector<T> >
278  {
279  typedef typename Image<T>::lineType lineType;
280  T minVal, maxVal;
281  virtual void initialize(const Image<T> &/*imIn*/)
282  {
283  this->retVal.clear();
284  maxVal = numeric_limits<T>::min();
285  minVal = numeric_limits<T>::max();
286  }
287  virtual void processSequence(lineType lineIn, size_t size)
288  {
289  for (size_t i=0;i<size;i++)
290  {
291  T val = lineIn[i];
292  if (val > maxVal)
293  maxVal = val;
294  if (val < minVal)
295  minVal = val;
296  }
297  }
298  virtual void finalize(const Image<T> &/*imIn*/)
299  {
300  this->retVal.push_back(minVal);
301  this->retVal.push_back(maxVal);
302  }
303  };
304 
312  template <class T>
313  vector<T> rangeVal(const Image<T> &imIn, bool onlyNonZero=false)
314  {
316  return func(imIn, onlyNonZero);
317  }
318 
319  template <class T>
320  struct valueListFunc : public MeasureFunctionBase<T, vector<T> >
321  {
322  typedef typename Image<T>::lineType lineType;
323  set<T> valList;
324 
325  virtual void initialize(const Image<T> &/*imIn*/)
326  {
327  this->retVal.clear();
328  valList.clear();
329  }
330 
331  virtual void processSequence(lineType lineIn, size_t size)
332  {
333  for (size_t i=0;i<size;i++)
334  valList.insert(lineIn[i]);
335  }
336  virtual void finalize(const Image<T> &/*imIn*/)
337  {
338  // Copy the content of the set into the ret vector
339  std::copy(valList.begin(), valList.end(), std::back_inserter(this->retVal));
340  }
341  };
342 
348  template <class T>
349  vector<T> valueList(const Image<T> &imIn, bool onlyNonZero=true)
350  {
351  valueListFunc<T> func;
352  return func(imIn, onlyNonZero);
353  }
354  template <class T>
355  struct measModeValFunc : public MeasureFunctionBase<T, T >
356  {
357  typedef typename Image<T>::lineType lineType;
358 
359  map<int,int> nbList;
360  int maxNb;
361  T mode;
362  virtual void initialize(const Image<T> &/*imIn*/)
363  {
364  //BMI this->retVal.clear();
365  nbList.clear();
366  maxNb = 0;
367  mode = 0;
368  }
369 
370  virtual void processSequence(lineType lineIn, size_t size)
371  {
372 
373  for (size_t i=0;i<size;i++)
374  {
375  T val = lineIn[i];
376  if(val>0){
377 
378  if (nbList.find(val)==nbList.end()){
379  nbList.insert(std::pair<int,int>(val,1));
380  }
381  else
382  nbList[val]++;
383  if(nbList[val]>maxNb){
384  mode = val;
385  maxNb = nbList[val];
386  }
387  }// if (val>0)
388  }// for i= 0; i < size
389  this->retVal = mode;
390 
391  }// virtual
392  };// END measModeValFunc
393 
398  template <class T>
399  T measModeVal(const Image<T> &imIn, bool onlyNonZero=true)
400  {
401  measModeValFunc<T> func;
402  return func(imIn, onlyNonZero);
403  }
404  template <class T>
405  struct measMedianValFunc : public MeasureFunctionBase<T, T >
406  {
407  typedef typename Image<T>::lineType lineType;
408 
409  map<int,int> nbList;
410  size_t acc_elem,total_elems;
411  T medianval;
412  virtual void initialize(const Image<T> &/*imIn*/)
413  {
414  //BMI this->retVal.clear();
415  nbList.clear();
416  medianval = 0;
417  acc_elem=0;
418  total_elems=0;
419  }
420 
421  virtual void processSequence(lineType lineIn, size_t size)
422  {
423 
424  for (size_t i=0;i<size;i++){
425  T val = lineIn[i];
426  if(val>0){
427  total_elems ++;
428  if (nbList.find(val)==nbList.end()){
429  nbList.insert(std::pair<int,int>(val,1));
430  }
431  else
432  nbList[val]++;
433 
434  }// if (val>0)
435  }// for i= 0; i < size
436  // this->retVal = medianval;
437  }// virtual processSequence
438  virtual void finalize(const Image<T> &/*imIn*/)
439  {
440  typedef std::map<int, int>::iterator it_type;
441 
442  for(it_type my_iterator = nbList.begin(); my_iterator != nbList.end(); my_iterator++) {
443  acc_elem = acc_elem + my_iterator->second ;// nbList;
444  std::cout<<"iterator_values"<<my_iterator->first<< my_iterator->second<<"\n";
445  if(acc_elem > total_elems/2.0){
446  medianval = my_iterator->first;
447  std::cout<< "acc_elem="<<acc_elem<<"medianval="<<"\n";
448  break;
449  }
450  // iterator->first = key
451  // iterator->second = value
452  }// iterator
453 
454  this->retVal = medianval;
455  //this->retVal.push_back(xSum/tSum);
456 
457  }
458 
459  };// END measMedianValFunc
460 
465  template <class T>
466  T measMedianVal(const Image<T> &imIn, bool onlyNonZero=true)
467  {
469  return func(imIn, onlyNonZero);
470  }
471 
475  template <class T>
476  vector<T> profile(const Image<T> &im, size_t x0, size_t y0, size_t x1, size_t y1, size_t z=0)
477  {
478  vector<T> vec;
479  ASSERT(im.isAllocated(), vec);
480 
481  size_t imW = im.getWidth();
482  size_t imH = im.getHeight();
483 
484  vector<IntPoint> bPoints;
485  if ( x0>=imW || y0>=imH || x1>=imW || y1>=imH )
486  bPoints = bresenhamPoints(x0, y0, x1, y1, imW, imH);
487  else
488  bPoints = bresenhamPoints(x0, y0, x1, y1); // no image range check (faster)
489 
490  typename Image<T>::sliceType lines = im.getSlices()[z];
491 
492  for(vector<IntPoint>::iterator it=bPoints.begin();it!=bPoints.end();it++)
493  vec.push_back(lines[(*it).y][(*it).x]);
494 
495  return vec;
496 
497  }
498 
499  template <class T>
500  struct measBarycenterFunc : public MeasureFunctionWithPos<T, Vector_double>
501  {
502  typedef typename Image<T>::lineType lineType;
503  double xSum, ySum, zSum, tSum;
504  virtual void initialize(const Image<T> &/*imIn*/)
505  {
506  this->retVal.clear();
507  xSum = ySum = zSum = tSum = 0.;
508  }
509  virtual void processSequence(lineType lineIn, size_t size, size_t x, size_t y, size_t z)
510  {
511  for (size_t i=0;i<size;i++,x++)
512  {
513  T pixVal = lineIn[i];
514  xSum += double(pixVal) * x;
515  ySum += double(pixVal) * y;
516  zSum += double(pixVal) * z;
517  tSum += double(pixVal);
518  }
519  }
520  virtual void finalize(const Image<T> &imIn)
521  {
522  this->retVal.push_back(xSum/tSum);
523  this->retVal.push_back(ySum/tSum);
524  if (imIn.getDimension()==3)
525  this->retVal.push_back(zSum/tSum);
526  }
527  };
528 
529  template <class T>
530  Vector_double measBarycenter(Image<T> &im)
531  {
533  return func(im, false);
534  }
535 
536 
537  template <class T>
538  struct measBoundBoxFunc : public MeasureFunctionWithPos<T, vector<size_t> >
539  {
540  typedef typename Image<T>::lineType lineType;
541  double xMin, xMax, yMin, yMax, zMin, zMax;
542  bool im3d;
543  virtual void initialize(const Image<T> &imIn)
544  {
545  this->retVal.clear();
546  size_t imSize[3];
547  imIn.getSize(imSize);
548  im3d = (imSize[2]>1);
549 
550  xMin = imSize[0];
551  xMax = 0;
552  yMin = imSize[1];
553  yMax = 0;
554  zMin = imSize[2];
555  zMax = 0;
556  }
557  virtual void processSequence(lineType /*lineIn*/, size_t size, size_t x, size_t y, size_t z)
558  {
559  if (x<xMin) xMin = x;
560  if (x+size-1>xMax) xMax = x+size-1;
561  if (y<yMin) yMin = y;
562  if (y>yMax) yMax = y;
563  if (im3d)
564  {
565  if (z<zMin) zMin = z;
566  if (z>zMax) zMax = z;
567  }
568  }
569  virtual void finalize(const Image<T> &/*imIn*/)
570  {
571  this->retVal.push_back(UINT(xMin));
572  this->retVal.push_back(UINT(yMin));
573  if (im3d)
574  this->retVal.push_back(UINT(zMin));
575  this->retVal.push_back(UINT(xMax));
576  this->retVal.push_back(UINT(yMax));
577  if (im3d)
578  this->retVal.push_back(UINT(zMax));
579  }
580  };
586  template <class T>
587  vector<size_t> measBoundBox(Image<T> &im)
588  {
589  measBoundBoxFunc<T> func;
590  return func(im, true);
591  }
592 
593 
594  template <class T>
595  struct measInertiaMatrixFunc : public MeasureFunctionWithPos<T, Vector_double>
596  {
597  typedef typename Image<T>::lineType lineType;
598  double m000, m100, m010, m110, m200, m020, m001, m101, m011, m002;
599  bool im3d;
600  virtual void initialize(const Image<T> &imIn)
601  {
602  im3d = (imIn.getDimension()==3);
603  this->retVal.clear();
604  m000 = m100 = m010 = m110 = m200 = m020 = m001 = m101 = m011 = m002 = 0.;
605  }
606  virtual void processSequence(lineType lineIn, size_t size, size_t x, size_t y, size_t z)
607  {
608  for (size_t i=0;i<size;i++,x++)
609  {
610  double pxVal = double(lineIn[i]);
611  m000 += pxVal;
612  m100 += pxVal * x;
613  m010 += pxVal * y;
614  m110 += pxVal * x * y;
615  m200 += pxVal * x * x;
616  m020 += pxVal * y * y;
617  if (im3d)
618  {
619  m001 = pxVal * z;
620  m101 = pxVal * x * z;
621  m011 = pxVal * y * z;
622  m002 = pxVal * z * z;
623  }
624  }
625  }
626  virtual void finalize(const Image<T> &/*imIn*/)
627  {
628  this->retVal.push_back(m000);
629  this->retVal.push_back(m100);
630  this->retVal.push_back(m010);
631  if (im3d)
632  this->retVal.push_back(m001);
633  this->retVal.push_back(m110);
634  if (im3d)
635  {
636  this->retVal.push_back(m101);
637  this->retVal.push_back(m011);
638  }
639  this->retVal.push_back(m200);
640  this->retVal.push_back(m020);
641  if (im3d)
642  this->retVal.push_back(m002);
643  }
644  };
653  template <class T>
654  Vector_double measInertiaMatrix(const Image<T> &im, const bool onlyNonZero=true)
655  {
657  return func(im, onlyNonZero);
658  }
659 
666  template <class T>
667  vector<double> measCovariance(const Image<T> &imIn1, const Image<T> &imIn2, size_t dx, size_t dy, size_t dz, UINT maxSteps=0, bool normalize=false)
668  {
669  vector<double> vec;
670  ASSERT(areAllocated(&imIn1, &imIn2, NULL), vec);
671  ASSERT(haveSameSize(&imIn1, &imIn2, NULL), "Input images must have the same size", vec);
672 
673  size_t s[3];
674  imIn1.getSize(s);
675  if (maxSteps==0)
676  maxSteps = max(max(s[0], s[1]), s[2]) - 1;
677  vec.clear();
678 
679  typename ImDtTypes<T>::volType slicesIn1 = imIn1.getSlices();
680  typename ImDtTypes<T>::volType slicesIn2 = imIn2.getSlices();
681  typename ImDtTypes<T>::sliceType curSliceIn1;
682  typename ImDtTypes<T>::sliceType curSliceIn2;
683  typename ImDtTypes<T>::lineType lineIn1;
684  typename ImDtTypes<T>::lineType lineIn2;
685  typename ImDtTypes<T>::lineType bufLine = ImDtTypes<T>::createLine(s[0]);
686 
687 
688  for (UINT len=0;len<=maxSteps;len++)
689  {
690  double prod = 0;
691  size_t xLen = s[0] - dx*len;
692  size_t yLen = s[1] - dy*len;
693  size_t zLen = s[2] - dz*len;
694 
695  for (size_t z=0;z<zLen;z++)
696  {
697  curSliceIn1 = slicesIn1[z];
698  curSliceIn2 = slicesIn2[z+len*dz];
699  for (UINT y=0;y<yLen;y++)
700  {
701  lineIn1 = curSliceIn1[y];
702  lineIn2 = curSliceIn2[y+len*dy];
703  copyLine<T>(lineIn2 + len*dx, xLen, bufLine);
704  for (size_t x=0;x<xLen;x++) // Vectorized loop
705  prod += lineIn1[x] * bufLine[x];
706  }
707  }
708  if (xLen*yLen*zLen != 0)
709  prod /= (xLen*yLen*zLen);
710  vec.push_back(prod);
711  }
712 
713  if (normalize)
714  {
715  double orig = vec[0];
716  for (vector<double>::iterator it=vec.begin();it!=vec.end();it++)
717  *it /= orig;
718  }
719 
720  ImDtTypes<T>::deleteLine(bufLine);
721 
722  return vec;
723  }
724 
731  template <class T>
732  vector<double> measCovariance(const Image<T> &imIn, size_t dx, size_t dy, size_t dz, UINT maxSteps=0, bool normalize=false)
733  {
734  return measCovariance(imIn, imIn, dx, dy, dz, maxSteps, normalize);
735  }
736 
743  template <class T>
744  vector<double> measCenteredCovariance(const Image<T> &imIn, size_t dx, size_t dy, size_t dz, UINT maxSteps=0, bool normalize=false)
745  {
746  Image<float> imMean(imIn, true);
747  float meanV = meanVal(imMean)[0];
748  sub(imMean, meanV, imMean);
749  return measCovariance(imMean, dx, dy, dz, maxSteps, normalize);
750  }
751 
756  template <class T>
757  Vector_UINT nonZeroOffsets(Image<T> &imIn)
758  {
759  Vector_UINT offsets;
760 
761  ASSERT(CHECK_ALLOCATED(&imIn), RES_ERR_BAD_ALLOCATION, offsets);
762 
763  typename Image<T>::lineType pixels = imIn.getPixels();
764 
765  for (size_t i=0;i<imIn.getPixelCount();i++)
766  if (pixels[i]!=0)
767  offsets.push_back(i);
768 
769  return offsets;
770  }
771 
776  template <class T>
777  bool isBinary(const Image<T> &imIn)
778  {
779  CHECK_ALLOCATED(&imIn);
780 
781  typename Image<T>::lineType pixels = imIn.getPixels();
782 
783  for (size_t i=0;i<imIn.getPixelCount();i++)
784  if (pixels[i]!=ImDtTypes<T>::min() && pixels[i]!=ImDtTypes<T>::max())
785  return false;
786 
787  return true;
788  }
789 
792 } // namespace smil
793 
794 
795 #endif // _D_MEASURES_HPP
796 
Vector_double meanVal(const Image< T > &imIn, bool onlyNonZero=false)
Mean value and standard deviation.
Definition: DMeasures.hpp:145
Vector_UINT nonZeroOffsets(Image< T > &imIn)
Non-zero point offsets.
Definition: DMeasures.hpp:757
Definition: DColorConvert.h:38
RES_T sub(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
Subtraction.
Definition: DImageArith.hpp:446
RES_T copy(const Image< T1 > &imIn, size_t startX, size_t startY, size_t startZ, size_t sizeX, size_t sizeY, size_t sizeZ, Image< T2 > &imOut, size_t outStartX=0, size_t outStartY=0, size_t outStartZ=0)
Copy image.
Definition: DImageArith.hpp:114
double vol(const Image< T > &imIn)
Volume of an image.
Definition: DMeasures.hpp:96
vector< double > measCenteredCovariance(const Image< T > &imIn, size_t dx, size_t dy, size_t dz, UINT maxSteps=0, bool normalize=false)
Centered auto-covariance.
Definition: DMeasures.hpp:744
vector< T > profile(const Image< T > &im, size_t x0, size_t y0, size_t x1, size_t y1, size_t z=0)
Get image values along a profile.
Definition: DMeasures.hpp:476
lineType getPixels() const
Get the pixels as a 1D array.
Definition: DImage.hpp:110
Definition: DMeasures.hpp:595
vector< size_t > measBoundBox(Image< T > &im)
Bounding Box measure.
Definition: DMeasures.hpp:587
bool isBinary(const Image< T > &imIn)
Test if an image is binary.
Definition: DMeasures.hpp:777
Definition: DMeasures.hpp:538
vector< double > measCovariance(const Image< T > &imIn, size_t dx, size_t dy, size_t dz, UINT maxSteps=0, bool normalize=false)
Auto-covariance.
Definition: DMeasures.hpp:732
Definition: DMeasures.hpp:169
bool isAllocated() const
Check if the image is allocated.
Definition: DBaseImage.h:163
Definition: DMeasures.hpp:153
Definition: DMeasures.hpp:103
vector< T > rangeVal(const Image< T > &imIn, bool onlyNonZero=false)
Min and Max values of an image.
Definition: DMeasures.hpp:313
Definition: DBaseMeasureOperations.hpp:46
Definition: DMeasures.hpp:53
size_t getHeight() const
Get image height.
Definition: DBaseImage.h:91
T measMedianVal(const Image< T > &imIn, bool onlyNonZero=true)
Get the mode of the histogram present in the image, i.e.
Definition: DMeasures.hpp:466
size_t area(const Image< T > &imIn)
Area of an image.
Definition: DMeasures.hpp:70
Definition: DMeasures.hpp:215
Definition: DMeasures.hpp:78
size_t getWidth() const
Get image width.
Definition: DBaseImage.h:87
Definition: DMeasures.hpp:231
size_t getPixelCount() const
Get the number of pixels.
Definition: DBaseImage.h:150
Definition: DBaseMeasureOperations.hpp:125
Definition: DTypes.hpp:78
Main Image class.
Definition: DQVtkViewer.hpp:44
Definition: DMeasures.hpp:405
Definition: DMeasures.hpp:355
T measModeVal(const Image< T > &imIn, bool onlyNonZero=true)
Get the mode of the histogram present in the image, i.e.
Definition: DMeasures.hpp:399
vector< T > valueList(const Image< T > &imIn, bool onlyNonZero=true)
Get the list of the pixel values present in the image.
Definition: DMeasures.hpp:349
UINT getDimension() const
Get dimension (2D or 3D)
Definition: DBaseImage.h:105
T maxVal(const Image< T > &imIn, bool onlyNonZero=false)
Max value of an image.
Definition: DMeasures.hpp:260
Vector_double measInertiaMatrix(const Image< T > &im, const bool onlyNonZero=true)
Measure inertia moments.
Definition: DMeasures.hpp:654
Definition: DMeasures.hpp:500
T minVal(const Image< T > &imIn, bool onlyNonZero=false)
Min value of an image.
Definition: DMeasures.hpp:198
volType getSlices() const
Get an array containing the start offset of each slice.
Definition: DImage.hpp:118
Definition: DMeasures.hpp:320
Definition: DMeasures.hpp:277