CrStructure.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. #ifndef __CR_STRUCTURE_H__
  2. #define __CR_STRUCTURE_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //*****************************************************************************************
  7. // enum starts here.
  8. //*****************************************************************************************
  9. namespace CareRay
  10. {
  11. enum CrModeId
  12. {
  13. CR_RAD_MODE_ID = 16,
  14. CR_DAEC_MODE_ID = 18,
  15. CR_DAEC_FLIP_MODE_ID = 19,
  16. };
  17. enum CrTrigType
  18. {
  19. CR_RAD_EXT_SYNC = 0x01,
  20. CR_RAD_SOFT_SYNC = 0x02,
  21. CR_RAD_AUTO_SYNC = 0x03,
  22. CR_RAD_MANUAL_SYNC = 0x04,
  23. CR_RAD_AED_SYNC = 0x05,
  24. CR_RAD_DAEC_SYNC = 0x06,
  25. CR_RAD_DAEC_FLIP_SYNC = 0x07,
  26. CR_FLUORO_EXT_SYNC = 0x08,
  27. CR_FLUORO_INT_SYNC = 0x09,
  28. };
  29. enum CrGainLevel
  30. {
  31. CR_G0 = 0,
  32. CR_G1 = 1,
  33. CR_G2 = 2,
  34. CR_G3 = 3,
  35. CR_G4 = 4,
  36. CR_G5 = 5,
  37. CR_G6 = 6,
  38. CR_G7 = 7,
  39. };
  40. enum CrPowerModeId
  41. {
  42. CR_PWR_STANDBY = 0, //set front-end into nap mode
  43. CR_PWR_FULL_RUNNING = 1, //set front-end into normal mode.
  44. CR_PWR_SMART_RUNNING = 2, //set front-end into nap mode at the integration phase.
  45. CR_PWR_DOWN_FE = 4, //set front-end into power-down mode.
  46. CR_PWR_SLEEPING = 5,
  47. CR_PWR_DEEP_SLEEPING = 6,
  48. CR_PWR_SUSPEND = 7, // power down
  49. };
  50. enum CrEventId
  51. {
  52. CR_EVT_SERVER_DISCONNECTED,
  53. CR_EVT_DETR_DISCONNECTED,
  54. CR_EVT_EXPOSURE_INFO,
  55. CR_EVT_TEMPERATURE_INFO,
  56. CR_EVT_BATTERY_INFO,
  57. CR_EVT_WIRELESS_INFO,
  58. CR_EVT_NEW_FRAME,
  59. CR_EVT_CALIBRATION_IN_PROGRESS,
  60. CR_EVT_CALIBRATION_FINISHED,
  61. CR_EVT_NEW_SPOT_FILM,
  62. CR_EVT_ACQ_STAT_INFO,
  63. CR_EVT_RAD_ACQ_IN_PROGRESS,
  64. CR_EVT_SERVER_RECONNECTED,
  65. CR_EVT_DETR_RECONNECTED,
  66. CR_EVT_IMAGE_QUEUE_BLOCKED,
  67. CR_EVT_DISCARD_FRAME,
  68. CR_EVE_USAGE_INFO,
  69. CR_EVT_POSITION
  70. };
  71. enum CrExpStatus
  72. {
  73. CR_EXP_ERROR = -1,
  74. CR_EXP_INIT,
  75. CR_EXP_READY,
  76. CR_EXP_WAIT_PERMISSION,
  77. CR_EXP_PERMITTED,
  78. CR_EXP_EXPOSE,
  79. CR_EXP_COMPLETE,
  80. };
  81. enum CrReturnCodeType
  82. {
  83. CR_INFOR = 1,
  84. CR_WARN,
  85. CR_ERROR,
  86. CR_FATALERROR
  87. };
  88. enum CrCalFileType
  89. {
  90. CR_OFFSET_FILE = 0,
  91. CR_GAIN_FILE = 1,
  92. CR_DEFECT_FILE = 2
  93. };
  94. enum CrRefStatus
  95. {
  96. CR_REF_NOT_FOUND,
  97. CR_REF_VALID,
  98. CR_REF_ABOUT_TO_EXPIRE,
  99. CR_REF_INVALID
  100. };
  101. enum CrCalibFilterMethod
  102. {
  103. CR_CALIB_FILTER_BASE,
  104. CR_CALIB_FILTER_MEAN,
  105. CR_CALIB_FILTER_BOUNDARY
  106. };
  107. /*****************************************************************************************
  108. *****************************************************************************************/
  109. enum CrProcChainOpt
  110. {
  111. CR_PROCCHAIN_SANITYCHECK = 0x01,
  112. CR_PROCCHAIN_DARKCORR = 0x02,
  113. CR_PROCCHAIN_GAINCORR = 0x04,
  114. CR_PROCCHAIN_DEFECTCORR = 0x08,
  115. CR_PROCCHAIN_LAGCORR = 0x10,
  116. CR_PROCCHAIN_IMGCROPPING = 0x20,
  117. CR_PROCCHAIN_RTPIXELCORR = 0x40,
  118. CR_PROCCHAIN_DENOISING = 0x80,
  119. CR_PROCCHAIN_STEPSUPPRESS = 0x100,
  120. CR_PROCCHAIN_ROTATE_IAMGE = 0x200,
  121. CR_PROCCHAIN_GAUSSFILTER = 0x80000000
  122. };
  123. enum CrProcChainId
  124. {
  125. CR_PROCCHAINID_FLUOROSCOPY = 1,
  126. CR_PROCCHAINID_RADIOGRAPHY = 2
  127. };
  128. enum CrConnectionDeviceType
  129. {
  130. CR_WIRELESS_DEVICE,
  131. CR_WIRED_DEVICE
  132. };
  133. enum CrConnectionMethodType
  134. {
  135. CR_WIRELESS_MANUAL_IP,
  136. CR_WIRELESS_DHCP,
  137. CR_WIRELESS_AP,
  138. CR_WIRED_MANUAL_IP,
  139. CR_WIRED_DHCP_SERVER,
  140. CR_WIRED_DHCP_CLIENT,
  141. CR_STANDALONE
  142. };
  143. //*****************************************************************************************
  144. // struct starts here.
  145. //*****************************************************************************************
  146. typedef struct CrSystemInfo
  147. {
  148. unsigned int raw_img_width;
  149. unsigned int raw_img_height;
  150. unsigned int frame_header_len;
  151. char hardware_version[64];
  152. char serial_number[64];
  153. char software_version[64];
  154. char firmware_version[64];
  155. char detr_machine_id[64];
  156. char detr_desc[128];
  157. char reserved[512];
  158. }CrSystemInfo;
  159. typedef struct CrDefectInfo
  160. {
  161. unsigned int bad_pixel_num;
  162. unsigned int bad_raw_num;
  163. unsigned int bad_col_num;
  164. unsigned short *bad_pixel;
  165. unsigned short *bad_row;
  166. unsigned short *bad_col;
  167. }CrDefectInfo;
  168. typedef struct CrConnectionStatus
  169. {
  170. int server_connection_status;
  171. int detr_connection_status;
  172. }CrConnectionStatus;
  173. typedef struct CrTemperature
  174. {
  175. float min;
  176. float cpu;
  177. float wired_network;
  178. float reserved;
  179. float current;
  180. float max;
  181. float avg;
  182. int overheat;
  183. }CrTemperature;
  184. typedef struct CrDetrStatus
  185. {
  186. CrTemperature detr_temperature;
  187. }CrDetrStatus;
  188. typedef struct CrDetrIdxAndIPAddr
  189. {
  190. int index;
  191. char ip_addr[64];
  192. int device_type;
  193. char reserved[124];
  194. }CrDetrIdxAndIPAddr;
  195. typedef struct CrRegAttrInfo
  196. {
  197. int is_writable;
  198. int is_float_type;
  199. unsigned int int_value;
  200. float float_value;
  201. char property_name[32];
  202. }CrRegAttrInfo;
  203. typedef struct CrModeInfo
  204. {
  205. int mode_id;
  206. int image_width; // ROI dimension along x direction after binning
  207. int image_height; // ROI dimension along y direction after binning
  208. int cutoff_x; // number of cut-off lines (along x direction) from left after binning
  209. int cutoff_y; // number of cut-off lines (along y direction) from top after binning
  210. int bin_x; // binning scheme along x direction
  211. int bin_y; // binning scheme along y direction
  212. float max_frame_rate; // in Hz
  213. float max_exposure_time; // in ms
  214. int pixel_depth; // bit depth of each pixel sending out from detector
  215. int trigger_types[16];
  216. int valid_trigger_type_num;
  217. int gain_levels[16];
  218. int valid_gain_num;
  219. int default_trigger_type;
  220. int default_gain_level;
  221. int roi_x; // x coordinate of top left point after binning
  222. int roi_y; // y coordinate of top left point after binning
  223. int mode_conf;
  224. char desc[256]; // description of this mode
  225. }CrModeInfo;
  226. typedef struct CrExtendModeInfo
  227. {
  228. float readout_time;
  229. int block_length;
  230. int bin_mode;
  231. int roi_type;
  232. int acquire_type;
  233. unsigned char cut_low_bits[16];
  234. unsigned char cut_high_bits[16];
  235. }CrExtendModeInfo;
  236. typedef struct CrCalibrationInfo
  237. {
  238. int total_frame_num;
  239. int current_frame_num;
  240. int current_frame_mean;
  241. char error_msg[256];
  242. int result;
  243. int exposure_status;
  244. int target_gray_value;
  245. }CrCalibrationInfo;
  246. typedef struct CrConfItemInfo
  247. {
  248. int id;
  249. char name[64];
  250. char module[32];
  251. char value[128];
  252. char default_value[128];
  253. char regex[256];
  254. int permission;
  255. char desc[256];
  256. char desc_zh[256];
  257. int need_reboot;
  258. }CrConfItemInfo;
  259. typedef struct CrProcessModule
  260. {
  261. int module_id;
  262. int order_id;
  263. char name[64];
  264. int is_enabled;
  265. int default_enabled;
  266. int is_auto_save;
  267. int update_policy;
  268. }CrProcessModule;
  269. typedef struct CrProcessChain
  270. {
  271. int chain_id;
  272. int valid_module_num;
  273. CrProcessModule modules[16];
  274. }CrProcessChain;
  275. typedef struct CrEvent
  276. {
  277. int event_id;
  278. int detr_index;
  279. int width;
  280. int height;
  281. int pixel_depth;
  282. int header_len;
  283. void* data;
  284. }CrEvent;
  285. typedef struct CrAcquisitionStatInfo
  286. {
  287. int total_frame_num;
  288. int lost_frame_num;
  289. float frame_rate;
  290. float transmission_speed;
  291. long long duration_milliseconds;
  292. float fpga_frame_rate;
  293. }CrAcquisitionStatInfo;
  294. // Image quality statistics
  295. typedef struct CrSQualityStatistics
  296. {
  297. // Passed type count
  298. int quality_passed_count;
  299. // Failed type count
  300. int quality_failed_count;
  301. }CrSQualityStatistics;
  302. typedef struct CrExpProgress
  303. {
  304. int exposure_status;
  305. int is_fetchable;
  306. int result;
  307. }CrExpProgress;
  308. typedef struct CrAedExpProgress
  309. {
  310. CrExpProgress progress;
  311. float aed_elapsed_time_since_last_readout;
  312. float aed_refresh_interval;
  313. }CrAedExpProgress;
  314. typedef struct CrCalibFileInfo
  315. {
  316. int calib_type;
  317. float frame_rate;
  318. int gain_id;
  319. float temperature;
  320. int status;
  321. int trigger_type;
  322. char mode_name[256];
  323. char datetime[64];
  324. char expire_time[64];
  325. int mode_id;
  326. float exposure_time;
  327. int term_of_valid_in_min;
  328. int app_mode_key;
  329. }CrCalibFileInfo;
  330. //Reference status and expiration duration (unit: minute) of special application mode
  331. typedef struct CrRefStatusInfo
  332. {
  333. int dark_status;
  334. int gain_status;
  335. int defect_status;
  336. int dark_left_minutes;
  337. int gain_left_minutes;
  338. int defect_left_minutes;
  339. }CrRefStatusInfo;
  340. typedef struct CrRadDetrFileHeader
  341. {
  342. char type_code[8];
  343. int image_size;
  344. int img_x_size;
  345. int img_y_size;
  346. int pixel_depth;
  347. int compress_type;
  348. int frame_num;
  349. int correct_way;
  350. int correct_para;
  351. int isolated_pixels;
  352. int isolated_pixels_pos;
  353. int hori_bad_lines;
  354. int hori_bad_lines_pos;
  355. int vert_bad_lines;
  356. int vert_bad_lines_pos;
  357. int cluster_pixels;
  358. int cluster_pixels_pos;
  359. }CrRadDetrFileHeader;
  360. typedef struct CrRadDetrInfoHeader
  361. {
  362. int start_flag;
  363. int endian_type;
  364. char dttver[32];
  365. int dtt_type;
  366. int dtt_num;
  367. int mode_id;
  368. int img_prop;
  369. char build_time[24];
  370. float vbias;// 4 bytes float
  371. float vcmp;// 4 bytes floatdynam_range
  372. float vtft_on;// 4 bytes float
  373. float vtft_off;// 4 bytes float
  374. float dynam_range;
  375. float pga_dac;
  376. float expos_time;
  377. float delay_time;
  378. float wait_time;
  379. float temp_lt;
  380. float temp_rt;
  381. float temp_lb;
  382. float temp_rb;
  383. float temp_m;
  384. float reserved11[3];
  385. char machine_id[32];
  386. float reserved12[49];
  387. int fpga_reg_version[4];
  388. int build_date;
  389. int res000;
  390. int int_reg_copy;
  391. int int_mask;
  392. int expos_control;
  393. int fpga_status;
  394. int cycle_count;
  395. int adc_rsl;
  396. int res024[15];
  397. float fpga_dynam_range;
  398. float fpga_pga_dac;
  399. float fpga_pga_dac_control;
  400. float fpga_vbias;
  401. float fpga_vcmp;
  402. float fpga_vtft_on;
  403. float fpga_vtft_off;
  404. float fpga_expos_time;
  405. int res084;
  406. float fpga_delay_time;
  407. int res08c;
  408. float fpga_wait_time;
  409. int res094;
  410. int pixel_num;
  411. int line_num;
  412. int readout_cntr;
  413. int scan_line;
  414. int res0a8[2];
  415. int x_start;
  416. int x_end;
  417. int y_start;
  418. int y_end;
  419. int res0c0[16];
  420. int fifo_max;
  421. int fifo_thrsh;
  422. int fifo_count;
  423. int end_flag;
  424. }CrRadDetrInfoHeader;
  425. typedef struct CrRegisterModeInfo
  426. {
  427. int app_mode_key;
  428. int mode_id;
  429. float frame_rate;
  430. float exposure_time;
  431. int trigger_type;
  432. int gain_level;
  433. int row_index;
  434. int mode_type; // 0 : fluoro, 1 : rad
  435. int frame_filter_len;
  436. char *frame_filter;
  437. unsigned char decode_strategy_type;
  438. int column_index;
  439. }CrRegModeInfo;
  440. typedef struct CrDaecAreaInfo
  441. {
  442. int x;
  443. int y;
  444. int width;
  445. int height;
  446. float weight;
  447. }CrDaecAreaInfo;
  448. typedef struct CrUsageInfo
  449. {
  450. // summary cpu part
  451. unsigned int total_processors_num;
  452. unsigned int enable_processors_num;
  453. unsigned int user_time;
  454. unsigned int system_time;
  455. unsigned int nice_time;
  456. unsigned int idle_time;
  457. unsigned int iowait_time;
  458. unsigned int irq_time;
  459. unsigned int softirq_time;
  460. // summary memory, unit:KB
  461. unsigned int total_ram;
  462. unsigned int free_ram;
  463. unsigned int buffer_ram;
  464. unsigned int cached_ram;
  465. unsigned int slab_reclaimable;
  466. unsigned int slab_unreclaim;
  467. unsigned int shared_ram;
  468. unsigned int avail_ram;
  469. unsigned int total_swap;
  470. unsigned int free_swap;
  471. // process title
  472. int pid;
  473. char name[64];
  474. int nice;
  475. unsigned int threads_num;
  476. // process cpu part
  477. unsigned int user_ticks;
  478. unsigned int system_ticks;
  479. unsigned int total_ticks;
  480. // process memory, unit:KB
  481. unsigned int virtual_size;
  482. unsigned int rss;
  483. // process disk, unit:MB
  484. unsigned int total_size;
  485. unsigned int free_size;
  486. unsigned int avail_size;
  487. }CrProcStat;
  488. typedef struct CrTemperatureTrainHeader
  489. {
  490. float temperature;
  491. int integration_time;
  492. long generated_time;
  493. int trigger_line;
  494. int data_num;
  495. int reserved[3];
  496. }CrTemperatureTrainHeader;
  497. typedef struct CrTemperatureTrainInfo
  498. {
  499. CrTemperatureTrainHeader train_header;
  500. float* train_data;
  501. }CrTemperatureTrainInfo;
  502. typedef struct CrTemperatureTrainSlotMsg
  503. {
  504. int detector_id;
  505. int slot_exp_time;
  506. float slot_temperature;
  507. }CrTemperatureTrainSlotMsg;
  508. typedef struct CrMagStat
  509. {
  510. int mag_index;
  511. float x;
  512. float y;
  513. float z;
  514. }CrMagStat;
  515. typedef struct CrGyroStat
  516. {
  517. float alpha;
  518. float beta;
  519. float gamma;
  520. float x;
  521. float y;
  522. float z;
  523. }CrGyroStat;
  524. typedef struct CrPositionInfo
  525. {
  526. long long timestamp;
  527. CrMagStat mag_sensors[4];
  528. CrGyroStat gyro;
  529. }CrPositionInfo;
  530. typedef struct CrDropInfo
  531. {
  532. long long seconds;
  533. float acceleration;
  534. }CrDropInfo;
  535. typedef struct CrCheckInfo
  536. {
  537. char id[128];
  538. char body_part_id[32];
  539. char series_time[32];
  540. }CrCheckInfo;
  541. typedef struct CrBodyPartInfo
  542. {
  543. char id[32];
  544. char part_name[32];
  545. }CrBodyPartInfo;
  546. typedef struct CrExamination
  547. {
  548. char id[16];
  549. char checklist_number[64];
  550. char patient_id[64];
  551. char patient_name[64];
  552. char patient_sex[8];
  553. char patient_age[4];
  554. int body_part_num;
  555. int check_info_num;
  556. CrBodyPartInfo body_parts[16];
  557. CrCheckInfo check_infos[32];
  558. }CrExamination;
  559. typedef struct CrBatteryInfo
  560. {
  561. unsigned char id; //battery id
  562. unsigned char accessible; //is battery accessible
  563. unsigned short remaining_capacity; //unit: mAh
  564. unsigned short full_capacity; //unit: mAh
  565. unsigned short voltage; //unit: mV
  566. short current; //unit: mA
  567. unsigned short charging_current; //unit: mA
  568. unsigned short run_time_to_empty; //unit: min
  569. unsigned short avg_time_to_empty; //unit: min
  570. unsigned short avg_time_to_full; //unit: min
  571. unsigned short cycle_count; //unit: cycles
  572. unsigned short temperature; //unit: 0.1K
  573. unsigned short relative_state_of_charge;//relative capacity, unit: %
  574. unsigned short absolute_state_of_charge;//relative capacity, unit: %
  575. unsigned short reserved[7];
  576. }CrBatteryInfo;
  577. typedef struct CrWirelessStatus
  578. {
  579. char essid[32];
  580. char passwd[32];
  581. char protocol[16];
  582. char desc[32];
  583. int mode;
  584. int channel;
  585. double frequency;
  586. int bit_rate;
  587. int status;
  588. int quality;
  589. int level;
  590. int noise;
  591. unsigned int ipv4;
  592. int factory_flag;
  593. }CrWirelessStatus;
  594. #define FLUORO_MODE_TYPE 0
  595. #define RAD_MODE_TYPE 1
  596. #define DTT_INFO_HEADER_OFFSET 16384
  597. #define PCI_IMG_HEAD_OFFSET 32768
  598. typedef void (* CrCallbackFunPtr)(int, CrEvent *);
  599. #ifdef __cplusplus
  600. }
  601. #endif
  602. }
  603. #endif