-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_header.h~
136 lines (122 loc) · 5.35 KB
/
main_header.h~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#ifndef MAIN_HEADER_H //header guard
#define MAIN_HEADER_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmimgle/dcmimage.h" /* for DicomImage */
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
using namespace std;
class various{
public:
template <typename T> static string ToString(T input);
static void iterateVectorToFile(vector<pair<double, double>> vectorInput, string fileName);
static string fileNameErase(string fileName);
};
class mammography: public various{
public:
long XRayTubeCurrent, Exposure, Rows, Columns, BitsAllocated, PixelRepresentation, SmallestImagePixelValue, LargestImagePixelValue;
OFString KVP, BodyPartThickness, CompressionForce, Filter, Target;
vector<Uint16> pixelVec;
public:
mammography(){
cout << "mammography constructor is called" << endl;
};
~mammography() {cout << "mammography destructor is called" << endl;}
void loadHeaderData(const string fileName);
void loadPixelData(const string fileName);
};
class phantomCalibration: public various{
public:
vector< pair<double, double> > dataArr;
public:
phantomCalibration(){
cout << "phantomCalibration constructor is called" << endl;
};
~phantomCalibration() {cout << "phantomCalibration destructor is called" << endl;}
// input the fibroglandular tissue thickness value into dataArr
void inputData(const double t, const double ln_MPV_mAs);
// get the phantomCalibration class object with dataArr containing the data for given total thickness
static phantomCalibration getThicknessData(const string filTar, const int kV, const int t);
void applyShift(const double shift);
void dataCorrection(const double x0, const double y0, const int kV, const string filTar, const int t);
};
typedef map< string, phantomCalibration> calibData;
class dailyCalibration: public mammography{
public:
double qc_ln_MPV_mAs;
double t;
double tg;
string filTar;
public:
void insertFilTar(mammography mammData);
void InserQcTTg(mammography mammData, const string fileName);
};
class scanner: public phantomCalibration, dailyCalibration{
public:
double shift;
public:
scanner(const int shiftIn): shift(shiftIn) { cout << "scanner constructor is called" << endl; };
~scanner() {cout << "scanner destructor is called" << endl;}
// fit linear function into data
static pair<double,double> linearfit(const double* x1, const double* y1, const int sizeArr);
// calculate shift from the QC data point
static double calcShift(const pair<double,double> coeff, const double x0, const double y);
};
class breast: public mammography, phantomCalibration{
public:
cv::Mat mMammo;
cv::Mat mHistB;
cv::Mat mMammoThreshed;
cv::Mat mMammoDist;
cv::Mat mCorner;
private:
double breastVol, fibroVol;
int iColourMAX;
vector<cv::Mat> bgr_planes;
vector<cv::Point> pEdgeContour;
vector<vector<cv::Point>> pContours;
vector<cv::Point> vecContCents;
vector<float> vecDistBright;
vector<float> vecDistBrightBrightest;
public:
breast(mammography mammData){
mMammo = cv::Mat((int)mammData.Rows, (int)mammData.Columns, CV_16UC1, cv::Scalar(1));
for(int i = 0; i < mammData.Columns; i++){
for(int j = 0; j < mammData.Rows; j++){
mMammo.at<Uint16>(j,i) = mammData.pixelVec[i+(int)mammData.Columns*j];
}
}
};
int getBitDepth();
vector<cv::Mat> separate3channels();
static void drawHist(const int histSize);
pair<float, float> findPeak(const int histSize);
float findWidth(const int iBinMax, const int iNMax);
vector<cv::Point> distanceTransform();
bool leftOrRight(vector<cv::Point> pEdgeContour);
float findIMax();
vector<vector<cv::Point>> findCorners(float iDivisor, const int iMax, const int iCOLOUR_MAX);
vector<cv::Point> findCornerCentre();
pair<int, int> pickCornerCutOff(const bool bLeft);
void deleteUnneeded(const bool bLeft, cv::Mat mMammoThreshedCopy, const vector<cv::Point> pEdgeContourCopy, const int iContPosY);
vector<float> getDistBright();
vector<float> brestThickness(const int histSize, const cv::Mat_<int> mMammoDistChar, const cv::Mat mMammoCopy);
static vector<float> normalBreastThickness(vector<float> vecDistBrightBrightestm, const cv::Mat distImage);
void drawImages(string fileName, const cv::Mat distImage, const cv::Mat mCornerTresh, const cv::Mat mMammoThreshedCopy, const int histSize);
static double fibrogland(mammography mammData, calibData calibration);
static double totalBreast(mammography mammData);
static double glandpercent(const double tg, const double t);
};
template <typename T> string various::ToString(T input){
stringstream ss;
ss << input;
string output = ss.str();
return output;
}
#endif // MAIN_HEADER_H