digiKam
imagehistogram.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2004-07-21
7  * Description : image histogram manipulation methods.
8  *
9  * Copyright (C) 2004-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_IMAGE_HISTOGRAM_H
25 #define DIGIKAM_IMAGE_HISTOGRAM_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QEvent>
31 #include <QThread>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 #include "dynamicthread.h"
37 
38 namespace Digikam
39 {
40 
41 class DImg;
42 
43 class DIGIKAM_EXPORT ImageHistogram : public DynamicThread
44 {
45  Q_OBJECT
46 
47 public:
48 
49  explicit ImageHistogram(const DImg& img, QObject* const parent = nullptr);
50  ~ImageHistogram() override;
51 
55  void calculate();
56  void calculateInThread();
57 
61  void stopCalculation();
62  bool isCalculating() const;
63 
67  bool isSixteenBit() const;
68  bool isValid() const;
69 
70  double getCount(int channel, int start, int end) const;
71  double getMean(int channel, int start, int end) const;
72  double getPixels() const;
73  double getStdDev(int channel, int start, int end) const;
74  double getValue(int channel, int bin) const;
75  double getMaximum(int channel, int start, int end) const;
76 
77  int getHistogramSegments() const;
78  int getMaxSegmentIndex() const;
79  int getMedian(int channel, int start, int end) const;
80 
81 Q_SIGNALS:
82 
83  void calculationFinished(bool success);
84 
89 
94 
95 protected:
96 
97  void run() override;
98 
99 private:
100 
101  class Private;
102  Private* const d;
103 };
104 
105 } // namespace Digikam
106 
107 #endif // DIGIKAM_IMAGE_HISTOGRAM_H
Definition: dimg.h:62
Definition: dynamicthread.h:43
Definition: imagehistogram.h:44
void calculationFinished(bool success)
Definition: datefolderview.cpp:43