Computer Assisted Medical Intervention Tool Kit  version 5.2
ImageLutModel.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef ImageLutModel_H
27 #define ImageLutModel_H
28 
29 #include <vtkImageData.h>
30 #include <vtkSmartPointer.h>
31 
47 public:
49  ImageLutModel(vtkSmartPointer<vtkImageData>);
50 
53 
55  double getMinValue();
56 
58  double getMaxValue();
59 
61  void setNumberOfBins(int);
62 
64  int getNumberOfBins();
65 
67  double getMaxBinValue();
68 
70  double getBinValue(int);
71 
73  int getBinIndex(double);
74 
78  double getBinIndexAsDouble(double value, bool checkBound = true);
79 
81  int getPercentFromLevel(double);
82 
84  double getLevelFromPercent(int);
85 
87  int getPercentFromWindow(double);
88 
90  double getWindowFromPercent(int);
91 
92 private:
94  void updateHistogram();
95 
97  vtkSmartPointer<vtkImageData> image;
98 
100  double minValue;
101 
103  double maxValue;
104 
106  double* greyLevels;
107 
109  double highestGreyLevel;
110 
112  unsigned int nbHistoBins;
113 
114 };
115 
116 #endif // ImageLutModel_H
The class ImageLutModel model the histogram of a given vtkImageData.
Definition: ImageLutModel.h:46
int getBinIndex(double)
image value to the histogram bin index (get the bin index of a given value)
Definition: ImageLutModel.cpp:107
double getBinIndexAsDouble(double value, bool checkBound=true)
image value to the histogram value (required to show the current level/window values on the graph)
Definition: ImageLutModel.cpp:121
int getPercentFromWindow(double)
get window value as a percentage between 0 and 100
Definition: ImageLutModel.cpp:164
double getWindowFromPercent(int)
get window value from a percentage
Definition: ImageLutModel.cpp:174
int getNumberOfBins()
get the current number of bins
Definition: ImageLutModel.cpp:146
double getMaxBinValue()
get the highgest grey level value
Definition: ImageLutModel.cpp:101
int getPercentFromLevel(double)
get level value as a percentage between 0 and 100
Definition: ImageLutModel.cpp:159
void setNumberOfBins(int)
change the number of bins
Definition: ImageLutModel.cpp:151
double getBinValue(int)
get the number of voxels that end up in a given bin index
Definition: ImageLutModel.cpp:91
double getMinValue()
get the minimal voxel value (lutMin)
Definition: ImageLutModel.cpp:141
double getMaxValue()
get the maximal voxel value (lutMax)
Definition: ImageLutModel.cpp:136
~ImageLutModel()
destructor
Definition: ImageLutModel.cpp:48
double getLevelFromPercent(int)
get level value from a percentage
Definition: ImageLutModel.cpp:169
ImageLutModel(vtkSmartPointer< vtkImageData >)
Constructor: set the image data.
Definition: ImageLutModel.cpp:32