-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAG17RGBAImage.h
136 lines (95 loc) · 4.21 KB
/
AG17RGBAImage.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
135
136
#pragma once
#include "YK16GrayImage.h" // for enumerators and types without overloading
#include <QImage>
#include <vector>
#include <QVector>
class AG17RGBAImage
{
public:
AG17RGBAImage(void);
AG17RGBAImage(int width, int height);
~AG17RGBAImage(void);
int m_iWidth;
int m_iHeight;
//added: 20140206
double m_fSpacingX; //[mm/px]
double m_fSpacingY;
unsigned short* m_pData; // 0 - 65535
QPixmap* m_pPixmap; //Actually, no need!
QImage m_QImage;
//QPainter* m_pPainter;
bool CopyFromBuffer(unsigned short* pImageBuf, int width, int height);
bool CloneImage(AG17RGBAImage& other);
bool CreateImage(int width, int height, unsigned short usVal);
bool FillPixMap(int winMid, int winWidth);
bool FillPixMapMinMax(int winMin, int winMax); //0-65535 Áß window level
bool FillPixMapDual(int winMid1, int winMid2, int winWidth1, int winWidth2);
bool FillPixMapMinMaxDual(int winMin1, int winMin2, int winMax1, int winMax2); //0-65535 Áß window level
bool IsEmpty();
bool ReleaseBuffer();
//bool CalcImageInfo (double& meanVal, double& STDV, double& minVal, double& maxVal);
bool CalcImageInfo();
double CalcAveragePixelDiff(AG17RGBAImage& other);
static void CopyYKImage2ItkImage(AG17RGBAImage* pYKImage, UnsignedShortImageType::Pointer& spTarImage);
static void CopyItkImage2YKImage(UnsignedShortImageType::Pointer& spSrcImage, AG17RGBAImage* pYKImage);
QString m_strFilePath;
double m_fPixelMean;
double m_fPixelSD;
double m_fPixelMin;
double m_fPixelMax;
static void Swap(AG17RGBAImage* pImgA, AG17RGBAImage* pImgB);
QRect m_rtROI;
bool setROI(int left, int top, int right, int bottom); //if there is error, go to default: entire image
bool CalcImageInfo_ROI();
double m_fPixelMean_ROI;
double m_fPixelSD_ROI;
double m_fPixelMin_ROI;
double m_fPixelMax_ROI;
bool m_bDrawROI;
void DrawROIOn(bool bROI_Draw); //only rectangle
bool m_bShowInvert;
void MultiplyConstant(double multiplyFactor);
void SetSpacing(double spacingX, double spacingY)
{
m_fSpacingX = spacingX;
m_fSpacingY = spacingY;
};
QPoint m_ptProfileProbe; //Mouse Clicked Position --> Data
bool m_bDrawProfileX;
bool m_bDrawProfileY;
QPoint m_ptFOVCenter; // data pos
int m_iFOVRadius;//data pos (pixel)
bool m_bDrawFOVCircle;
int m_iTableTopPos;//data pos
bool m_bDrawTableLine;
QPoint m_ptCrosshair; //data position
bool m_bDrawCrosshair;
////ZOOM and PAN function. Using these information below, prepare the m_QImage for displaying
//in qlabel in FillPixMap function
int m_iOffsetX; //for Pan function.. this is data based offset
int m_iOffsetY;
void SetOffset(int offsetX, int offsetY) { m_iOffsetX = offsetX; m_iOffsetY = offsetY; }
double m_fZoom;
void SetZoom(double fZoom);
//SPLIT VIEW
QPoint m_ptSplitCenter; //Fixed image with Moving image. center is based on dataPt.//Fixed Image: Left Top + Right Bottom, Moving: Right Top + Left Bottom
int m_enSplitOption;
//This cetner is moved while Left Dragging //All split and crosshair are data point based!
void SetSplitOption(enSplitOption option) { m_enSplitOption = option; }
void SetSplitCenter(QPoint& ptSplitCenter); //From mouse event, data point
//void SetSplitCenter(int centerX, int centerY) {m_ptSplitCenter.setX(centerX); m_ptSplitCenter.setY(centerY);}//From mouse event, data point
bool ConstituteFromTwo(AG17RGBAImage& YKImg1, AG17RGBAImage& YKImg2); //YKImg1 and two should be in exactly same dimension and spacing
bool isPtInFirstImage(int dataX, int dataY);
void SetProfileProbePos(int dataX, int dataY);
unsigned short GetProfileProbePixelVal();
void GetProfileData(int dataX, int dataY, QVector<double>& vTarget, enProfileDirection direction);
void GetProfileData(QVector<double>& vTarget, enProfileDirection direction);
void EditImage_Flip();
void EditImage_Mirror();
double m_fResampleFactor;//if it is not the 1.0, the data is already resampled.
UnsignedShortImageType::Pointer CloneItkImage();
void ResampleImage(double fResampleFactor);
void UpdateFromItkImage(UnsignedShortImageType::Pointer& spRefItkImg);
void UpdateFromItkImageFloat(FloatImageType2D::Pointer& spRefItkImg);
void InvertImage();
};