| 1 |
/*[- HEADER FILE -------------------------------------------------------------------------*/ |
| 2 |
/* |
| 3 |
Name: ds_transformation.h |
| 4 |
|
| 5 |
Description: The header file defines the common types, constants and macros for the |
| 6 |
data set library. |
| 7 |
|
| 8 |
|
| 9 |
Author: THUMSER, Andreas (TH); Siemens AG UBMed CMS/SCE64; phone: 09131 844797 |
| 10 |
*/ |
| 11 |
/*]-----------------------------------------------------------------------------------------*/ |
| 12 |
|
| 13 |
#ifndef DS_TRANSFORMATION |
| 14 |
#define DS_TRANSFORMATION |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
/*== VERSION CONTROL ====================================================================*/ |
| 19 |
/* PRECOMPILER: define version control contants */ |
| 20 |
/* NOTE: versions */ |
| 21 |
/* |
| 22 |
The following list shows the used version codes in chronological order: |
| 23 |
|
| 24 |
Date | Doc DS IH ACR SPI notes |
| 25 |
-------------+---------------------------------------------------------------- |
| 26 |
1989-JUL-03 | V0.2 - - 1.0 01.00 |
| 27 |
1990-MAR-10 | V1.1 - VA1 2.0 01.00 |
| 28 |
1990-MAR-12 | V1.1 V1.2 VA1 2.0 01.00 |
| 29 |
1990-APR-27 | V1.3 V1.3 VA3 2.0 01.00 internal version |
| 30 |
1990-AUG-01 | V1.4 V1.4 VA4 2.0 01.00 |
| 31 |
1990-OCT-01 | V1.5 V1.5 VA5 2.0 01.00 |
| 32 |
1990-OCT-11 | V1.5 V1.51 VA5 2.0 01.00 M 15 |
| 33 |
1990-OCT-15 | V1.5 V1.52 VA5 2.0 01.00 M 13, M19 |
| 34 |
1990-NOV-16 | V1.5 V1.53 VA53 2.0 01.00 parts of M16 |
| 35 |
1990-NOV-23 | V1.5 V1.54 VA53 2.0 01.00 M 28 |
| 36 |
1990-DEC-07 | V1.5 V1.55 VA55 2.0 01.00 M31, parts of M16, M30 |
| 37 |
1991-JAN-31 | V2.0 V2.0 VB 2.0 01.00 M*, som, num2, ... |
| 38 |
1991-FEB-19 | V2.0 V2.1 VB 2.0 01.00 M 40 |
| 39 |
1991-FEB-28 | V2.0 V2.2 VB2 2.0 01.00 M 38, M 39, M 40, M 45 |
| 40 |
1991-MAR-14 | V2.0 V2.3 VB2 2.0 01.00 M 41, M 48 |
| 41 |
1991-MAR-28 | V2.0 V2.4 VB2 2.0 01.00 M*, som, num2, ... |
| 42 |
1991-APR-17 | V2.0 V2.5 VB3 2.0 01.00 M* |
| 43 |
1991-MAY-23 | V2.0 V2.6 VB4 2.0 01.00 parts of M49 |
| 44 |
1991-JUL-31 | V2.0 V2.7 VB5 2.0 01.00 M*, db_set, num1, ... |
| 45 |
1991-AUG-08 | V2.0 V2.8 VB5 2.0 01.00 M 65 |
| 46 |
1991-SEP-12 | V2.0 V2.9 VB5 2.0 01.00 Image Text: M80, 73, 66, 64, 60, 59 |
| 47 |
1991-OCT-10 | V2.0 V2.10 VB5 2.0 01.00 M 86 |
| 48 |
1991-NOV | V3.0 V3.0 VB6 2.0 01.00 M*, som0 |
| 49 |
|
| 50 |
|
| 51 |
labels: |
| 52 |
------- |
| 53 |
Doc Documentation Version ("Phone Book" Version) |
| 54 |
DS Data Set Library (Software) Version |
| 55 |
IH Internal Header Version |
| 56 |
ACR NEMA Standard Version |
| 57 |
SPI SPI Standard Version |
| 58 |
*/ |
| 59 |
|
| 60 |
/* version strings */ |
| 61 |
/* NOTE: Software Version String */ |
| 62 |
/* The constant "DS_SOFTWARE_VERSION_STRING" is not longer supported. The software |
| 63 |
version is set in this and future software releases in data set library function |
| 64 |
"ds_info_get_software_version" directly. In this way several modul compilations |
| 65 |
after changing this common used data set library header file are avoided. */ |
| 66 |
|
| 67 |
/* constant definition */ |
| 68 |
#define HEADER_VERSION_STRING "VB6 " |
| 69 |
#define RECOGNITION_CODE_STRING "ACR-NEMA 2.0" |
| 70 |
#define SPI_VERSION_STRING "SPI VERSION 01.00 " |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
/*== CONSTANTS ==========================================================================*/ |
| 75 |
|
| 76 |
/* PRECOMPILER: define common non-numeric constants */ |
| 77 |
|
| 78 |
/* logical constants */ |
| 79 |
#ifndef TRUE |
| 80 |
#define TRUE 1 |
| 81 |
#endif |
| 82 |
|
| 83 |
#ifndef FALSE |
| 84 |
#define FALSE 0 |
| 85 |
#endif |
| 86 |
|
| 87 |
|
| 88 |
/* common status file constants */ |
| 89 |
#define DS_STATUS_FILE_TYPE struct STC_COMMON |
| 90 |
|
| 91 |
|
| 92 |
/* common nil pointer constants */ |
| 93 |
#define DS_CHAR_NIL ((char *) 0) |
| 94 |
#define DS_DOUBLE_NIL ((double *) 0) |
| 95 |
#define DS_INT_NIL ((int *) 0) |
| 96 |
#define DS_LONG_NIL ((long *) 0) |
| 97 |
#define DS_SHORT_NIL ((short *) 0) |
| 98 |
#define DS_STATUS_FILE_NIL ((DS_STATUS_FILE_TYPE *) 0) |
| 99 |
#define DS_VOID_NIL ((void *) 0) |
| 100 |
|
| 101 |
|
| 102 |
/* PRECOMPILER: define status area element codes */ |
| 103 |
/* NOTE: list of status abbreviations */ |
| 104 |
/* |
| 105 |
PRE == PREparation of item value e.g. adapt, collect information |
| 106 |
KEY == build up item KEY |
| 107 |
BUF == transfere item value into nema data set BUFfer |
| 108 |
SEP == SEParation of item from nema data set buffer |
| 109 |
SET == SET back item value for internal use |
| 110 |
POS == POSition item value into interanl header e.g. split, convert information |
| 111 |
CH1 == Check a first parameter |
| 112 |
CH2 == Check a second parameter |
| 113 |
*/ |
| 114 |
|
| 115 |
/* error handling constants */ |
| 116 |
#define PRE 0 |
| 117 |
#define KEY 1 |
| 118 |
#define BUF 2 |
| 119 |
#define SEP 0 |
| 120 |
#define SET 1 |
| 121 |
#define POS 2 |
| 122 |
#define CH1 0 |
| 123 |
#define CH2 1 |
| 124 |
|
| 125 |
|
| 126 |
/* sign constants */ |
| 127 |
#define DELIMITER_DS_SIGN '\\' |
| 128 |
#define INITALIZE_DS_SIGN ' ' |
| 129 |
#define NON_PRINT_ABLE_DS_SIGN '~' |
| 130 |
#define OVERLAY_DS_SIGN '/' |
| 131 |
#define PADDING_DS_SIGN ' ' |
| 132 |
#define UNDEFINED_TEXT_DS_SIGN ' ' |
| 133 |
|
| 134 |
|
| 135 |
/* string constants */ |
| 136 |
#define IMAGE_GRAPHIC_FORMAT_CMS "CMS " |
| 137 |
|
| 138 |
|
| 139 |
/* end-of constants */ |
| 140 |
#define EOAL (-19223) |
| 141 |
#define END_OF_DATA_SET (-19224) |
| 142 |
|
| 143 |
|
| 144 |
/* coordinate system constants */ |
| 145 |
#define AAA 0 |
| 146 |
#define BBB 1 |
| 147 |
#define CCC 2 |
| 148 |
#define XXX 0 |
| 149 |
#define YYY 1 |
| 150 |
#define ZZZ 2 |
| 151 |
#define SAG 0 |
| 152 |
#define COR 1 |
| 153 |
#define TRA 2 |
| 154 |
#define ROW 0 |
| 155 |
#define COLUMN 1 |
| 156 |
#define DOWN 0 |
| 157 |
#define RIGHT 1 |
| 158 |
|
| 159 |
|
| 160 |
/* common numeric contants */ |
| 161 |
#define DS_DO_NOT_FILL (-1L) |
| 162 |
#define DS_MAX_CHAR (256 + 1) |
| 163 |
#define DS_SAVE_FACTOR (4096) |
| 164 |
#define DS_UID_SIZE (26) |
| 165 |
#define DS_WORK_CHAR (32 + 1) |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
/*== RUNTIME CONTROL ====================================================================*/ |
| 170 |
|
| 171 |
/* PRECOMPILER: define debug constants */ |
| 172 |
|
| 173 |
/* NOTE: debug constants */ |
| 174 |
/* |
| 175 |
The constant 'DEBUGGING_BY_THUMSER' is used to compile or not compile C-source code |
| 176 |
for debugging. If you change the '#undef'-command in a '#define'-command all parts |
| 177 |
with debug code are compiled. This is usefull to activate calls of function printf() |
| 178 |
etc. |
| 179 |
|
| 180 |
The macro 'DS_ERROR_CONDITION' controls the call of function ds_initiate_error_handling(). |
| 181 |
During normal run time this macro is defined in a matter, that only if a error |
| 182 |
or warning raised the function "ds_initiate_error_handling()" will be actived. If the |
| 183 |
debug switch 'DEBUGGING_BY_THUMSER' is defined for every item a message is printed to |
| 184 |
standard output device. Note that in this case the interface status is not updated |
| 185 |
correctly. Please use the shown messages to anlyse the item transformation |
| 186 |
results. |
| 187 |
|
| 188 |
*/ |
| 189 |
#undef DEBUGGING_BY_THUMSER |
| 190 |
|
| 191 |
#ifndef DEBUGGING_BY_THUMSER |
| 192 |
#define DS_ERROR_CONDITION (!(StatusList[0] & 0x0001) || \ |
| 193 |
!(StatusList[1] & 0x0001) || \ |
| 194 |
!(StatusList[2] & 0x0001)) |
| 195 |
#else |
| 196 |
#define DS_ERROR_CONDITION TRUE |
| 197 |
#endif |
| 198 |
|
| 199 |
|
| 200 |
#define ds_initiate_error_handling(Group, Element, Error, Status, Return) \ |
| 201 |
ds_init_error_handling(__FILE__, __LINE__, Group, Element, Error, Status, Return) |
| 202 |
|
| 203 |
|
| 204 |
/*-----------------------------------------------------------------------------------------*/ |
| 205 |
|
| 206 |
|
| 207 |
/* PRECOMPILER: define interacive constants */ |
| 208 |
|
| 209 |
/* NOTE: interacive constants */ |
| 210 |
/* The constant 'DS_INTERACTIVE' is used to compile or not compile C-source code for a |
| 211 |
interactive use of separation functions. If you change the '#undef'-command in a |
| 212 |
'#define'-command all parts with interactive code are compiled. */ |
| 213 |
#undef DS_INTERACTIVE |
| 214 |
/*-----------------------------------------------------------------------------------------*/ |
| 215 |
|
| 216 |
|
| 217 |
/* PRECOMPILER: define Exception Handler */ |
| 218 |
|
| 219 |
/* NOTE: Exception Handler */ |
| 220 |
/* Three makros are implemented to raise the exception handler. You can choise one for your |
| 221 |
current work by precompiler statement #define and #undefine, respectively. |
| 222 |
|
| 223 |
|
| 224 |
DS_RAISE_NORMAL |
| 225 |
The raise is done with a goto statement. Only to raise an exception handler the goto |
| 226 |
statement is used in data set library software. No other actions will be done. |
| 227 |
|
| 228 |
|
| 229 |
DS_RAISE_TRACE |
| 230 |
The raise is done with a goto statement also, but before flow control goes to the raised |
| 231 |
exception handler a printf() call is done. The following text is printed: |
| 232 |
|
| 233 |
"<file>", line <line number>: raise ==> <status> |
| 234 |
|
| 235 |
The print out of this message can be controlled by file '/tmp/ds_trace_on'. If the file |
| 236 |
exist the print out is done otherwise nothing is done. In this manner the switch can be |
| 237 |
done during runtime without new compilation or process restart. |
| 238 |
|
| 239 |
If 'DS_RAISE_TRACE' defined an item trace is possible too. For more information about |
| 240 |
this topic see description of function 'ds_finally_interface_status_update()' in modul |
| 241 |
'ds_mixed.c'. |
| 242 |
|
| 243 |
|
| 244 |
DS_RAISE_DBX |
| 245 |
The raise is done with a goto statement also, but before flow control goes to the raised |
| 246 |
exception handler a ds_stop_dbx() is done. This function has no other function than to |
| 247 |
stop point for debugger. Use during a dbx session the command 'stop in ds_stop_dbx'. |
| 248 |
The debugger stops program execution everytime a exception is raised. A check of current |
| 249 |
active parameters is now possible. |
| 250 |
*/ |
| 251 |
#undef DS_RAISE_NORMAL |
| 252 |
#define DS_RAISE_TRACE |
| 253 |
#undef DS_RAISE_DBX |
| 254 |
|
| 255 |
#ifdef DS_RAISE_NORMAL |
| 256 |
#define DS_RAISE_EXCEPTION(x) goto x |
| 257 |
#endif |
| 258 |
|
| 259 |
|
| 260 |
#ifdef DS_RAISE_TRACE |
| 261 |
#define DS_RAISE_EXCEPTION(x) { \ |
| 262 |
ds_trace_control(__FILE__, __LINE__, Status); \ |
| 263 |
goto x; \ |
| 264 |
} |
| 265 |
#endif |
| 266 |
|
| 267 |
|
| 268 |
#ifdef DS_RAISE_DBX |
| 269 |
#define DS_RAISE_EXCEPTION(x) { \ |
| 270 |
ds_stop_dbx(); \ |
| 271 |
goto x; \ |
| 272 |
} |
| 273 |
#endif |
| 274 |
|
| 275 |
|
| 276 |
/* PRECOMPILER: define Return Code Handler */ |
| 277 |
|
| 278 |
/* NOTE: Return Code Handler */ |
| 279 |
/* To set a special return code the makro 'DS_SET_RETURN_CODE()' is available. Three forms |
| 280 |
of this makro are implemented to manage the handling during setting of a special return |
| 281 |
code. You can choise one for your current work by precompiler statement #define and |
| 282 |
#undefine, respectively. |
| 283 |
|
| 284 |
|
| 285 |
DS_RETURN_NORMAL |
| 286 |
The return code is set with a normal assign statement. No other actions will be done. |
| 287 |
|
| 288 |
|
| 289 |
DS_RETURN_TRACE |
| 290 |
The return code is set with an assign statement also, but in addition a printf() call |
| 291 |
is done. The following text is printed: |
| 292 |
|
| 293 |
"<file>", line <line number>: return ==> <status> |
| 294 |
|
| 295 |
The print out of this message can be controlled by file '/tmp/ds_return_on'. If the file |
| 296 |
exist the print out is done otherwise nothing is done. In this manner the switch can be |
| 297 |
done during runtime without new compilation or process restart. |
| 298 |
|
| 299 |
|
| 300 |
DS_RETURN_DBX |
| 301 |
The return code is set with an assign statement also, but in additon a call of function |
| 302 |
ds_stop_dbx() is done. This function has no other function than to stop point for debugger. |
| 303 |
Use during a dbx session the command 'stop in ds_stop_dbx'. The debugger stops program |
| 304 |
execution everytime a special return code is set. A check of current active parameters |
| 305 |
is now possible. |
| 306 |
*/ |
| 307 |
#undef DS_RETURN_NORMAL |
| 308 |
#define DS_RETURN_TRACE |
| 309 |
#undef DS_RETURN_DBX |
| 310 |
|
| 311 |
#ifdef DS_RETURN_NORMAL |
| 312 |
#define DS_SET_RETURN_CODE(x) ReturnCode = (x); |
| 313 |
#endif |
| 314 |
|
| 315 |
|
| 316 |
#ifdef DS_RETURN_TRACE |
| 317 |
#define DS_SET_RETURN_CODE(x) { \ |
| 318 |
ds_return_control(__FILE__, __LINE__, (x)); \ |
| 319 |
ReturnCode = (x); \ |
| 320 |
} |
| 321 |
#endif |
| 322 |
|
| 323 |
|
| 324 |
#ifdef DS_RETURN_DBX |
| 325 |
#define DS_SET_RETURN_CODE(x) { \ |
| 326 |
ds_stop_dbx(); \ |
| 327 |
ReturnCode = (x); \ |
| 328 |
} |
| 329 |
#endif |
| 330 |
/*-----------------------------------------------------------------------------------------*/ |
| 331 |
|
| 332 |
|
| 333 |
/* PRECOMPILER: define length of NEMA item values */ |
| 334 |
|
| 335 |
/* NOTE: length of NEAM item values control */ |
| 336 |
/* |
| 337 |
If you want to use other lengths for NEMA item values as the CMS defined standard |
| 338 |
lengths then change the following precompiler statement '#undef DS_USE_NOT_STAN- |
| 339 |
DARD_LENGTH' to '#define DS_USE_NOT_STANDARD_LENGTH'. |
| 340 |
|
| 341 |
A reason to do this is do minimize the NEAM Data Set Length during data set build up. |
| 342 |
If you want a minimal NEAM Data Set length define the following xxx_LENGTH |
| 343 |
identifier with a replacement of 2. Then the Data Set Library functions get and |
| 344 |
use the minimal necessary length of each item. |
| 345 |
|
| 346 |
If you use a replacement less than two then a fatal error occur. |
| 347 |
*/ |
| 348 |
|
| 349 |
#undef DS_USE_NOT_STANDARD_LENGTH |
| 350 |
#ifndef DS_USE_NOT_STANDARD_LENGTH |
| 351 |
|
| 352 |
#define AGE_LENGTH LENGTH_AGE |
| 353 |
#define DATE_LENGTH 10L |
| 354 |
#define DIAGNOSIS_LENGTH LENGTH_DIAGNOSIS |
| 355 |
#define DIRECTION_LENGTH LENGTH_DIRECTION |
| 356 |
#define COMMENT_LENGTH LENGTH_COMMENT |
| 357 |
#define FILE_NAME_LENGTH LENGTH_FILE_NAME |
| 358 |
#define FILTER_ID_LENGTH LENGTH_FILTER_ID |
| 359 |
#define HEADER_VERSION_LENGTH LENGTH_HEADER_VERSION |
| 360 |
#define INTEGER_NUMBER_LENGTH 6L |
| 361 |
#define LABEL_LENGTH LENGTH_LABEL |
| 362 |
#define LITTLE_IDENT_LENGTH 4L |
| 363 |
#define LONG_IDENT_LENGTH 12L |
| 364 |
#define NUCLEUS_LENGTH LENGTH_NUCLEUS |
| 365 |
#define MANUFACTURER_LENGTH LENGTH_MANUFACTURER |
| 366 |
#define MIDDLE_IDENT_LENGTH 8L |
| 367 |
#define ORIENTATION_LENGTH LENGTH_ORIENTATION |
| 368 |
#define PATIENT_ID_LENGTH LENGTH_PATIENT_ID |
| 369 |
#define REAL_NUMBER_LENGTH 14L |
| 370 |
#define SEQUENCE_INFO_LENGTH LENGTH_SEQUENCE_INFO |
| 371 |
#define SHORT_IDENT_LENGTH 2L |
| 372 |
#define SOFTWARE_VERSION_LENGTH LENGTH_SOFTWARE_VERSION |
| 373 |
#define SPI_VERSION_LENGTH 18L |
| 374 |
#define TIME_LENGTH 12L |
| 375 |
|
| 376 |
#else |
| 377 |
|
| 378 |
#define AGE_LENGTH 2L |
| 379 |
#define DIAGNOSIS_LENGTH 2L |
| 380 |
#define DIRECTION_LENGTH 2L |
| 381 |
#define COMMENT_LENGTH 2L |
| 382 |
#define FILE_NAME_LENGTH 2L |
| 383 |
#define FILTER_ID_LENGTH 2L |
| 384 |
#define HEADER_VERSION_LENGTH 2L |
| 385 |
#define INTEGER_NUMBER_LENGTH 2L |
| 386 |
#define LABEL_LENGTH 2L |
| 387 |
#define LITTLE_IDENT_LENGTH 2L |
| 388 |
#define LONG_IDENT_LENGTH 2L |
| 389 |
#define NUCLEUS_LENGTH 2L |
| 390 |
#define MANUFACTURER_LENGTH 2L |
| 391 |
#define MIDDLE_IDENT_LENGTH 2L |
| 392 |
#define ORIENTATION_LENGTH 2L |
| 393 |
#define PATIENT_ID_LENGTH 2L |
| 394 |
#define REAL_NUMBER_LENGTH 2L |
| 395 |
#define SEQUENCE_INFO_LENGTH 2L |
| 396 |
#define SHORT_IDENT_LENGTH 2L |
| 397 |
#define SOFTWARE_VERSION_LENGTH 2L |
| 398 |
#define SPI_VERSION_LENGTH 2L |
| 399 |
|
| 400 |
#define DATE_LENGTH 10L |
| 401 |
#define TIME_LENGTH 12L |
| 402 |
|
| 403 |
#endif |
| 404 |
/*-----------------------------------------------------------------------------------------*/ |
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
/*== TYPES ==============================================================================*/ |
| 409 |
|
| 410 |
/* DECLARATION: declare types */ |
| 411 |
/* - undependent types */ |
| 412 |
|
| 413 |
typedef enum data_area_type_tag |
| 414 |
{ |
| 415 |
Area_Type_BYTE = 1, |
| 416 |
Area_Type_LONG = 2, |
| 417 |
Area_Type_SHORT = 3, |
| 418 |
Area_Type_UNDEFINED = Enum_UNDEFINED |
| 419 |
} data_area_type_t; |
| 420 |
|
| 421 |
|
| 422 |
typedef enum data_set_format_tag |
| 423 |
{ |
| 424 |
Set_format_BLOCK = 1, |
| 425 |
Set_format_NEMA = 2, |
| 426 |
Set_format_UNDEFINED = Enum_UNDEFINED |
| 427 |
} data_set_format_t; |
| 428 |
|
| 429 |
|
| 430 |
typedef struct image_orientation_tag |
| 431 |
{ |
| 432 |
double RowX; |
| 433 |
double RowY; |
| 434 |
double RowZ; |
| 435 |
double ColX; |
| 436 |
double ColY; |
| 437 |
double ColZ; |
| 438 |
} image_orientation_t; |
| 439 |
|
| 440 |
|
| 441 |
typedef enum image_class_tag |
| 442 |
{ |
| 443 |
Image_Class_CORONAL = 10, |
| 444 |
Image_Class_SAGITTAL = 20, |
| 445 |
Image_Class_TRANSVERSAL = 30, |
| 446 |
Image_Class_UNDEFINED = Enum_UNDEFINED |
| 447 |
} image_class_t; |
| 448 |
|
| 449 |
|
| 450 |
typedef enum image_text_type_tag |
| 451 |
{ |
| 452 |
Image_Text_Type_BLACK = 1, |
| 453 |
Image_Text_Type_MR_RAW = 2, |
| 454 |
Image_Text_Type_NONE = 3, |
| 455 |
Image_Text_Type_NORMAL = 4, |
| 456 |
Image_Text_Type_CT_REBUILD = 5, |
| 457 |
|
| 458 |
Image_Text_Type_UNDEFINED = Enum_UNDEFINED |
| 459 |
} image_text_type_t; |
| 460 |
|
| 461 |
|
| 462 |
typedef enum item_quality_tag |
| 463 |
{ |
| 464 |
Item_Quality_AFTER_IN_FOLLOWING_GROUP = 10, |
| 465 |
Item_Quality_AFTER_IN_THIS_GROUP = 11, |
| 466 |
Item_Quality_BEFORE = 20, |
| 467 |
Item_Quality_END_OF_DATA_SET = 50, |
| 468 |
Item_Quality_EQUAL = 30, |
| 469 |
Item_Quality_OUT_OF_RANGE = 99, |
| 470 |
|
| 471 |
Item_Quality_UNDEFINED = Enum_UNDEFINED |
| 472 |
} item_quality_t; |
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
typedef char nema_patient_place_t[2][4]; |
| 477 |
|
| 478 |
typedef enum overlay_number_tag |
| 479 |
{ |
| 480 |
Overlay_6000 = 1, |
| 481 |
Overlay_6002 = 2, |
| 482 |
Overlay_6004 = 3, |
| 483 |
Overlay_6006 = 4, |
| 484 |
|
| 485 |
Overlay_UNDEFINED = Enum_UNDEFINED |
| 486 |
} overlay_number_t; |
| 487 |
|
| 488 |
|
| 489 |
typedef union quart_as_tag /* four bytes as different bit |
| 490 |
patterns */ |
| 491 |
{ |
| 492 |
char AsBytes[4]; /* as four bytes */ |
| 493 |
float AsFloat; /* as float */ |
| 494 |
long AsLong; /* as long */ |
| 495 |
short AsShort[2]; /* as two short */ |
| 496 |
} quart_as_t; |
| 497 |
|
| 498 |
|
| 499 |
typedef enum swap_mode_tag |
| 500 |
{ |
| 501 |
Swap_NO = 0, |
| 502 |
Swap_YES = 1, |
| 503 |
Swap_UNDEFINED = Enum_UNDEFINED |
| 504 |
} swap_mode_t; |
| 505 |
|
| 506 |
|
| 507 |
typedef struct transformation_list_tag |
| 508 |
{ |
| 509 |
int Index; |
| 510 |
double Factor; |
| 511 |
} transformation_list_t[3]; |
| 512 |
|
| 513 |
|
| 514 |
typedef double matrix_3x3_t[3][3]; |
| 515 |
|
| 516 |
|
| 517 |
typedef enum update_mode_tag |
| 518 |
{ |
| 519 |
Update_ELEMENT = 1, |
| 520 |
Update_FOUND = 2, |
| 521 |
Update_GROUP = 3, |
| 522 |
Update_UNDEFINED = Enum_UNDEFINED |
| 523 |
} update_mode_t; |
| 524 |
|
| 525 |
|
| 526 |
typedef enum value_mode_tag |
| 527 |
{ |
| 528 |
Value_IS_NORMAL = 1, |
| 529 |
Value_IS_LAST = 2, |
| 530 |
Value_UNDEFINED = Enum_UNDEFINED |
| 531 |
} value_mode_t; |
| 532 |
|
| 533 |
|
| 534 |
typedef enum value_representation_tag |
| 535 |
{ |
| 536 |
Representation_AN = 10, |
| 537 |
Representation_AT = 11, |
| 538 |
Representation_BI = 20, |
| 539 |
Representation_BR = 21, |
| 540 |
Representation_BY = 22, |
| 541 |
Representation_BX = 23, |
| 542 |
Representation_UNDEFINED = Enum_UNDEFINED |
| 543 |
} value_representation_t; |
| 544 |
|
| 545 |
|
| 546 |
typedef double vector_t[3]; |
| 547 |
|
| 548 |
|
| 549 |
/* - dependent types */ |
| 550 |
|
| 551 |
typedef struct nema_image_place_tag |
| 552 |
{ |
| 553 |
nema_patient_place_t PatientOrientation; |
| 554 |
vector_t ImagePosition; |
| 555 |
vector_t ImageOrientation[2]; |
| 556 |
} nema_image_place_t; |
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
/*== MACROS =============================================================================*/ |
| 561 |
|
| 562 |
/* PRECOMPILER: define macros */ |
| 563 |
|
| 564 |
/* NOTE: define macros */ |
| 565 |
/* |
| 566 |
If you want to use a "Mathematics" macro don't forget to insert the precompiler line |
| 567 |
"#include <math.h>". |
| 568 |
*/ |
| 569 |
/*-----------------------------------------------------------------------------------------*/ |
| 570 |
|
| 571 |
|
| 572 |
/* Bit Manipulation */ |
| 573 |
#define DS_BIT_CLEAR(Variable, BitNumber) ((Variable) = ((Variable) & ~(1<<(BitNumber)))) |
| 574 |
#define DS_BIT_TEST(Variable, BitNumber) (((Variable) & (1<<(BitNumber))) != 0) |
| 575 |
#define DS_BIT_SET(Variable, BitNumber) ((Variable) = ((Variable) | (1<<(BitNumber)))) |
| 576 |
#define DS_BIT_TOGGLE(Variable, BitNumber) (for future use) |
| 577 |
/*-----------------------------------------------------------------------------------------*/ |
| 578 |
|
| 579 |
|
| 580 |
/* Mathematics */ |
| 581 |
#define DS_MAX(a,b) ((a)>(b)?(a):(b)) |
| 582 |
#define DS_MIN(a,b) ((a)>(b)?(b):(a)) |
| 583 |
|
| 584 |
|
| 585 |
#define DS_I_ABS(x) ((x) < 0 ? -(x) : (x)) |
| 586 |
|
| 587 |
#define DS_R_ABS(x) fabs((x)) |
| 588 |
#define DS_R_EQUAL(x, y) (fabs((double)(x) - (double)(y)) <= (double)0.00001) |
| 589 |
#define DS_R_GREATER(x, y) ((x) > (y)) |
| 590 |
#define DS_R_LESS(x, y) ((x) < (y)) |
| 591 |
|
| 592 |
#define DS_V_EQUAL(x, y) ds_vector_check_if_equal((x), (y)) |
| 593 |
|
| 594 |
#define DS_G_SIN(x) (sin(((M_PI/180.0)*(x)))) |
| 595 |
#define DS_G_COS(x) (cos(((M_PI/180.0)*(x)))) |
| 596 |
#define DS_G_TAN(x) (tan(((M_PI/180.0)*(x)))) |
| 597 |
#define DS_G_TAN2(x,y) (tan2((M_PI/180.0)*((x),(y)))) |
| 598 |
|
| 599 |
#define DS_G_ASIN(x) ((180.0/M_PI)*asin((x))) |
| 600 |
#define DS_G_ACOS(x) ((180.0/M_PI)*acos((x))) |
| 601 |
#define DS_G_ATAN(x) ((180.0/M_PI)*atan((x))) |
| 602 |
#define DS_G_ATAN2(x,y) ((180.0/M_PI)*atan2((x),(y))) |
| 603 |
|
| 604 |
#define DS_R_SIN(x) (sin((x)))) |
| 605 |
#define DS_R_COS(x) (cos((x)))) |
| 606 |
#define DS_R_TAN(x) (tan((x)))) |
| 607 |
#define DS_R_TAN2(x,y) (tan2((x),(y)))) |
| 608 |
|
| 609 |
#define DS_R_ASIN(x) (asin((x))) |
| 610 |
#define DS_R_ACOS(x) (acos((x))) |
| 611 |
#define DS_R_ATAN(x) (atan((x))) |
| 612 |
#define DS_R_ATAN2(x,y) (atan2((x),(y))) |
| 613 |
|
| 614 |
/*-----------------------------------------------------------------------------------------*/ |
| 615 |
|
| 616 |
|
| 617 |
/* Transformation Matrix Handling */ |
| 618 |
#define DS_SET_TRANSFORMATION_LIST(a_fac, a_ind, b_fac, b_ind, c_fac, c_ind) \ |
| 619 |
{ \ |
| 620 |
TransformationList[AAA].Index = (a_ind); \ |
| 621 |
TransformationList[AAA].Factor = (a_fac); \ |
| 622 |
TransformationList[BBB].Index = (b_ind); \ |
| 623 |
TransformationList[BBB].Factor = (b_fac); \ |
| 624 |
TransformationList[CCC].Index = (c_ind); \ |
| 625 |
TransformationList[CCC].Factor = (c_fac); \ |
| 626 |
} |
| 627 |
/*-----------------------------------------------------------------------------------------*/ |
| 628 |
|
| 629 |
|
| 630 |
/* Image Class / History Label */ |
| 631 |
#define DS_SET_HISTORY_LABEL(ClassLabel, No1Label, No2Label) \ |
| 632 |
strncpy(Header->G51.Txt.SliceOrientationNo1, (ClassLabel), (int) 3); \ |
| 633 |
if (!(DS_R_EQUAL(SliceAngleNo1, 0.0))) \ |
| 634 |
{ \ |
| 635 |
Header->G51.Txt.SliceOrientationNo1[3] = '>'; \ |
| 636 |
strncpy(&(Header->G51.Txt.SliceOrientationNo1[4]), (No1Label), (int) 3); \ |
| 637 |
} \ |
| 638 |
if (!(DS_R_EQUAL(SliceAngleNo2, 0.0))) \ |
| 639 |
{ \ |
| 640 |
Header->G51.Txt.SliceOrientationNo2[3] = '>'; \ |
| 641 |
strncpy(&(Header->G51.Txt.SliceOrientationNo2[4]), (No2Label), (int) 3); \ |
| 642 |
} |
| 643 |
/*-----------------------------------------------------------------------------------------*/ |
| 644 |
|
| 645 |
|
| 646 |
/* String Initialization */ |
| 647 |
#define DS_SET_STRING_DEFAULT(String, DefaultSign, StringLength) \ |
| 648 |
memset((String), (DefaultSign), (int) (StringLength)); \ |
| 649 |
String[(StringLength)] = '\0' |
| 650 |
|
| 651 |
#define DS_SET_STRING_UNDEFINED(String, FillSign, StringLength) \ |
| 652 |
memset((String), (FillSign), (int) (StringLength)); \ |
| 653 |
String[(StringLength)] = '\0'; \ |
| 654 |
String[0] = String_UNDEFINED |
| 655 |
|
| 656 |
#define DS_SET_STRING_VALUE(String, FillString, StringLength) \ |
| 657 |
bcopy((FillString), (String), (int) (StringLength)); \ |
| 658 |
String[(StringLength)] = '\0' |
| 659 |
|
| 660 |
#define DS_SET_STRING_CHANGEABLE(String) \ |
| 661 |
ds_string_delete_leading_characters(String, String, ' '); \ |
| 662 |
ds_string_delete_tailing_characters(String, String, ' ') |
| 663 |
/*-----------------------------------------------------------------------------------------*/ |
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
/*== FUNCTIONS ==========================================================================*/ |
| 668 |
|
| 669 |
/* NOTE: define system library functions */ |
| 670 |
/* |
| 671 |
The following system library functions are defined here to avoid an error message during |
| 672 |
lint task. |
| 673 |
*/ |
| 674 |
|
| 675 |
/* DECLARATION: define special parameter */ |
| 676 |
/*char *sprintf();*/ |
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
/*========================================================================================*/ |
| 681 |
|
| 682 |
|
| 683 |
#endif |