1 #ifndef DEF_vol_io_prototypes 2 #define DEF_vol_io_prototypes 3 4 VIOAPI VIO_Real convert_voxel_to_value( 5 VIO_Volume volume, 6 VIO_Real voxel ); 7 8 VIOAPI VIO_Real convert_value_to_voxel( 9 VIO_Volume volume, 10 VIO_Real value ); 11 12 VIOAPI VIO_Real get_volume_voxel_value( 13 VIO_Volume volume, 14 int v0, 15 int v1, 16 int v2, 17 int v3, 18 int v4 ); 19 20 VIOAPI VIO_Real get_volume_real_value( 21 VIO_Volume volume, 22 int v0, 23 int v1, 24 int v2, 25 int v3, 26 int v4 ); 27 28 VIOAPI void set_volume_voxel_value( 29 VIO_Volume volume, 30 int v0, 31 int v1, 32 int v2, 33 int v3, 34 int v4, 35 VIO_Real voxel ); 36 37 VIOAPI void set_volume_real_value( 38 VIO_Volume volume, 39 int v0, 40 int v1, 41 int v2, 42 int v3, 43 int v4, 44 VIO_Real value ); 45 46 VIOAPI void set_volume_interpolation_tolerance( 47 VIO_Real tolerance ); 48 49 VIOAPI int evaluate_volume( 50 VIO_Volume volume, 51 VIO_Real voxel[], 52 VIO_BOOL interpolating_dimensions[], 53 int degrees_continuity, 54 VIO_BOOL use_linear_at_edge, 55 VIO_Real outside_value, 56 VIO_Real values[], 57 VIO_Real **first_deriv, 58 VIO_Real ***second_deriv ); 59 60 VIOAPI void evaluate_volume_in_world( 61 VIO_Volume volume, 62 VIO_Real x, 63 VIO_Real y, 64 VIO_Real z, 65 int degrees_continuity, 66 VIO_BOOL use_linear_at_edge, 67 VIO_Real outside_value, 68 VIO_Real values[], 69 VIO_Real deriv_x[], 70 VIO_Real deriv_y[], 71 VIO_Real deriv_z[], 72 VIO_Real deriv_xx[], 73 VIO_Real deriv_xy[], 74 VIO_Real deriv_xz[], 75 VIO_Real deriv_yy[], 76 VIO_Real deriv_yz[], 77 VIO_Real deriv_zz[] ); 78 79 VIOAPI void convert_voxels_to_values( 80 VIO_Volume volume, 81 int n_voxels, 82 VIO_Real voxels[], 83 VIO_Real values[] ); 84 85 VIOAPI void get_volume_value_hyperslab( 86 VIO_Volume volume, 87 int v0, 88 int v1, 89 int v2, 90 int v3, 91 int v4, 92 int n0, 93 int n1, 94 int n2, 95 int n3, 96 int n4, 97 VIO_Real values[] ); 98 99 VIOAPI void get_volume_value_hyperslab_5d( 100 VIO_Volume volume, 101 int v0, 102 int v1, 103 int v2, 104 int v3, 105 int v4, 106 int n0, 107 int n1, 108 int n2, 109 int n3, 110 int n4, 111 VIO_Real values[] ); 112 113 VIOAPI void get_volume_value_hyperslab_4d( 114 VIO_Volume volume, 115 int v0, 116 int v1, 117 int v2, 118 int v3, 119 int n0, 120 int n1, 121 int n2, 122 int n3, 123 VIO_Real values[] ); 124 125 VIOAPI void get_volume_value_hyperslab_3d( 126 VIO_Volume volume, 127 int v0, 128 int v1, 129 int v2, 130 int n0, 131 int n1, 132 int n2, 133 VIO_Real values[] ); 134 135 VIOAPI void get_volume_value_hyperslab_2d( 136 VIO_Volume volume, 137 int v0, 138 int v1, 139 int n0, 140 int n1, 141 VIO_Real values[] ); 142 143 VIOAPI void get_volume_value_hyperslab_1d( 144 VIO_Volume volume, 145 int v0, 146 int n0, 147 VIO_Real values[] ); 148 149 VIOAPI void get_voxel_values_5d( 150 VIO_Data_types data_type, 151 void *void_ptr, 152 int steps[], 153 int counts[], 154 VIO_Real values[] ); 155 156 VIOAPI void get_voxel_values_4d( 157 VIO_Data_types data_type, 158 void *void_ptr, 159 int steps[], 160 int counts[], 161 VIO_Real values[] ); 162 163 VIOAPI void get_voxel_values_3d( 164 VIO_Data_types data_type, 165 void *void_ptr, 166 int steps[], 167 int counts[], 168 VIO_Real values[] ); 169 170 VIOAPI void get_voxel_values_2d( 171 VIO_Data_types data_type, 172 void *void_ptr, 173 int steps[], 174 int counts[], 175 VIO_Real values[] ); 176 177 VIOAPI void get_voxel_values_1d( 178 VIO_Data_types data_type, 179 void *void_ptr, 180 int step0, 181 int n0, 182 VIO_Real values[] ); 183 184 VIOAPI void get_volume_voxel_hyperslab_5d( 185 VIO_Volume volume, 186 int v0, 187 int v1, 188 int v2, 189 int v3, 190 int v4, 191 int n0, 192 int n1, 193 int n2, 194 int n3, 195 int n4, 196 VIO_Real values[] ); 197 198 VIOAPI void get_volume_voxel_hyperslab_4d( 199 VIO_Volume volume, 200 int v0, 201 int v1, 202 int v2, 203 int v3, 204 int n0, 205 int n1, 206 int n2, 207 int n3, 208 VIO_Real values[] ); 209 210 VIOAPI void get_volume_voxel_hyperslab_3d( 211 VIO_Volume volume, 212 int v0, 213 int v1, 214 int v2, 215 int n0, 216 int n1, 217 int n2, 218 VIO_Real values[] ); 219 220 VIOAPI void get_volume_voxel_hyperslab_2d( 221 VIO_Volume volume, 222 int v0, 223 int v1, 224 int n0, 225 int n1, 226 VIO_Real values[] ); 227 228 VIOAPI void get_volume_voxel_hyperslab_1d( 229 VIO_Volume volume, 230 int v0, 231 int n0, 232 VIO_Real values[] ); 233 234 VIOAPI void get_volume_voxel_hyperslab( 235 VIO_Volume volume, 236 int v0, 237 int v1, 238 int v2, 239 int v3, 240 int v4, 241 int n0, 242 int n1, 243 int n2, 244 int n3, 245 int n4, 246 VIO_Real voxels[] ); 247 248 VIOAPI VIO_Status initialize_free_format_input( 249 VIO_STR filename, 250 VIO_Volume volume, 251 volume_input_struct *volume_input ); 252 253 VIOAPI void delete_free_format_input( 254 volume_input_struct *volume_input ); 255 256 VIOAPI VIO_BOOL input_more_free_format_file( 257 VIO_Volume volume, 258 volume_input_struct *volume_input, 259 VIO_Real *fraction_done ); 260 261 VIOAPI int get_minc_file_n_dimensions( 262 VIO_STR filename ); 263 264 VIOAPI Minc_file initialize_minc_input_from_minc_id( 265 int minc_id, 266 VIO_Volume volume, 267 minc_input_options *options ); 268 269 VIOAPI Minc_file initialize_minc_input( 270 VIO_STR filename, 271 VIO_Volume volume, 272 minc_input_options *options ); 273 274 VIOAPI int get_n_input_volumes( 275 Minc_file file ); 276 277 VIOAPI VIO_Status close_minc_input( 278 Minc_file file ); 279 280 VIOAPI VIO_Status input_minc_hyperslab( 281 Minc_file file, 282 VIO_Data_types data_type, 283 int n_array_dims, 284 int array_sizes[], 285 void *array_data_ptr, 286 int to_array[], 287 int start[], 288 int count[] ); 289 290 VIOAPI VIO_BOOL input_more_minc_file( 291 Minc_file file, 292 VIO_Real *fraction_done ); 293 294 VIOAPI VIO_BOOL advance_input_volume( 295 Minc_file file ); 296 297 VIOAPI void reset_input_volume( 298 Minc_file file ); 299 300 VIOAPI int get_minc_file_id( 301 Minc_file file ); 302 303 VIOAPI void set_default_minc_input_options( 304 minc_input_options *options ); 305 306 VIOAPI void set_minc_input_promote_invalid_to_zero_flag( 307 minc_input_options *options, 308 VIO_BOOL flag ); 309 310 VIOAPI void set_minc_input_promote_invalid_to_min_flag( 311 minc_input_options *options, 312 VIO_BOOL flag ); 313 314 VIOAPI void set_minc_input_vector_to_scalar_flag( 315 minc_input_options *options, 316 VIO_BOOL flag ); 317 318 VIOAPI void set_minc_input_vector_to_colour_flag( 319 minc_input_options *options, 320 VIO_BOOL flag ); 321 322 VIOAPI void set_minc_input_colour_dimension_size( 323 minc_input_options *options, 324 int size ); 325 326 VIOAPI void set_minc_input_colour_max_dimension_size( 327 minc_input_options *options, 328 int size ); 329 330 VIOAPI void set_minc_input_colour_indices( 331 minc_input_options *options, 332 int indices[4] ); 333 334 VIOAPI void set_minc_input_user_real_range( 335 minc_input_options *options, 336 double minimum, 337 double maximum ); 338 339 VIOAPI VIO_Status start_volume_input( 340 VIO_STR filename, 341 int n_dimensions, 342 VIO_STR dim_names[], 343 nc_type volume_nc_data_type, 344 VIO_BOOL volume_signed_flag, 345 VIO_Real volume_voxel_min, 346 VIO_Real volume_voxel_max, 347 VIO_BOOL create_volume_flag, 348 VIO_Volume *volume, 349 minc_input_options *options, 350 volume_input_struct *input_info ); 351 352 VIOAPI void delete_volume_input( 353 volume_input_struct *input_info ); 354 355 VIOAPI VIO_BOOL input_more_of_volume( 356 VIO_Volume volume, 357 volume_input_struct *input_info, 358 VIO_Real *fraction_done ); 359 360 VIOAPI void cancel_volume_input( 361 VIO_Volume volume, 362 volume_input_struct *input_info ); 363 364 VIOAPI VIO_Status input_volume( 365 VIO_STR filename, 366 int n_dimensions, 367 VIO_STR dim_names[], 368 nc_type volume_nc_data_type, 369 VIO_BOOL volume_signed_flag, 370 VIO_Real volume_voxel_min, 371 VIO_Real volume_voxel_max, 372 VIO_BOOL create_volume_flag, 373 VIO_Volume *volume, 374 minc_input_options *options ); 375 376 VIOAPI Minc_file get_volume_input_minc_file( 377 volume_input_struct *volume_input ); 378 379 VIOAPI void create_empty_multidim_array( 380 VIO_multidim_array *array, 381 int n_dimensions, 382 VIO_Data_types data_type ); 383 384 VIOAPI VIO_Data_types get_multidim_data_type( 385 VIO_multidim_array *array ); 386 387 VIOAPI void set_multidim_data_type( 388 VIO_multidim_array *array, 389 VIO_Data_types data_type ); 390 391 VIOAPI int get_type_size( 392 VIO_Data_types type ); 393 394 VIOAPI void get_type_range( 395 VIO_Data_types type, 396 VIO_Real *min_value, 397 VIO_Real *max_value ); 398 399 VIOAPI void set_multidim_sizes( 400 VIO_multidim_array *array, 401 int sizes[] ); 402 403 VIOAPI void get_multidim_sizes( 404 VIO_multidim_array *array, 405 int sizes[] ); 406 407 VIOAPI VIO_BOOL multidim_array_is_alloced( 408 VIO_multidim_array *array ); 409 410 VIOAPI void alloc_multidim_array( 411 VIO_multidim_array *array ); 412 413 VIOAPI void create_multidim_array( 414 VIO_multidim_array *array, 415 int n_dimensions, 416 int sizes[], 417 VIO_Data_types data_type ); 418 419 VIOAPI void delete_multidim_array( 420 VIO_multidim_array *array ); 421 422 VIOAPI int get_multidim_n_dimensions( 423 VIO_multidim_array *array ); 424 425 VIOAPI void copy_multidim_data_reordered( 426 int type_size, 427 void *void_dest_ptr, 428 int n_dest_dims, 429 int dest_sizes[], 430 void *void_src_ptr, 431 int n_src_dims, 432 int src_sizes[], 433 int counts[], 434 int to_dest_index[], 435 VIO_BOOL use_src_order ); 436 437 VIOAPI void copy_multidim_reordered( 438 VIO_multidim_array *dest, 439 int dest_ind[], 440 VIO_multidim_array *src, 441 int src_ind[], 442 int counts[], 443 int to_dest_index[] ); 444 445 VIOAPI Minc_file initialize_minc_output( 446 VIO_STR filename, 447 int n_dimensions, 448 VIO_STR dim_names[], 449 int sizes[], 450 nc_type file_nc_data_type, 451 VIO_BOOL file_signed_flag, 452 VIO_Real file_voxel_min, 453 VIO_Real file_voxel_max, 454 VIO_General_transform *voxel_to_world_transform, 455 VIO_Volume volume_to_attach, 456 minc_output_options *options ); 457 458 VIOAPI VIO_Status copy_auxiliary_data_from_minc_file( 459 Minc_file file, 460 VIO_STR filename, 461 VIO_STR history_string ); 462 463 VIOAPI VIO_Status copy_auxiliary_data_from_open_minc_file( 464 Minc_file file, 465 int src_cdfid, 466 VIO_STR history_string ); 467 468 VIOAPI VIO_Status add_minc_history( 469 Minc_file file, 470 VIO_STR history_string ); 471 472 VIOAPI VIO_Status set_minc_output_random_order( 473 Minc_file file ); 474 475 VIOAPI VIO_Status output_minc_hyperslab( 476 Minc_file file, 477 VIO_Data_types data_type, 478 int n_array_dims, 479 int array_sizes[], 480 void *array_data_ptr, 481 int to_array[], 482 int file_start[], 483 int file_count[] ); 484 485 VIOAPI VIO_Status output_volume_to_minc_file_position( 486 Minc_file file, 487 VIO_Volume volume, 488 int volume_count[], 489 long file_start[] ); 490 491 VIOAPI VIO_Status output_minc_volume( 492 Minc_file file ); 493 494 VIOAPI VIO_Status close_minc_output( 495 Minc_file file ); 496 497 VIOAPI void set_default_minc_output_options( 498 minc_output_options *options ); 499 500 VIOAPI void copy_minc_output_options( 501 minc_output_options *src, 502 minc_output_options *dest ); 503 504 VIOAPI void delete_minc_output_options( 505 minc_output_options *options ); 506 507 VIOAPI void set_minc_output_dimensions_order( 508 minc_output_options *options, 509 int n_dimensions, 510 VIO_STR dimension_names[] ); 511 512 VIOAPI void set_minc_output_real_range( 513 minc_output_options *options, 514 VIO_Real real_min, 515 VIO_Real real_max ); 516 517 VIOAPI void set_minc_output_use_volume_starts_and_steps_flag( 518 minc_output_options *options, 519 VIO_BOOL flag ); 520 521 VIOAPI VIO_Status get_file_dimension_names( 522 VIO_STR filename, 523 int *n_dims, 524 VIO_STR *dim_names[] ); 525 526 VIOAPI VIO_STR *create_output_dim_names( 527 VIO_Volume volume, 528 VIO_STR original_filename, 529 minc_output_options *options, 530 int file_sizes[] ); 531 532 VIOAPI VIO_Status copy_volume_auxiliary_and_history( 533 Minc_file minc_file, 534 VIO_STR filename, 535 VIO_STR original_filename, 536 VIO_STR history ); 537 538 VIOAPI VIO_Status output_modified_volume( 539 VIO_STR filename, 540 nc_type file_nc_data_type, 541 VIO_BOOL file_signed_flag, 542 VIO_Real file_voxel_min, 543 VIO_Real file_voxel_max, 544 VIO_Volume volume, 545 VIO_STR original_filename, 546 VIO_STR history, 547 minc_output_options *options ); 548 549 VIOAPI VIO_Status output_volume( 550 VIO_STR filename, 551 nc_type file_nc_data_type, 552 VIO_BOOL file_signed_flag, 553 VIO_Real file_voxel_min, 554 VIO_Real file_voxel_max, 555 VIO_Volume volume, 556 VIO_STR history, 557 minc_output_options *options ); 558 559 VIOAPI void convert_values_to_voxels( 560 VIO_Volume volume, 561 int n_voxels, 562 VIO_Real values[], 563 VIO_Real voxels[] ); 564 565 VIOAPI void set_volume_value_hyperslab( 566 VIO_Volume volume, 567 int v0, 568 int v1, 569 int v2, 570 int v3, 571 int v4, 572 int n0, 573 int n1, 574 int n2, 575 int n3, 576 int n4, 577 VIO_Real values[] ); 578 579 VIOAPI void set_volume_value_hyperslab_5d( 580 VIO_Volume volume, 581 int v0, 582 int v1, 583 int v2, 584 int v3, 585 int v4, 586 int n0, 587 int n1, 588 int n2, 589 int n3, 590 int n4, 591 VIO_Real values[] ); 592 593 VIOAPI void set_volume_value_hyperslab_4d( 594 VIO_Volume volume, 595 int v0, 596 int v1, 597 int v2, 598 int v3, 599 int n0, 600 int n1, 601 int n2, 602 int n3, 603 VIO_Real values[] ); 604 605 VIOAPI void set_volume_value_hyperslab_3d( 606 VIO_Volume volume, 607 int v0, 608 int v1, 609 int v2, 610 int n0, 611 int n1, 612 int n2, 613 VIO_Real values[] ); 614 615 VIOAPI void set_volume_value_hyperslab_2d( 616 VIO_Volume volume, 617 int v0, 618 int v1, 619 int n0, 620 int n1, 621 VIO_Real values[] ); 622 623 VIOAPI void set_volume_value_hyperslab_1d( 624 VIO_Volume volume, 625 int v0, 626 int n0, 627 VIO_Real values[] ); 628 629 VIOAPI void set_volume_voxel_hyperslab_5d( 630 VIO_Volume volume, 631 int v0, 632 int v1, 633 int v2, 634 int v3, 635 int v4, 636 int n0, 637 int n1, 638 int n2, 639 int n3, 640 int n4, 641 VIO_Real values[] ); 642 643 VIOAPI void set_volume_voxel_hyperslab_4d( 644 VIO_Volume volume, 645 int v0, 646 int v1, 647 int v2, 648 int v3, 649 int n0, 650 int n1, 651 int n2, 652 int n3, 653 VIO_Real values[] ); 654 655 VIOAPI void set_volume_voxel_hyperslab_3d( 656 VIO_Volume volume, 657 int v0, 658 int v1, 659 int v2, 660 int n0, 661 int n1, 662 int n2, 663 VIO_Real values[] ); 664 665 VIOAPI void set_volume_voxel_hyperslab_2d( 666 VIO_Volume volume, 667 int v0, 668 int v1, 669 int n0, 670 int n1, 671 VIO_Real values[] ); 672 673 VIOAPI void set_volume_voxel_hyperslab_1d( 674 VIO_Volume volume, 675 int v0, 676 int n0, 677 VIO_Real values[] ); 678 679 VIOAPI void set_volume_voxel_hyperslab( 680 VIO_Volume volume, 681 int v0, 682 int v1, 683 int v2, 684 int v3, 685 int v4, 686 int n0, 687 int n1, 688 int n2, 689 int n3, 690 int n4, 691 VIO_Real voxels[] ); 692 693 VIOAPI void set_n_bytes_cache_threshold( 694 int threshold ); 695 696 VIOAPI int get_n_bytes_cache_threshold( void ); 697 698 VIOAPI void set_default_max_bytes_in_cache( 699 int max_bytes ); 700 701 VIOAPI int get_default_max_bytes_in_cache( void ); 702 703 VIOAPI void set_default_cache_block_sizes( 704 int block_sizes[] ); 705 706 VIOAPI void set_cache_block_sizes_hint( 707 VIO_Cache_block_size_hints hint ); 708 709 VIOAPI void initialize_volume_cache( 710 VIO_volume_cache_struct *cache, 711 VIO_Volume volume ); 712 713 VIOAPI VIO_BOOL volume_cache_is_alloced( 714 VIO_volume_cache_struct *cache ); 715 716 VIOAPI void flush_volume_cache( 717 VIO_Volume volume ); 718 719 VIOAPI void delete_volume_cache( 720 VIO_volume_cache_struct *cache, 721 VIO_Volume volume ); 722 723 VIOAPI void set_volume_cache_block_sizes( 724 VIO_Volume volume, 725 int block_sizes[] ); 726 727 VIOAPI void set_volume_cache_size( 728 VIO_Volume volume, 729 int max_memory_bytes ); 730 731 VIOAPI void set_cache_output_volume_parameters( 732 VIO_Volume volume, 733 VIO_STR filename, 734 nc_type file_nc_data_type, 735 VIO_BOOL file_signed_flag, 736 VIO_Real file_voxel_min, 737 VIO_Real file_voxel_max, 738 VIO_STR original_filename, 739 VIO_STR history, 740 minc_output_options *options ) 741 ; 742 743 VIOAPI void open_cache_volume_input_file( 744 VIO_volume_cache_struct *cache, 745 VIO_Volume volume, 746 VIO_STR filename, 747 minc_input_options *options ); 748 749 VIOAPI void cache_volume_range_has_changed( 750 VIO_Volume volume ); 751 752 VIOAPI void set_cache_volume_file_offset( 753 VIO_volume_cache_struct *cache, 754 VIO_Volume volume, 755 long file_offset[] ); 756 757 VIOAPI VIO_Real get_cached_volume_voxel( 758 VIO_Volume volume, 759 int x, 760 int y, 761 int z, 762 int t, 763 int v ); 764 765 VIOAPI void set_cached_volume_voxel( 766 VIO_Volume volume, 767 int x, 768 int y, 769 int z, 770 int t, 771 int v, 772 VIO_Real value ); 773 774 VIOAPI VIO_BOOL cached_volume_has_been_modified( 775 VIO_volume_cache_struct *cache ); 776 777 VIOAPI VIO_BOOL volume_is_cached( 778 VIO_Volume volume ); 779 780 VIOAPI void set_volume_cache_debugging( 781 VIO_Volume volume, 782 int output_every ); 783 784 VIOAPI VIO_STR *get_default_dim_names( 785 int n_dimensions ); 786 787 VIOAPI VIO_BOOL convert_dim_name_to_spatial_axis( 788 VIO_STR name, 789 int *axis ); 790 791 VIOAPI VIO_Volume create_volume( 792 int n_dimensions, 793 VIO_STR dimension_names[], 794 nc_type nc_data_type, 795 VIO_BOOL signed_flag, 796 VIO_Real voxel_min, 797 VIO_Real voxel_max ); 798 799 VIOAPI void set_volume_type( 800 VIO_Volume volume, 801 nc_type nc_data_type, 802 VIO_BOOL signed_flag, 803 VIO_Real voxel_min, 804 VIO_Real voxel_max ); 805 806 VIOAPI nc_type get_volume_nc_data_type( 807 VIO_Volume volume, 808 VIO_BOOL *signed_flag ); 809 810 VIOAPI VIO_Data_types get_volume_data_type( 811 VIO_Volume volume ); 812 813 VIOAPI void set_rgb_volume_flag( 814 VIO_Volume volume, 815 VIO_BOOL flag ); 816 817 VIOAPI VIO_BOOL is_an_rgb_volume( 818 VIO_Volume volume ); 819 820 VIOAPI void alloc_volume_data( 821 VIO_Volume volume ); 822 823 VIOAPI VIO_BOOL volume_is_alloced( 824 VIO_Volume volume ); 825 826 VIOAPI void free_volume_data( 827 VIO_Volume volume ); 828 829 VIOAPI void delete_volume( 830 VIO_Volume volume ); 831 832 VIOAPI int get_volume_n_dimensions( 833 VIO_Volume volume ); 834 835 VIOAPI void get_volume_sizes( 836 VIO_Volume volume, 837 int sizes[] ); 838 839 VIOAPI void set_volume_sizes( 840 VIO_Volume volume, 841 int sizes[] ); 842 843 VIOAPI unsigned int get_volume_total_n_voxels( 844 VIO_Volume volume ); 845 846 VIOAPI void compute_world_transform( 847 int spatial_axes[VIO_N_DIMENSIONS], 848 VIO_Real separations[], 849 VIO_Real direction_cosines[][VIO_N_DIMENSIONS], 850 VIO_Real starts[], 851 VIO_General_transform *world_transform ); 852 853 VIOAPI void convert_transform_to_starts_and_steps( 854 VIO_General_transform *transform, 855 int n_volume_dimensions, 856 VIO_Real step_signs[], 857 int spatial_axes[], 858 VIO_Real starts[], 859 VIO_Real steps[], 860 VIO_Real dir_cosines[][VIO_N_DIMENSIONS] ); 861 862 VIOAPI void set_voxel_to_world_transform( 863 VIO_Volume volume, 864 VIO_General_transform *transform ); 865 866 VIOAPI VIO_General_transform *get_voxel_to_world_transform( 867 VIO_Volume volume ); 868 869 VIOAPI VIO_STR *get_volume_dimension_names( 870 VIO_Volume volume ); 871 872 VIOAPI void delete_dimension_names( 873 VIO_Volume volume, 874 VIO_STR dimension_names[] ); 875 876 VIOAPI VIO_STR get_volume_space_type( 877 VIO_Volume volume ); 878 879 VIOAPI void set_volume_space_type( 880 VIO_Volume volume, 881 VIO_STR name ); 882 883 VIOAPI void get_volume_separations( 884 VIO_Volume volume, 885 VIO_Real separations[] ); 886 887 VIOAPI void set_volume_separations( 888 VIO_Volume volume, 889 VIO_Real separations[] ); 890 891 VIOAPI void set_volume_starts( 892 VIO_Volume volume, 893 VIO_Real starts[] ); 894 895 VIOAPI void get_volume_starts( 896 VIO_Volume volume, 897 VIO_Real starts[] ); 898 899 VIOAPI void set_volume_direction_unit_cosine( 900 VIO_Volume volume, 901 int axis, 902 VIO_Real dir[] ); 903 904 VIOAPI void set_volume_direction_cosine( 905 VIO_Volume volume, 906 int axis, 907 VIO_Real dir[] ); 908 909 VIOAPI void get_volume_direction_cosine( 910 VIO_Volume volume, 911 int axis, 912 VIO_Real dir[] ); 913 914 /* These next 5 functions may be called by other modules in the library, 915 * but they are not truly public. That is why they are not declared VIOAPI. 916 */ 917 VIO_BOOL is_volume_dimension_irregular(VIO_Volume, int); 918 int get_volume_irregular_starts(VIO_Volume, int, int, VIO_Real *); 919 int get_volume_irregular_widths(VIO_Volume, int, int, VIO_Real *); 920 int set_volume_irregular_starts(VIO_Volume, int, int, VIO_Real *); 921 int set_volume_irregular_widths(VIO_Volume, int, int, VIO_Real *); 922 923 VIOAPI VIO_Real nonspatial_voxel_to_world(VIO_Volume, int, int); 924 VIOAPI int nonspatial_world_to_voxel(VIO_Volume, int, VIO_Real); 925 926 VIOAPI void set_volume_translation( 927 VIO_Volume volume, 928 VIO_Real voxel[], 929 VIO_Real world_space_voxel_maps_to[] ); 930 931 VIOAPI void get_volume_translation( 932 VIO_Volume volume, 933 VIO_Real voxel[], 934 VIO_Real world_space_voxel_maps_to[] ); 935 936 VIOAPI void reorder_voxel_to_xyz( 937 VIO_Volume volume, 938 VIO_Real voxel[], 939 VIO_Real xyz[] ); 940 941 VIOAPI void reorder_xyz_to_voxel( 942 VIO_Volume volume, 943 VIO_Real xyz[], 944 VIO_Real voxel[] ); 945 946 VIOAPI void convert_voxel_to_world( 947 VIO_Volume volume, 948 VIO_Real voxel[], 949 VIO_Real *x_world, 950 VIO_Real *y_world, 951 VIO_Real *z_world ); 952 953 VIOAPI void convert_3D_voxel_to_world( 954 VIO_Volume volume, 955 VIO_Real voxel1, 956 VIO_Real voxel2, 957 VIO_Real voxel3, 958 VIO_Real *x_world, 959 VIO_Real *y_world, 960 VIO_Real *z_world ); 961 962 VIOAPI void convert_voxel_normal_vector_to_world( 963 VIO_Volume volume, 964 VIO_Real voxel_vector[], 965 VIO_Real *x_world, 966 VIO_Real *y_world, 967 VIO_Real *z_world ); 968 969 VIOAPI void convert_voxel_vector_to_world( 970 VIO_Volume volume, 971 VIO_Real voxel_vector[], 972 VIO_Real *x_world, 973 VIO_Real *y_world, 974 VIO_Real *z_world ); 975 976 VIOAPI void convert_world_vector_to_voxel( 977 VIO_Volume volume, 978 VIO_Real x_world, 979 VIO_Real y_world, 980 VIO_Real z_world, 981 VIO_Real voxel_vector[] ); 982 983 VIOAPI void convert_world_to_voxel( 984 VIO_Volume volume, 985 VIO_Real x_world, 986 VIO_Real y_world, 987 VIO_Real z_world, 988 VIO_Real voxel[] ); 989 990 VIOAPI void convert_3D_world_to_voxel( 991 VIO_Volume volume, 992 VIO_Real x_world, 993 VIO_Real y_world, 994 VIO_Real z_world, 995 VIO_Real *voxel1, 996 VIO_Real *voxel2, 997 VIO_Real *voxel3 ); 998 999 VIOAPI VIO_Real get_volume_voxel_min( 1000 VIO_Volume volume ); 1001 1002 VIOAPI VIO_Real get_volume_voxel_max( 1003 VIO_Volume volume ); 1004 1005 VIOAPI void get_volume_voxel_range( 1006 VIO_Volume volume, 1007 VIO_Real *voxel_min, 1008 VIO_Real *voxel_max ); 1009 1010 VIOAPI void set_volume_voxel_range( 1011 VIO_Volume volume, 1012 VIO_Real voxel_min, 1013 VIO_Real voxel_max ); 1014 1015 VIOAPI void get_volume_real_range( 1016 VIO_Volume volume, 1017 VIO_Real *min_value, 1018 VIO_Real *max_value ); 1019 1020 VIOAPI VIO_Real get_volume_real_min( 1021 VIO_Volume volume ); 1022 1023 VIOAPI VIO_Real get_volume_real_max( 1024 VIO_Volume volume ); 1025 1026 VIOAPI void set_volume_real_range( 1027 VIO_Volume volume, 1028 VIO_Real real_min, 1029 VIO_Real real_max ); 1030 1031 VIOAPI VIO_Volume copy_volume_definition_no_alloc( 1032 VIO_Volume volume, 1033 nc_type nc_data_type, 1034 VIO_BOOL signed_flag, 1035 VIO_Real voxel_min, 1036 VIO_Real voxel_max ); 1037 1038 VIOAPI VIO_Volume copy_volume_definition( 1039 VIO_Volume volume, 1040 nc_type nc_data_type, 1041 VIO_BOOL signed_flag, 1042 VIO_Real voxel_min, 1043 VIO_Real voxel_max ); 1044 1045 VIOAPI VIO_Volume copy_volume( 1046 VIO_Volume volume ); 1047 1048 VIOAPI void grid_transform_point( 1049 VIO_General_transform *transform, 1050 VIO_Real x, 1051 VIO_Real y, 1052 VIO_Real z, 1053 VIO_Real *x_transformed, 1054 VIO_Real *y_transformed, 1055 VIO_Real *z_transformed ); 1056 1057 VIOAPI void grid_inverse_transform_point( 1058 VIO_General_transform *transform, 1059 VIO_Real x, 1060 VIO_Real y, 1061 VIO_Real z, 1062 VIO_Real *x_transformed, 1063 VIO_Real *y_transformed, 1064 VIO_Real *z_transformed ); 1065 1066 VIOAPI VIO_Status mni_get_nonwhite_character( 1067 FILE *file, 1068 char *ch ); 1069 1070 VIOAPI VIO_Status mni_skip_expected_character( 1071 FILE *file, 1072 char expected_ch ); 1073 1074 VIOAPI VIO_Status mni_input_line( 1075 FILE *file, 1076 VIO_STR *string ); 1077 1078 VIOAPI VIO_Status mni_input_string( 1079 FILE *file, 1080 VIO_STR *string, 1081 char termination_char1, 1082 char termination_char2 ); 1083 1084 VIOAPI VIO_Status mni_input_keyword_and_equal_sign( 1085 FILE *file, 1086 const char keyword[], 1087 VIO_BOOL print_error_message ); 1088 1089 VIOAPI VIO_Status mni_input_real( 1090 FILE *file, 1091 VIO_Real *d ); 1092 1093 VIOAPI VIO_Status mni_input_reals( 1094 FILE *file, 1095 int *n, 1096 VIO_Real *reals[] ); 1097 1098 VIOAPI VIO_Status mni_input_int( 1099 FILE *file, 1100 int *i ); 1101 1102 VIOAPI void output_comments( 1103 FILE *file, 1104 VIO_STR comments ); 1105 1106 VIOAPI VIO_STR get_default_tag_file_suffix( void ); 1107 1108 VIOAPI VIO_Status initialize_tag_file_output( 1109 FILE *file, 1110 VIO_STR comments, 1111 int n_volumes ); 1112 1113 VIOAPI VIO_Status output_one_tag( 1114 FILE *file, 1115 int n_volumes, 1116 VIO_Real tag_volume1[], 1117 VIO_Real tag_volume2[], 1118 VIO_Real *weight, 1119 int *structure_id, 1120 int *patient_id, 1121 VIO_STR label ); 1122 1123 VIOAPI void terminate_tag_file_output( 1124 FILE *file ); 1125 1126 VIOAPI VIO_Status output_tag_points( 1127 FILE *file, 1128 VIO_STR comments, 1129 int n_volumes, 1130 int n_tag_points, 1131 VIO_Real **tags_volume1, 1132 VIO_Real **tags_volume2, 1133 VIO_Real weights[], 1134 int structure_ids[], 1135 int patient_ids[], 1136 VIO_STR *labels ); 1137 1138 VIOAPI void free_tag_points( 1139 int n_volumes, 1140 int n_tag_points, 1141 VIO_Real **tags_volume1, 1142 VIO_Real **tags_volume2, 1143 VIO_Real weights[], 1144 int structure_ids[], 1145 int patient_ids[], 1146 char **labels ); 1147 1148 VIOAPI VIO_Status initialize_tag_file_input( 1149 FILE *file, 1150 int *n_volumes_ptr ); 1151 1152 VIOAPI VIO_Status output_tag_file( 1153 VIO_STR filename, 1154 VIO_STR comments, 1155 int n_volumes, 1156 int n_tag_points, 1157 VIO_Real **tags_volume1, 1158 VIO_Real **tags_volume2, 1159 VIO_Real weights[], 1160 int structure_ids[], 1161 int patient_ids[], 1162 VIO_STR labels[] ); 1163 1164 VIOAPI VIO_Status input_tag_file( 1165 VIO_STR filename, 1166 int *n_volumes, 1167 int *n_tag_points, 1168 VIO_Real ***tags_volume1, 1169 VIO_Real ***tags_volume2, 1170 VIO_Real **weights, 1171 int **structure_ids, 1172 int **patient_ids, 1173 VIO_STR *labels[] ); 1174 1175 VIOAPI VIO_BOOL input_one_tag( 1176 FILE *file, 1177 int n_volumes, 1178 VIO_Real tag_volume1[], 1179 VIO_Real tag_volume2[], 1180 VIO_Real *weight, 1181 int *structure_id, 1182 int *patient_id, 1183 VIO_STR *label, 1184 VIO_Status *status ); 1185 1186 VIOAPI VIO_Status input_tag_points( 1187 FILE *file, 1188 int *n_volumes_ptr, 1189 int *n_tag_points, 1190 VIO_Real ***tags_volume1, 1191 VIO_Real ***tags_volume2, 1192 VIO_Real **weights, 1193 int **structure_ids, 1194 int **patient_ids, 1195 VIO_STR *labels[] ); 1196 1197 VIOAPI void evaluate_thin_plate_spline( 1198 int n_dims, 1199 int n_values, 1200 int n_points, 1201 VIO_Real **points, 1202 VIO_Real **weights, 1203 VIO_Real pos[], 1204 VIO_Real values[], 1205 VIO_Real **derivs ); 1206 1207 VIOAPI void thin_plate_spline_transform( 1208 int n_dims, 1209 int n_points, 1210 VIO_Real **points, 1211 VIO_Real **weights, 1212 VIO_Real x, 1213 VIO_Real y, 1214 VIO_Real z, 1215 VIO_Real *x_transformed, 1216 VIO_Real *y_transformed, 1217 VIO_Real *z_transformed ); 1218 1219 VIOAPI void thin_plate_spline_inverse_transform( 1220 int n_dims, 1221 int n_points, 1222 VIO_Real **points, 1223 VIO_Real **weights, 1224 VIO_Real x, 1225 VIO_Real y, 1226 VIO_Real z, 1227 VIO_Real *x_transformed, 1228 VIO_Real *y_transformed, 1229 VIO_Real *z_transformed ); 1230 1231 VIOAPI VIO_Real thin_plate_spline_U( 1232 VIO_Real pos[], 1233 VIO_Real landmark[], 1234 int n_dims ); 1235 1236 VIOAPI VIO_STR get_default_transform_file_suffix( void ); 1237 1238 VIOAPI VIO_Status output_transform( 1239 FILE *file, 1240 VIO_STR filename, 1241 int *volume_count_ptr, 1242 VIO_STR comments, 1243 VIO_General_transform *transform ); 1244 1245 VIOAPI VIO_Status input_transform( 1246 FILE *file, 1247 VIO_STR filename, 1248 VIO_General_transform *transform ); 1249 1250 VIOAPI VIO_Status output_transform_file( 1251 VIO_STR filename, 1252 VIO_STR comments, 1253 VIO_General_transform *transform ); 1254 1255 VIOAPI VIO_Status input_transform_file( 1256 VIO_STR filename, 1257 VIO_General_transform *transform ); 1258 1259 VIOAPI void create_linear_transform( 1260 VIO_General_transform *transform, 1261 VIO_Transform *linear_transform ); 1262 1263 VIOAPI void create_thin_plate_transform_real( 1264 VIO_General_transform *transform, 1265 int n_dimensions, 1266 int n_points, 1267 VIO_Real **points, 1268 VIO_Real **displacements ); 1269 1270 VIOAPI void create_thin_plate_transform( 1271 VIO_General_transform *transform, 1272 int n_dimensions, 1273 int n_points, 1274 float **points, 1275 float **displacements ); 1276 1277 VIOAPI void create_grid_transform( 1278 VIO_General_transform *transform, 1279 VIO_Volume displacement_volume ); 1280 1281 VIOAPI void create_grid_transform_no_copy( 1282 VIO_General_transform *transform, 1283 VIO_Volume displacement_volume ); 1284 1285 VIOAPI void create_user_transform( 1286 VIO_General_transform *transform, 1287 void *user_data, 1288 size_t size_user_data, 1289 VIO_User_transform_function transform_function, 1290 VIO_User_transform_function inverse_transform_function ); 1291 1292 VIOAPI VIO_Transform_types get_transform_type( 1293 VIO_General_transform *transform ); 1294 1295 VIOAPI int get_n_concated_transforms( 1296 VIO_General_transform *transform ); 1297 1298 VIOAPI VIO_General_transform *get_nth_general_transform( 1299 VIO_General_transform *transform, 1300 int n ); 1301 1302 VIOAPI VIO_Transform *get_linear_transform_ptr( 1303 VIO_General_transform *transform ); 1304 1305 VIOAPI VIO_Transform *get_inverse_linear_transform_ptr( 1306 VIO_General_transform *transform ); 1307 1308 VIOAPI void general_transform_point( 1309 VIO_General_transform *transform, 1310 VIO_Real x, 1311 VIO_Real y, 1312 VIO_Real z, 1313 VIO_Real *x_transformed, 1314 VIO_Real *y_transformed, 1315 VIO_Real *z_transformed ); 1316 1317 VIOAPI void general_inverse_transform_point( 1318 VIO_General_transform *transform, 1319 VIO_Real x, 1320 VIO_Real y, 1321 VIO_Real z, 1322 VIO_Real *x_transformed, 1323 VIO_Real *y_transformed, 1324 VIO_Real *z_transformed ); 1325 1326 VIOAPI void copy_general_transform( 1327 VIO_General_transform *transform, 1328 VIO_General_transform *copy ); 1329 1330 VIOAPI void invert_general_transform( 1331 VIO_General_transform *transform ); 1332 1333 VIOAPI void create_inverse_general_transform( 1334 VIO_General_transform *transform, 1335 VIO_General_transform *inverse ); 1336 1337 VIOAPI void concat_general_transforms( 1338 VIO_General_transform *first, 1339 VIO_General_transform *second, 1340 VIO_General_transform *result ); 1341 1342 VIOAPI void delete_general_transform( 1343 VIO_General_transform *transform ); 1344 1345 VIOAPI VIO_Colour make_rgba_Colour( 1346 int r, 1347 int g, 1348 int b, 1349 int a ); 1350 1351 VIOAPI int get_Colour_r( 1352 VIO_Colour colour ); 1353 1354 VIOAPI int get_Colour_g( 1355 VIO_Colour colour ); 1356 1357 VIOAPI int get_Colour_b( 1358 VIO_Colour colour ); 1359 1360 VIOAPI int get_Colour_a( 1361 VIO_Colour colour ); 1362 1363 VIOAPI VIO_Colour make_Colour( 1364 int r, 1365 int g, 1366 int b ); 1367 1368 VIOAPI VIO_Real get_Colour_r_0_1( 1369 VIO_Colour colour ); 1370 1371 VIOAPI VIO_Real get_Colour_g_0_1( 1372 VIO_Colour colour ); 1373 1374 VIOAPI VIO_Real get_Colour_b_0_1( 1375 VIO_Colour colour ); 1376 1377 VIOAPI VIO_Real get_Colour_a_0_1( 1378 VIO_Colour colour ); 1379 1380 VIOAPI VIO_Colour make_Colour_0_1( 1381 VIO_Real r, 1382 VIO_Real g, 1383 VIO_Real b ); 1384 1385 VIOAPI VIO_Colour make_rgba_Colour_0_1( 1386 VIO_Real r, 1387 VIO_Real g, 1388 VIO_Real b, 1389 VIO_Real a ); 1390 1391 VIOAPI VIO_BOOL solve_linear_system( 1392 int n, 1393 VIO_Real **coefs, 1394 VIO_Real values[], 1395 VIO_Real solution[] ); 1396 1397 VIOAPI VIO_BOOL invert_square_matrix( 1398 int n, 1399 VIO_Real **matrix, 1400 VIO_Real **inverse ); 1401 1402 VIOAPI VIO_BOOL newton_root_find( 1403 int n_dimensions, 1404 void (*function) ( void *, VIO_Real [], VIO_Real [], VIO_Real ** ), 1405 void *function_data, 1406 VIO_Real initial_guess[], 1407 VIO_Real desired_values[], 1408 VIO_Real solution[], 1409 VIO_Real function_tolerance, 1410 VIO_Real delta_tolerance, 1411 int max_iterations ); 1412 1413 VIOAPI void create_orthogonal_vector( 1414 VIO_Vector *v, 1415 VIO_Vector *ortho ); 1416 1417 VIOAPI void create_two_orthogonal_vectors( 1418 VIO_Vector *v, 1419 VIO_Vector *v1, 1420 VIO_Vector *v2 ); 1421 1422 VIOAPI VIO_BOOL compute_transform_inverse( 1423 VIO_Transform *transform, 1424 VIO_Transform *inverse ); 1425 1426 VIOAPI void get_linear_spline_coefs( 1427 VIO_Real **coefs ); 1428 1429 VIOAPI void get_quadratic_spline_coefs( 1430 VIO_Real **coefs ); 1431 1432 VIOAPI void get_cubic_spline_coefs( 1433 VIO_Real **coefs ); 1434 1435 VIOAPI VIO_Real cubic_interpolate( 1436 VIO_Real u, 1437 VIO_Real v0, 1438 VIO_Real v1, 1439 VIO_Real v2, 1440 VIO_Real v3 ); 1441 1442 VIOAPI void evaluate_univariate_interpolating_spline( 1443 VIO_Real u, 1444 int degree, 1445 VIO_Real coefs[], 1446 int n_derivs, 1447 VIO_Real derivs[] ); 1448 1449 VIOAPI void evaluate_bivariate_interpolating_spline( 1450 VIO_Real u, 1451 VIO_Real v, 1452 int degree, 1453 VIO_Real coefs[], 1454 int n_derivs, 1455 VIO_Real derivs[] ); 1456 1457 VIOAPI void evaluate_trivariate_interpolating_spline( 1458 VIO_Real u, 1459 VIO_Real v, 1460 VIO_Real w, 1461 int degree, 1462 VIO_Real coefs[], 1463 int n_derivs, 1464 VIO_Real derivs[] ); 1465 1466 VIOAPI void evaluate_interpolating_spline( 1467 int n_dims, 1468 VIO_Real parameters[], 1469 int degree, 1470 int n_values, 1471 VIO_Real coefs[], 1472 int n_derivs, 1473 VIO_Real derivs[] ); 1474 1475 VIOAPI void spline_tensor_product( 1476 int n_dims, 1477 VIO_Real positions[], 1478 int degrees[], 1479 VIO_Real *bases[], 1480 int n_values, 1481 VIO_Real coefs[], 1482 int n_derivs[], 1483 VIO_Real results[] ); 1484 1485 VIOAPI void make_identity_transform( VIO_Transform *transform ); 1486 1487 VIOAPI VIO_BOOL close_to_identity( 1488 VIO_Transform *transform ); 1489 1490 VIOAPI void get_transform_origin( 1491 VIO_Transform *transform, 1492 VIO_Point *origin ); 1493 1494 VIOAPI void set_transform_origin( 1495 VIO_Transform *transform, 1496 VIO_Point *origin ); 1497 1498 VIOAPI void get_transform_origin_real( 1499 VIO_Transform *transform, 1500 VIO_Real origin[] ); 1501 1502 VIOAPI void get_transform_x_axis( 1503 VIO_Transform *transform, 1504 VIO_Vector *x_axis ); 1505 1506 VIOAPI void get_transform_x_axis_real( 1507 VIO_Transform *transform, 1508 VIO_Real x_axis[] ); 1509 1510 VIOAPI void set_transform_x_axis( 1511 VIO_Transform *transform, 1512 VIO_Vector *x_axis ); 1513 1514 VIOAPI void set_transform_x_axis_real( 1515 VIO_Transform *transform, 1516 VIO_Real x_axis[] ); 1517 1518 VIOAPI void get_transform_y_axis( 1519 VIO_Transform *transform, 1520 VIO_Vector *y_axis ); 1521 1522 VIOAPI void get_transform_y_axis_real( 1523 VIO_Transform *transform, 1524 VIO_Real y_axis[] ); 1525 1526 VIOAPI void set_transform_y_axis( 1527 VIO_Transform *transform, 1528 VIO_Vector *y_axis ); 1529 1530 VIOAPI void set_transform_y_axis_real( 1531 VIO_Transform *transform, 1532 VIO_Real y_axis[] ); 1533 1534 VIOAPI void get_transform_z_axis( 1535 VIO_Transform *transform, 1536 VIO_Vector *z_axis ); 1537 1538 VIOAPI void get_transform_z_axis_real( 1539 VIO_Transform *transform, 1540 VIO_Real z_axis[] ); 1541 1542 VIOAPI void set_transform_z_axis( 1543 VIO_Transform *transform, 1544 VIO_Vector *z_axis ); 1545 1546 VIOAPI void set_transform_z_axis_real( 1547 VIO_Transform *transform, 1548 VIO_Real z_axis[] ); 1549 1550 VIOAPI void make_change_to_bases_transform( 1551 VIO_Point *origin, 1552 VIO_Vector *x_axis, 1553 VIO_Vector *y_axis, 1554 VIO_Vector *z_axis, 1555 VIO_Transform *transform ); 1556 1557 VIOAPI void make_change_from_bases_transform( 1558 VIO_Point *origin, 1559 VIO_Vector *x_axis, 1560 VIO_Vector *y_axis, 1561 VIO_Vector *z_axis, 1562 VIO_Transform *transform ); 1563 1564 VIOAPI void concat_transforms( 1565 VIO_Transform *result, 1566 VIO_Transform *t1, 1567 VIO_Transform *t2 ); 1568 1569 VIOAPI void transform_point( 1570 VIO_Transform *transform, 1571 VIO_Real x, 1572 VIO_Real y, 1573 VIO_Real z, 1574 VIO_Real *x_trans, 1575 VIO_Real *y_trans, 1576 VIO_Real *z_trans ); 1577 1578 VIOAPI void transform_vector( 1579 VIO_Transform *transform, 1580 VIO_Real x, 1581 VIO_Real y, 1582 VIO_Real z, 1583 VIO_Real *x_trans, 1584 VIO_Real *y_trans, 1585 VIO_Real *z_trans ); 1586 1587 VIOAPI void *alloc_memory_in_bytes( 1588 size_t n_bytes 1589 _ALLOC_SOURCE_LINE_ARG_DEF ); 1590 1591 VIOAPI void *alloc_memory_1d( 1592 size_t n_elements, 1593 size_t type_size 1594 _ALLOC_SOURCE_LINE_ARG_DEF ); 1595 1596 VIOAPI void *alloc_memory_2d( 1597 size_t n1, 1598 size_t n2, 1599 size_t type_size 1600 _ALLOC_SOURCE_LINE_ARG_DEF ); 1601 1602 VIOAPI void *alloc_memory_3d( 1603 size_t n1, 1604 size_t n2, 1605 size_t n3, 1606 size_t type_size 1607 _ALLOC_SOURCE_LINE_ARG_DEF ); 1608 1609 VIOAPI void *alloc_memory_4d( 1610 size_t n1, 1611 size_t n2, 1612 size_t n3, 1613 size_t n4, 1614 size_t type_size 1615 _ALLOC_SOURCE_LINE_ARG_DEF ); 1616 1617 VIOAPI void *alloc_memory_5d( 1618 size_t n1, 1619 size_t n2, 1620 size_t n3, 1621 size_t n4, 1622 size_t n5, 1623 size_t type_size 1624 _ALLOC_SOURCE_LINE_ARG_DEF ); 1625 1626 VIOAPI void realloc_memory( 1627 void **ptr, 1628 size_t n_elements, 1629 size_t type_size 1630 _ALLOC_SOURCE_LINE_ARG_DEF ); 1631 1632 VIOAPI void free_memory_1d( 1633 void **ptr 1634 _ALLOC_SOURCE_LINE_ARG_DEF ); 1635 1636 VIOAPI void free_memory_2d( 1637 void ***ptr 1638 _ALLOC_SOURCE_LINE_ARG_DEF ); 1639 1640 VIOAPI void free_memory_3d( 1641 void ****ptr 1642 _ALLOC_SOURCE_LINE_ARG_DEF ); 1643 1644 VIOAPI void free_memory_4d( 1645 void *****ptr 1646 _ALLOC_SOURCE_LINE_ARG_DEF ); 1647 1648 VIOAPI void free_memory_5d( 1649 void ******ptr 1650 _ALLOC_SOURCE_LINE_ARG_DEF ); 1651 1652 VIOAPI size_t get_total_memory_alloced( void ); 1653 1654 VIOAPI VIO_BOOL alloc_checking_enabled( void ); 1655 1656 VIOAPI void set_alloc_checking( VIO_BOOL state ); 1657 1658 VIOAPI void record_ptr_alloc_check( 1659 void *ptr, 1660 size_t n_bytes, 1661 VIO_STR source_file, 1662 int line_number ); 1663 1664 VIOAPI void change_ptr_alloc_check( 1665 void *old_ptr, 1666 void *new_ptr, 1667 size_t n_bytes, 1668 VIO_STR source_file, 1669 int line_number ); 1670 1671 VIOAPI VIO_BOOL unrecord_ptr_alloc_check( 1672 void *ptr, 1673 VIO_STR source_file, 1674 int line_number ); 1675 1676 VIOAPI void output_alloc_to_file( 1677 VIO_STR filename ); 1678 1679 VIOAPI void print_alloc_source_line( 1680 VIO_STR filename, 1681 int line_number ); 1682 1683 VIOAPI void set_array_size( 1684 void **array, 1685 size_t type_size, 1686 size_t previous_n_elems, 1687 size_t new_n_elems, 1688 size_t chunk_size 1689 _ALLOC_SOURCE_LINE_ARG_DEF ); 1690 1691 VIOAPI VIO_BOOL real_is_double( void ); 1692 1693 VIOAPI VIO_BOOL file_exists( 1694 VIO_STR filename ); 1695 1696 VIOAPI VIO_BOOL file_directory_exists( 1697 VIO_STR filename ); 1698 1699 VIOAPI VIO_BOOL check_clobber_file( 1700 VIO_STR filename ); 1701 1702 VIOAPI VIO_BOOL check_clobber_file_default_suffix( 1703 VIO_STR filename, 1704 VIO_STR default_suffix ); 1705 1706 VIOAPI VIO_Status make_backup_file( 1707 VIO_STR filename, 1708 VIO_STR *backup_filename ); 1709 1710 VIOAPI void cleanup_backup_file( 1711 VIO_STR filename, 1712 VIO_STR backup_filename, 1713 VIO_Status status_of_write ); 1714 1715 VIOAPI void remove_file( 1716 VIO_STR filename ); 1717 1718 VIOAPI VIO_Status copy_file( 1719 VIO_STR src, 1720 VIO_STR dest ); 1721 1722 VIOAPI VIO_Status move_file( 1723 VIO_STR src, 1724 VIO_STR dest ); 1725 1726 VIOAPI VIO_STR expand_filename( 1727 VIO_STR filename ); 1728 1729 VIOAPI VIO_BOOL filename_extension_matches( 1730 VIO_STR filename, 1731 VIO_STR extension ); 1732 1733 VIOAPI VIO_STR remove_directories_from_filename( 1734 VIO_STR filename ); 1735 1736 VIOAPI VIO_BOOL file_exists_as_compressed( 1737 VIO_STR filename, 1738 VIO_STR *compressed_filename ); 1739 1740 VIOAPI VIO_STR get_temporary_filename( void ); 1741 1742 VIOAPI VIO_Status open_file( 1743 VIO_STR filename, 1744 VIO_IO_types io_type, 1745 VIO_File_formats file_format, 1746 FILE **file ); 1747 1748 VIOAPI VIO_Status open_file_with_default_suffix( 1749 VIO_STR filename, 1750 VIO_STR default_suffix, 1751 VIO_IO_types io_type, 1752 VIO_File_formats file_format, 1753 FILE **file ); 1754 1755 VIOAPI VIO_Status set_file_position( 1756 FILE *file, 1757 long byte_position ); 1758 1759 VIOAPI VIO_Status close_file( 1760 FILE *file ); 1761 1762 VIOAPI VIO_STR extract_directory( 1763 VIO_STR filename ); 1764 1765 VIOAPI VIO_STR get_absolute_filename( 1766 VIO_STR filename, 1767 VIO_STR directory ); 1768 1769 VIOAPI VIO_Status flush_file( 1770 FILE *file ); 1771 1772 VIOAPI VIO_Status input_character( 1773 FILE *file, 1774 char *ch ); 1775 1776 VIOAPI VIO_Status unget_character( 1777 FILE *file, 1778 char ch ); 1779 1780 VIOAPI VIO_Status input_nonwhite_character( 1781 FILE *file, 1782 char *ch ); 1783 1784 VIOAPI VIO_Status output_character( 1785 FILE *file, 1786 char ch ); 1787 1788 VIOAPI VIO_Status skip_input_until( 1789 FILE *file, 1790 char search_char ); 1791 1792 VIOAPI VIO_Status output_string( 1793 FILE *file, 1794 VIO_STR str ); 1795 1796 VIOAPI VIO_Status input_string( 1797 FILE *file, 1798 VIO_STR *str, 1799 char termination_char ); 1800 1801 VIOAPI VIO_Status input_quoted_string( 1802 FILE *file, 1803 VIO_STR *str ); 1804 1805 VIOAPI VIO_Status input_possibly_quoted_string( 1806 FILE *file, 1807 VIO_STR *str ); 1808 1809 VIOAPI VIO_Status output_quoted_string( 1810 FILE *file, 1811 VIO_STR str ); 1812 1813 VIOAPI VIO_Status input_binary_data( 1814 FILE *file, 1815 void *data, 1816 size_t element_size, 1817 int n ); 1818 1819 VIOAPI VIO_Status output_binary_data( 1820 FILE *file, 1821 void *data, 1822 size_t element_size, 1823 int n ); 1824 1825 VIOAPI VIO_Status input_newline( 1826 FILE *file ); 1827 1828 VIOAPI VIO_Status output_newline( 1829 FILE *file ); 1830 1831 VIOAPI VIO_Status input_line( 1832 FILE *file, 1833 VIO_STR *line ); 1834 1835 VIOAPI VIO_Status input_boolean( 1836 FILE *file, 1837 VIO_BOOL *b ); 1838 1839 VIOAPI VIO_Status output_boolean( 1840 FILE *file, 1841 VIO_BOOL b ); 1842 1843 VIOAPI VIO_Status input_short( 1844 FILE *file, 1845 short *s ); 1846 1847 VIOAPI VIO_Status output_short( 1848 FILE *file, 1849 short s ); 1850 1851 VIOAPI VIO_Status input_unsigned_short( 1852 FILE *file, 1853 unsigned short *s ); 1854 1855 VIOAPI VIO_Status output_unsigned_short( 1856 FILE *file, 1857 unsigned short s ); 1858 1859 VIOAPI VIO_Status input_int( 1860 FILE *file, 1861 int *i ); 1862 1863 VIOAPI VIO_Status output_int( 1864 FILE *file, 1865 int i ); 1866 1867 VIOAPI VIO_Status input_real( 1868 FILE *file, 1869 VIO_Real *r ); 1870 1871 VIOAPI VIO_Status output_real( 1872 FILE *file, 1873 VIO_Real r ); 1874 1875 VIOAPI VIO_Status input_float( 1876 FILE *file, 1877 float *f ); 1878 1879 VIOAPI VIO_Status output_float( 1880 FILE *file, 1881 float f ); 1882 1883 VIOAPI VIO_Status input_double( 1884 FILE *file, 1885 double *d ); 1886 1887 VIOAPI VIO_Status output_double( 1888 FILE *file, 1889 double d ); 1890 1891 VIOAPI VIO_Status io_binary_data( 1892 FILE *file, 1893 VIO_IO_types io_flag, 1894 void *data, 1895 size_t element_size, 1896 int n ); 1897 1898 VIOAPI VIO_Status io_newline( 1899 FILE *file, 1900 VIO_IO_types io_flag, 1901 VIO_File_formats format ); 1902 1903 VIOAPI VIO_Status io_quoted_string( 1904 FILE *file, 1905 VIO_IO_types io_flag, 1906 VIO_File_formats format, 1907 VIO_STR *str ); 1908 1909 VIOAPI VIO_Status io_boolean( 1910 FILE *file, 1911 VIO_IO_types io_flag, 1912 VIO_File_formats format, 1913 VIO_BOOL *b ); 1914 1915 VIOAPI VIO_Status io_short( 1916 FILE *file, 1917 VIO_IO_types io_flag, 1918 VIO_File_formats format, 1919 short *short_int ); 1920 1921 VIOAPI VIO_Status io_unsigned_short( 1922 FILE *file, 1923 VIO_IO_types io_flag, 1924 VIO_File_formats format, 1925 unsigned short *unsigned_short ); 1926 1927 VIOAPI VIO_Status io_unsigned_char( 1928 FILE *file, 1929 VIO_IO_types io_flag, 1930 VIO_File_formats format, 1931 unsigned char *c ); 1932 1933 VIOAPI VIO_Status io_int( 1934 FILE *file, 1935 VIO_IO_types io_flag, 1936 VIO_File_formats format, 1937 int *i ); 1938 1939 VIOAPI VIO_Status io_real( 1940 FILE *file, 1941 VIO_IO_types io_flag, 1942 VIO_File_formats format, 1943 VIO_Real *r ); 1944 1945 VIOAPI VIO_Status io_float( 1946 FILE *file, 1947 VIO_IO_types io_flag, 1948 VIO_File_formats format, 1949 float *f ); 1950 1951 VIOAPI VIO_Status io_double( 1952 FILE *file, 1953 VIO_IO_types io_flag, 1954 VIO_File_formats format, 1955 double *d ); 1956 1957 VIOAPI VIO_Status io_ints( 1958 FILE *file, 1959 VIO_IO_types io_flag, 1960 VIO_File_formats format, 1961 int n, 1962 int *ints[] ); 1963 1964 VIOAPI VIO_Status io_unsigned_chars( 1965 FILE *file, 1966 VIO_IO_types io_flag, 1967 VIO_File_formats format, 1968 int n, 1969 unsigned char *unsigned_chars[] ); 1970 1971 VIOAPI void set_print_function( void (*function) ( VIO_STR ) ); 1972 1973 VIOAPI void push_print_function( void ); 1974 1975 VIOAPI void pop_print_function( void ); 1976 1977 VIOAPI void print( VIO_STR format, ... ); 1978 1979 VIOAPI void set_print_error_function( void (*function) ( char [] ) ); 1980 1981 VIOAPI void push_print_error_function( void ); 1982 1983 VIOAPI void pop_print_error_function( void ); 1984 1985 VIOAPI void print_error( char format[], ... ); 1986 1987 VIOAPI void handle_internal_error( char str[] ); 1988 1989 VIOAPI void abort_if_allowed( void ); 1990 1991 VIOAPI void initialize_progress_report( 1992 VIO_progress_struct *progress, 1993 VIO_BOOL one_line_only, 1994 int n_steps, 1995 VIO_STR title ); 1996 1997 VIOAPI void update_progress_report( 1998 VIO_progress_struct *progress, 1999 int current_step ); 2000 2001 VIOAPI void terminate_progress_report( 2002 VIO_progress_struct *progress ); 2003 2004 VIOAPI VIO_STR alloc_string( 2005 int length ); 2006 2007 VIOAPI VIO_STR create_string( 2008 VIO_STR initial ); 2009 2010 VIOAPI void delete_string( 2011 VIO_STR string ); 2012 2013 VIOAPI VIO_STR concat_strings( 2014 VIO_STR str1, 2015 VIO_STR str2 ); 2016 2017 VIOAPI void replace_string( 2018 VIO_STR *string, 2019 VIO_STR new_string ); 2020 2021 VIOAPI void concat_char_to_string( 2022 VIO_STR *string, 2023 char ch ); 2024 2025 VIOAPI void concat_to_string( 2026 VIO_STR *string, 2027 VIO_STR str2 ); 2028 2029 VIOAPI int string_length( 2030 VIO_STR string ); 2031 2032 VIOAPI VIO_BOOL equal_strings( 2033 VIO_STR str1, 2034 VIO_STR str2 ); 2035 2036 VIOAPI VIO_BOOL is_lower_case( 2037 char ch ); 2038 2039 VIOAPI VIO_BOOL is_upper_case( 2040 char ch ); 2041 2042 VIOAPI char get_lower_case( 2043 char ch ); 2044 2045 VIOAPI char get_upper_case( 2046 char ch ); 2047 2048 VIOAPI VIO_BOOL string_ends_in( 2049 VIO_STR string, 2050 VIO_STR ending ); 2051 2052 VIOAPI VIO_STR strip_outer_blanks( 2053 VIO_STR str ); 2054 2055 VIOAPI int find_character( 2056 VIO_STR string, 2057 char ch ); 2058 2059 VIOAPI void make_string_upper_case( 2060 VIO_STR string ); 2061 2062 VIOAPI VIO_BOOL blank_string( 2063 VIO_STR string ); 2064 2065 VIOAPI VIO_Real current_cpu_seconds( void ); 2066 2067 VIOAPI VIO_Real current_realtime_seconds( void ); 2068 2069 VIOAPI VIO_STR format_time( 2070 VIO_STR format, 2071 VIO_Real seconds ); 2072 2073 VIOAPI void print_time( 2074 VIO_STR format, 2075 VIO_Real seconds ); 2076 2077 VIOAPI VIO_STR get_clock_time( void ); 2078 2079 VIOAPI void sleep_program( VIO_Real seconds ); 2080 2081 VIOAPI VIO_STR get_date( void ); 2082 #endif 2083