Structure.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. #ifndef __STRUCTURE_530_H__
  2. #define __STRUCTURE_530_H__
  3. #include <iostream>
  4. #include <vector>
  5. using std::vector;
  6. using std::string;
  7. #define CR_DIR_TO_SAVE_CAL_FILES "DirToSaveCalFiles"
  8. namespace CareRay
  9. {
  10. //*****************************************************************************************
  11. // enum starts here.
  12. //*****************************************************************************************
  13. enum CR_TrigTypeOpt
  14. {
  15. CR_RadExtSync = 0x01,
  16. CR_RadSoftSync = 0x02,
  17. CR_RadAutoSync = 0x03,
  18. CR_RadManualSync = 0x04,
  19. CR_RadAedSync = 0x05,
  20. CR_RadDaecSync = 0x06,
  21. CR_FluReserved = 0x07,
  22. CR_FluExtSync = 0x08,
  23. CR_FluIntSync = 0x09,
  24. };
  25. enum CR_GainLevelOpt
  26. {
  27. CR_G0 = 0,
  28. CR_G1 = 1,
  29. CR_G2 = 2,
  30. CR_G3 = 3,
  31. CR_G4 = 4,
  32. CR_G5 = 5,
  33. CR_G6 = 6,
  34. CR_G7 = 7,
  35. };
  36. enum CR_PowerModeID
  37. {
  38. CR_PWR_STANDBY = 0, // set front-end into nap mode
  39. CR_PWR_FULL_RUNNING = 1, // set front-end into normal mode.
  40. CR_PWR_SMART_RUNNING = 2, // set front-end into nap mode at the integration phase.
  41. CR_PWR_DOWN_FE = 4, // set front-end into power-down mode.
  42. CR_PWR_SLEEPING = 5,
  43. CR_PWR_DEEP_SLEEPING = 6,
  44. CR_PWR_SUSPEND = 7, // power down
  45. };
  46. enum CR_AcqModeOpt
  47. {
  48. CR_Radiography = 0x10,
  49. CR_Fluoroscopy = 0x11,
  50. CR_DaecMode = 0x12,
  51. CR_FluoroCustom = 0x13,
  52. CR_InnerTest = 0x14,
  53. CR_Bin22 = 0x15,
  54. CR_NondestructiveTesting = 0x16,
  55. CR_Preview = 0x17,
  56. CR_Bin11 = 0x18,
  57. };
  58. enum CR_EventID
  59. {
  60. CR_EVT_SERVER_DISCONNECTED,
  61. CR_EVT_DETR_DISCONNECTED,
  62. CR_EVT_EXPOSURE_INFO,
  63. CR_EVT_TEMPERATURE_INFO,
  64. CR_EVT_BATTERY_INFO,
  65. CR_EVT_WIRELESS_INFO,
  66. CR_EVT_NEW_FRAME,
  67. CR_EVT_CALIBRATION_IN_PROGRESS,
  68. CR_EVT_CALIBRATION_FINISHED,
  69. CR_EVT_NEW_SPOT_FILM,
  70. CR_EVT_ACQ_STAT_INFO,
  71. CR_EVT_RAD_ACQ_IN_PROGRESS,
  72. CR_EVT_SERVER_RECONNECTED,
  73. CR_EVT_DETR_RECONNECTED,
  74. CR_EVT_IMAGE_QUEUE_BLOCKED,
  75. CR_EVT_DISCARD_FRAME
  76. };
  77. enum CR_ExpStatus
  78. {
  79. CR_EXP_ERROR = -1,
  80. CR_EXP_INIT,
  81. CR_EXP_READY,
  82. CR_EXP_WAIT_PERMISSION,
  83. CR_EXP_PERMITTED,
  84. CR_EXP_EXPOSE,
  85. CR_EXP_COMPLETE,
  86. };
  87. enum CR_ReturnCodeType
  88. {
  89. CR_INFOR = 1,
  90. CR_WARN,
  91. CR_ERROR,
  92. CR_FATALERROR
  93. };
  94. enum CR_CalFileType
  95. {
  96. CR_OFFSET_FILE = 0,
  97. CR_GAIN_FILE = 1,
  98. CR_DEFECT_FILE = 2
  99. };
  100. enum CR_RefStatus
  101. {
  102. CR_REF_NOT_FOUND,
  103. CR_REF_VALID,
  104. CR_REF_ABOUT_TO_EXPIRE,
  105. CR_REF_INVALID
  106. };
  107. enum CR_CalibFilterMethod
  108. {
  109. CR_CALIB_FILTER_BASE,
  110. CR_CALIB_FILTER_MEAN,
  111. CR_CALIB_FILTER_BOUNDARY
  112. };
  113. enum CR_ProcChainOpt
  114. {
  115. CR_PROCCHAIN_SANITYCHECK = 0x01,
  116. CR_PROCCHAIN_DARKCORR = 0x02,
  117. CR_PROCCHAIN_GAINCORR = 0x04,
  118. CR_PROCCHAIN_DEFECTCORR = 0x08,
  119. CR_PROCCHAIN_LAGCORR = 0x10,
  120. CR_PROCCHAIN_IMGCROPPING = 0x20,
  121. CR_PROCCHAIN_RTPIXELCORR = 0x40,
  122. CR_PROCCHAIN_DENOISING = 0x80,
  123. CR_PROCCHAIN_STEPSUPPRESS = 0x100,
  124. CR_PROCCHAIN_ROTATE_IAMGE = 0x200,
  125. CR_PROCCHAIN_GAUSSFILTER = 0x80000000
  126. };
  127. enum CR_ProcChainID
  128. {
  129. CR_PROCCHAINID_FLUOROSCOPY = 1,
  130. CR_PROCCHAINID_RADIOGRAPHY = 2
  131. };
  132. //*****************************************************************************************
  133. // struct starts here.
  134. //*****************************************************************************************
  135. struct CR_SystemInfo
  136. {
  137. unsigned int nRawImageWidth;
  138. unsigned int nRawImageHeight;
  139. unsigned int nFrmHeaderLen;
  140. char szHardwareVersion[64];
  141. char szSerialNumber[64];
  142. char szSoftwareVersion[64];
  143. char szFirmwareVersion[64];
  144. char szDetrMachineID[64];
  145. char szDetrDesc[128];
  146. char szReserved[512];
  147. };
  148. struct CR_DefectInfo
  149. {
  150. unsigned int unNumBadPixel;
  151. unsigned int unNumBadRow;
  152. unsigned int unNumBadCol;
  153. unsigned short* pBadPixelPtr;
  154. unsigned short* pBadRowPtr;
  155. unsigned short* pBadColPtr;
  156. };
  157. struct CR_ConnectionStatus
  158. {
  159. bool isServerConnected;
  160. bool isDetrConnected;
  161. };
  162. struct CR_Temperature
  163. {
  164. float fMin;
  165. float fCpu;
  166. float fWiredNetwork;
  167. float fReserved;
  168. float fCurrent;
  169. float fMax;
  170. float fAvg;
  171. int nOverheat;
  172. };
  173. struct CR_DetrStatus
  174. {
  175. CR_Temperature oDetrTemperature;
  176. };
  177. struct CR_DetrIdxAndIPAddr
  178. {
  179. int nIdx;
  180. char szIPAddr[64];
  181. char szReserved[128];
  182. };
  183. struct CR_RegAttrInfo
  184. {
  185. bool isWritable;
  186. bool isFloat;
  187. unsigned nVal;
  188. float fVal;
  189. char czPropertyName[32];
  190. };
  191. struct CR_ModeInfo
  192. {
  193. int nModeID;
  194. int nImageWidth; // ROI dimension along x direction after binning
  195. int nImageHeight; // ROI dimension along y direction after binning
  196. int nCutoffX; // number of cut-off lines (along x direction) from left after binning
  197. int nCutoffY; // number of cut-off lines (along y direction) from top after binning
  198. int nBinX; // binning scheme along x direction
  199. int nBinY; // binning scheme along y direction
  200. float fMaxFrmRate; // in Hz
  201. float fMaxExpTime; // in ms
  202. int nPixelDepth; // bit depth of each pixel sending out from detector
  203. int nTrigTypes[16];
  204. int nTrigTypeNum;
  205. int nGainLevels[16];
  206. int nGainLevelNum;
  207. int nDefaultTrigType;
  208. int nDefaultGainLevel;
  209. int nRoiX; // x coordinate of top left point after binning
  210. int nRoiY; // y coordinate of top left point after binning
  211. char szDesc[256]; // description of this mode
  212. };
  213. struct CR_CalibrationInfo
  214. {
  215. int nTotalFrameNum;
  216. int nCurrentFrameNum;
  217. int nCurrentFrameMeanValue;
  218. char szErrorMsg[256];
  219. int nResult;
  220. int nExpStatus;
  221. int nTargetGrayValue;
  222. };
  223. struct CR_ConfItemInfo
  224. {
  225. int nId;
  226. string strName;
  227. string strModule;
  228. string strValue;
  229. string strDefaultValue;
  230. string strRegex;
  231. int nPermission;
  232. string strDesc;
  233. string strDescZH;
  234. int nReboot;
  235. };
  236. struct CR_ProcessModule
  237. {
  238. int nModuleID;
  239. int nOrderID;
  240. string strName;
  241. int nEnabled;
  242. int nDefaultEnabled;
  243. int nAutoSave;
  244. int nUpdatePolicy;
  245. };
  246. struct CR_ProcessChain
  247. {
  248. int nChainID;
  249. vector<CR_ProcessModule> vecModule;
  250. };
  251. struct CR_Event
  252. {
  253. int nDetrIndex;
  254. int nWidth;
  255. int nHeight;
  256. int nPixelDepth;
  257. void* pData;
  258. };
  259. struct CR_AcquisitionStatInfo
  260. {
  261. int nTotalFrameNum;
  262. int nLostFrameNum;
  263. float fStatFrameRate;
  264. float fTransmissionSpeed;
  265. long long nAcqDuration;
  266. };
  267. // Image quality statistics
  268. struct CR_SQualityStatistics
  269. {
  270. // Passed type count
  271. int m_nQualityPassedCount;
  272. // Failed type count
  273. int m_nQualityFailedCount;
  274. };
  275. struct CR_ExpProgress
  276. {
  277. int nExpStatus;
  278. int bIsFetchable;
  279. int nResult;
  280. };
  281. typedef struct CR_AedExpProgress
  282. {
  283. CR_ExpProgress oProgress;
  284. float fAedElapsedTimeSinceLastReadout;
  285. float fAedRefreshInterval;
  286. }CR_AedExpProgress;
  287. struct CR_CalFileInfo
  288. {
  289. int nCalType;
  290. float fFrameRate;
  291. int nGainId;
  292. float fTemperature;
  293. int nStatus;
  294. int nTrigType;
  295. char szModeName[256];
  296. char szDatetime[64];
  297. int nModeId;
  298. float fExpTime;
  299. };
  300. //Reference status and expiration duration (unit: minute) of special application mode
  301. struct CR_RefStatusInfo
  302. {
  303. int nDarkStatus;
  304. int nGainStatus;
  305. int nDefectStatus;
  306. int nDarkMinsLeft;
  307. int nGainMinsLeft;
  308. int nDefectMinsLeft;
  309. };
  310. //start-by-ts.wang
  311. /*
  312. * Structure used to read detector file header
  313. *
  314. */
  315. struct CR_RAD_DetectorFileHeader
  316. {
  317. char szTypeCode[8];
  318. int nImageSize;
  319. int nImgxSize;
  320. int nImgySize;
  321. int nPixelBits;
  322. int nCompressType;
  323. int nFrameNum;
  324. int nCorrectWay;
  325. int nCorrectPara;
  326. int nIsolatedPixels;
  327. int nIsolatedPixelspos;
  328. int nHoribadlines;
  329. int nHoribadlinespos;
  330. int nVertbadlines;
  331. int nVertbadlinespos;
  332. int nClusterpixels;
  333. int nClusterpixelspos;
  334. };
  335. struct CR_RAD_DetectorInfoHeader
  336. {
  337. int nStartflag;
  338. int nEndiantype;
  339. char szDttVersion[32];
  340. int nDttType;
  341. int nDttNum;
  342. int nModeID;
  343. int nImgProp;
  344. char szBuildTime[24];
  345. float fVbias;// 4 bytes float
  346. float fVcmp;// 4 bytes floatdynam_range
  347. float fVtftOn;// 4 bytes float
  348. float fVtftOff;// 4 bytes float
  349. float fDynamRange;
  350. float fPgaDac;
  351. float fExpTime;
  352. float fDelayTime;
  353. float fWaitTime;
  354. float fTempLT;
  355. float fTempRT;
  356. float fTempLB;
  357. float fTempRB;
  358. float fTempM;
  359. float szReserver11[3];
  360. char szMachineID[32];
  361. float Reserved12[49];
  362. int rgFpgaRegVersion[4];
  363. int nBuildDate;
  364. int nRes000;
  365. int nIntRegCopy;
  366. int nIntMask;
  367. int nExpControl;
  368. int nFpgaStatus;
  369. int nCycleCount;
  370. int nAdcRsl;
  371. int rgRes024[15];
  372. float fFpgaDynamRange;
  373. float fFpgaPgaDac;
  374. float fFpgaPgaDacControl;
  375. float fFpgaVbias;
  376. float fFpgaVcmp;
  377. float fFpgaVtftOn;
  378. float fFpgaVtftOff;
  379. float fFpgaExpTime;
  380. int nRes084;
  381. float fFpgaDelayTime;
  382. int nRes08c;
  383. float fFpgaWaitTime;
  384. int nRes094;
  385. int nPixelNum;
  386. int nLineNum;
  387. int nReadoutCnt;
  388. int nScanLine;
  389. int rgRes0a8[2];
  390. int nXStart;
  391. int nXEnd;
  392. int nYStart;
  393. int nYEnd;
  394. int rgRes0c0[16];
  395. int nFifoMax;
  396. int nFifoThrsh;
  397. int nFifoCount;
  398. int nEndflag;
  399. };
  400. typedef struct CR_ActiveAreaInfo
  401. {
  402. int nX;
  403. int nY;
  404. int nWidth;
  405. int nHeight;
  406. float fWeight;
  407. }CR_ActiveAreaInfo;
  408. struct CR_BatteryInfo
  409. {
  410. unsigned char uId; // battery id
  411. unsigned char uAccessible; // is battery accessible
  412. unsigned short uRemainingCapacity; // unit: mAh
  413. unsigned short uFullCapacity; // unit: mAh
  414. unsigned short uVoltage; // unit: mV
  415. short nCurrent; // unit: mA
  416. unsigned short uChargingCurrent; // unit: mA
  417. unsigned short uRunTimeToEmpty; // unit: min
  418. unsigned short uAvgTimeToEmpty; // unit: min
  419. unsigned short uAvgTimeToFull; // unit: min
  420. unsigned short uCycleCount; // unit: cycles
  421. unsigned short uTemperature; // unit: 0.1K
  422. unsigned short uRelativeStateOfCharge; // relative capacity, unit: %
  423. unsigned short uAbsoluteStateOfCharge; // relative capacity, unit: %
  424. unsigned short rgReserved[7];
  425. };
  426. typedef struct CR_WirelessStatus
  427. {
  428. char szEssid[32];
  429. char szPasswd[32];
  430. char szProtocol[16];
  431. char szDesc[32];
  432. int nMode;
  433. int nChannel;
  434. double fFrequency;
  435. int nBitRate;
  436. int nStatus;
  437. int nQuality;
  438. int nLevel;
  439. int nNoise;
  440. unsigned int uIpv4;
  441. int nFactoryFlag;
  442. }CR_WirelessStatus;
  443. // worklist structures
  444. struct CR_CheckInfo
  445. {
  446. char szId[128];
  447. char szBodyPartId[32];
  448. char szSeriesTime[32];
  449. };
  450. struct CR_BodyPartInfo
  451. {
  452. char szId[32];
  453. char szPartName[32];
  454. };
  455. struct CR_Examination
  456. {
  457. char szId[16];
  458. char szChecklistNumber[64];
  459. char szPatientId[64];
  460. char szPatientName[64];
  461. char szPatientSex[8];
  462. char szPatientAge[4];
  463. int nBodyPartNum;
  464. int nCheckInfoNum;
  465. CR_BodyPartInfo rgBodyPart[16];
  466. CR_CheckInfo rgCheckInfos[32];
  467. };
  468. #define DTT_INFO_HEADER_OFFSET 16384
  469. #define PCI_IMG_HEAD_OFFSET 32768
  470. //end-by-ts.wang
  471. //typedef void(*CR_CallbackFunPtr)(int, CR_Event *);
  472. }
  473. #endif