Mercurial > hg > minc-tools
changeset 974:7629ee12f97b
check_in_all
author | david <david> |
---|---|
date | Tue, 19 Dec 1995 15:47:10 +0000 |
parents | 768803ed1aed |
children | 8bc949195ebf |
files | volume_io/Geometry/points.c volume_io/Include/volume_io/basic.h volume_io/Include/volume_io/geom_structs.h volume_io/Include/volume_io/multidim.h volume_io/Include/volume_io/system_dependent.h volume_io/MNI_formats/gen_xfs.c volume_io/Prog_utils/alloc_check.c volume_io/Prog_utils/progress.c volume_io/Prog_utils/time.c volume_io/Testing/test_virtual_volume.c volume_io/Volumes/output_mnc.c |
diffstat | 11 files changed, 98 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/volume_io/Geometry/points.c +++ b/volume_io/Geometry/points.c @@ -15,7 +15,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Geometry/points.c,v 1.10 1995-07-31 13:44:27 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Geometry/points.c,v 1.11 1995-12-19 15:47:10 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -26,8 +26,8 @@ @DESCRIPTION: Creates a vector which is not colinear with the given vector. This is used, for instance, when creating a vector which is perpendicular to a given vector. -@METHOD : Copies v to not_v and sets the largest absolute component of - not_v to 0. +@METHOD : Copies v to not_v and interchanges the largest absolute + component with the smallest absolute component. @GLOBALS : @CALLS : @CREATED : 1993 David MacDonald @@ -38,8 +38,8 @@ Vector *v, Vector *not_v ) { - int max_index; - Real abs_x, abs_y, abs_z; + int max_index, min_index; + Real abs_x, abs_y, abs_z, min_abs, max_abs; abs_x = ABS( Vector_x(*v) ); abs_y = ABS( Vector_y(*v) ); @@ -47,18 +47,27 @@ if( abs_x > abs_y ) { - if( abs_x > abs_z ) - max_index = X; - else - max_index = Z; + max_index = X; + min_index = Y; + max_abs = abs_x; + min_abs = abs_y; } - else if( abs_y > abs_z ) + else + { max_index = Y; - else + min_index = X; + max_abs = abs_y; + min_abs = abs_x; + } + + if( abs_z > max_abs ) max_index = Z; + else if( abs_z < min_abs ) + min_index = Z; *not_v = *v; - Vector_coord( *not_v, max_index ) = 0.0; + Vector_coord( *not_v, max_index ) = Vector_coord( *v, min_index ); + Vector_coord( *not_v, min_index ) = Vector_coord( *v, max_index ); } /* ----------------------------- MNI Header -----------------------------------
--- a/volume_io/Include/volume_io/basic.h +++ b/volume_io/Include/volume_io/basic.h @@ -29,7 +29,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char basic_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/basic.h,v 1.24 1995-10-19 15:46:41 david Exp $"; +static char basic_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/basic.h,v 1.25 1995-12-19 15:47:12 david Exp $"; #endif #include <stdlib.h> @@ -104,9 +104,7 @@ /* --------- C and LINT stuff -------------------------- */ -#define USE_ANSI - -#ifdef USE_ANSI +#ifdef __STDC__ #define GLUE(x,y) x##y #define GLUE3(x,y,z) x##y##z #define CREATE_STRING(x) #x
--- a/volume_io/Include/volume_io/geom_structs.h +++ b/volume_io/Include/volume_io/geom_structs.h @@ -16,7 +16,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char geom_structs_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/geom_structs.h,v 1.16 1995-07-31 13:44:32 david Exp $"; +static char geom_structs_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/geom_structs.h,v 1.17 1995-12-19 15:47:12 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -125,7 +125,7 @@ @MODIFIED : ---------------------------------------------------------------------------- */ -#ifdef dec +#ifdef __alpha typedef unsigned int Colour; #else typedef unsigned long Colour;
--- a/volume_io/Include/volume_io/multidim.h +++ b/volume_io/Include/volume_io/multidim.h @@ -16,7 +16,7 @@ ---------------------------------------------------------------------------- */ #ifndef lint -static char multidim_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/multidim.h,v 1.1 1995-11-17 21:01:08 david Exp $"; +static char multidim_rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Include/volume_io/multidim.h,v 1.2 1995-12-19 15:47:13 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -91,6 +91,36 @@ break; \ } +#define GET_MULTIDIM_TYPE_1D( array, type, v0 ) \ + (((type *) ((array).data)) [v0]) + +#define GET_MULTIDIM_TYPE_2D( array, type, v0, v1 ) \ + (((type **) ((array).data)) [v0][v1]) + +#define GET_MULTIDIM_TYPE_3D( array, type, v0, v1, v2 ) \ + (((type ***) ((array).data)) [v0][v1][v2]) + +#define GET_MULTIDIM_TYPE_4D( array, type, v0, v1, v2, v3 ) \ + (((type ****) ((array).data)) [v0][v1][v2][v3]) + +#define GET_MULTIDIM_TYPE_5D( array, type, v0, v1, v2, v3, v4 ) \ + (((type *****) ((array).data)) [v0][v1][v2][v3][v4]) + +#define SET_MULTIDIM_TYPE_1D( array, type, v0, value ) \ + (GET_MULTIDIM_TYPE_1D( array, type, v0 ) = (type) (value)) + +#define SET_MULTIDIM_TYPE_2D( array, type, v0, v1, value ) \ + (GET_MULTIDIM_TYPE_2D( array, type, v0, v1 ) = (type) (value)) + +#define SET_MULTIDIM_TYPE_3D( array, type, v0, v1, v2, value ) \ + (GET_MULTIDIM_TYPE_3D( array, type, v0, v1, v2 ) = (type) (value)) + +#define SET_MULTIDIM_TYPE_4D( array, type, v0, v1, v2, v3, value ) \ + (GET_MULTIDIM_TYPE_4D( array, type, v0, v1, v2, v3 ) = (type) (value)) + +#define SET_MULTIDIM_TYPE_5D( array, type, v0, v1, v2, v3, v4, value ) \ + (GET_MULTIDIM_TYPE_5D( array, type, v0, v1, v2, v3, v4 ) = (type) (value)) + /* --- public macros to set the [x][y]... voxel of 'array' to 'value' */ #define SET_MULTIDIM_1D( array, x, value ) \
--- a/volume_io/Include/volume_io/system_dependent.h +++ b/volume_io/Include/volume_io/system_dependent.h @@ -14,16 +14,21 @@ express or implied warranty. ---------------------------------------------------------------------------- */ -#ifdef sun - +#ifdef NO_DBL_MAX #ifndef DBL_MAX #include <values.h> #define DBL_MAX MAXDOUBLE #endif +#endif /* NO_DBL_MAX */ +#include <stdlib.h> + +#ifndef EXIT_FAILURE #define EXIT_FAILURE 1 +#endif + +#ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 - -#endif /* sun */ +#endif #endif
--- a/volume_io/MNI_formats/gen_xfs.c +++ b/volume_io/MNI_formats/gen_xfs.c @@ -15,7 +15,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/MNI_formats/gen_xfs.c,v 1.20 1995-10-19 15:47:12 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/MNI_formats/gen_xfs.c,v 1.21 1995-12-19 15:47:20 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -809,6 +809,25 @@ } /* ----------------------------- MNI Header ----------------------------------- +@NAME : invert_general_transform +@INPUT : transform +@OUTPUT : transform +@RETURNS : +@DESCRIPTION: Inverts a general transform in place. +@METHOD : +@GLOBALS : +@CALLS : +@CREATED : Nov. 20, 1995 David MacDonald +@MODIFIED : +---------------------------------------------------------------------------- */ + +public void invert_general_transform( + General_transform *transform ) +{ + transform->inverse_flag = !transform->inverse_flag; +} + +/* ----------------------------- MNI Header ----------------------------------- @NAME : create_inverse_general_transform @INPUT : transform @OUTPUT : inverse
--- a/volume_io/Prog_utils/alloc_check.c +++ b/volume_io/Prog_utils/alloc_check.c @@ -15,7 +15,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/alloc_check.c,v 1.19 1995-10-19 15:46:43 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/alloc_check.c,v 1.20 1995-12-19 15:47:14 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -353,9 +353,7 @@ private Real get_random_0_to_1( void ) { -#define MAX_RAND 2147483648.0 - - return( (Real) random() / MAX_RAND ); + return( (Real) rand() ); } /* ----------------------------- MNI Header ----------------------------------- @@ -899,7 +897,7 @@ "Please report this file to the author of the program.\n" ); print_error( "\n" ); - if( filename != NULL && filename[0] != NULL ) + if( filename != NULL && filename[0] != (char) 0 ) file = fopen( filename, "w" ); else file = stdout;
--- a/volume_io/Prog_utils/progress.c +++ b/volume_io/Prog_utils/progress.c @@ -15,7 +15,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/progress.c,v 1.7 1995-10-19 15:46:47 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/progress.c,v 1.8 1995-12-19 15:47:15 david Exp $"; #endif #define FIRST_MESSAGE_THRESHOLD 5.0 @@ -250,25 +250,20 @@ Real est_total_time ) { int percent_done; - Real time_remaining; - STRING time_so_far_str, est_total_time_str, time_remaining_str; + STRING time_so_far_str, est_total_time_str; percent_done = ROUND( 100.0 * (Real) current_step / (Real) progress->n_steps ); - time_remaining = est_total_time - time_so_far; - time_so_far_str = format_time( "%g %s", time_so_far ); est_total_time_str = format_time( "%g %s", est_total_time ); - time_remaining_str = format_time( "%g %s", time_remaining ); - print( "%s: %3d%% done. (%d/%d) (%s out of approx %s with %s remaining)\n", + print( "%s: %3d%% done. (%d/%d) Time: %s out of approx %s\n", progress->title, percent_done, current_step, progress->n_steps, - time_so_far_str, est_total_time_str, time_remaining_str ); + time_so_far_str, est_total_time_str ); delete_string( time_so_far_str ); delete_string( est_total_time_str ); - delete_string( time_remaining_str ); (void) flush_file( stdout ); }
--- a/volume_io/Prog_utils/time.c +++ b/volume_io/Prog_utils/time.c @@ -19,7 +19,7 @@ #include <internal_volume_io.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/time.c,v 1.16 1995-10-19 15:46:46 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Prog_utils/time.c,v 1.17 1995-12-19 15:47:15 david Exp $"; #endif /* ----------------------------- MNI Header ----------------------------------- @@ -238,7 +238,7 @@ time_t clock_time; struct tm *time_tm; char *str; -#ifndef sgi +#ifndef __sgi time_t time(); #endif @@ -273,7 +273,7 @@ (void) select( 0, NULL, NULL, NULL, &timeout ); #ifdef OLD -#ifdef sgi +#ifdef __sgi struct timespec rqtp, rmtp; rqtp.tv_sec = FLOOR( seconds ); @@ -310,7 +310,7 @@ time_t clock_time; struct tm *time_tm; char *str; -#ifndef sgi +#ifndef __sgi time_t time(); #endif
--- a/volume_io/Testing/test_virtual_volume.c +++ b/volume_io/Testing/test_virtual_volume.c @@ -22,9 +22,6 @@ #define X_SIZE 81 #define Y_SIZE 88 #define Z_SIZE 82 -#define X_SIZE 31 -#define Y_SIZE 38 -#define Z_SIZE 32 #define BLOCK_SIZE_0 8 #define BLOCK_SIZE_1 9
--- a/volume_io/Volumes/output_mnc.c +++ b/volume_io/Volumes/output_mnc.c @@ -16,7 +16,7 @@ #include <minc.h> #ifndef lint -static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Volumes/output_mnc.c,v 1.42 1995-11-17 20:25:42 david Exp $"; +static char rcsid[] = "$Header: /private-cvsroot/minc/volume_io/Volumes/output_mnc.c,v 1.43 1995-12-19 15:47:18 david Exp $"; #endif #define INVALID_AXIS -1 @@ -225,8 +225,7 @@ int n_volume_dims; double valid_range[2]; int d, vol_index, n_range_dims; - static STRING default_dim_names[] = { { MIzspace }, { MIyspace }, - { MIxspace } }; + static STRING default_dim_names[] = { MIzspace, MIyspace, MIxspace }; STRING *vol_dimension_names; minc_output_options default_options;