Skip to content

Commit

Permalink
MINC 2023-11-14 (15d994de)
Browse files Browse the repository at this point in the history
Code extracted from:

    https://github.com/BIC-MNI/libminc.git

at commit 15d994def83274b715711afffa73268167ec2cc6 (develop).
  • Loading branch information
vfonov authored and seanm committed Nov 16, 2023
1 parent 8a13bf6 commit c3952a8
Show file tree
Hide file tree
Showing 49 changed files with 106 additions and 95 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ PROJECT(LIBMINC)

SET(LIBMINC_PACKAGE_VERSION_MAJOR 2)
SET(LIBMINC_PACKAGE_VERSION_MINOR 4)
SET(LIBMINC_PACKAGE_VERSION_PATCH 05)
SET(LIBMINC_PACKAGE_VERSION_PATCH 06)

SET(LIBMINC_SOVERSION "5.3.0")

SET(LIBMINC_PACKAGE "libminc")
SET(LIBMINC_PACKAGE_BUGREPORT "a.janke@gmail.com")
SET(LIBMINC_PACKAGE_BUGREPORT "vladimir.fonov@gmail.com")

SET(LIBMINC_PACKAGE_NAME "libminc")
SET(LIBMINC_PACKAGE_VERSION "${LIBMINC_PACKAGE_VERSION_MAJOR}.${LIBMINC_PACKAGE_VERSION_MINOR}.${LIBMINC_PACKAGE_VERSION_PATCH}")
Expand Down Expand Up @@ -54,6 +54,8 @@ IF(NOT LIBMINC_EXTERNALLY_CONFIGURED)
OPTION(LIBMINC_USE_NIFTI "Build with NIfTI support" OFF)
OPTION(LIBMINC_USE_SYSTEM_NIFTI "Use system NIfTI-1 library" OFF)

OPTION(LIBMINC_USE_ASAN "Build with Address Sanitizer" OFF)

SET (LIBMINC_EXPORTED_TARGETS "LIBMINC-targets")
SET (LIBMINC_INSTALL_BIN_DIR bin)
SET (LIBMINC_INSTALL_LIB_DIR lib${LIB_SUFFIX})
Expand Down Expand Up @@ -109,6 +111,13 @@ IF(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF(UNIX)


IF(LIBMINC_USE_ASAN)
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
add_link_options(-fno-omit-frame-pointer -fsanitize=address)
ENDIF(LIBMINC_USE_ASAN)


# check for prereqs
INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists)
Expand Down
4 changes: 2 additions & 2 deletions libcommon/ParseArgv.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void PrintVersion(ArgvInfo *argTable);
*
* Quick replacement for strtol which eliminates the undesirable property
* of interpreting numbers with leading '0' characters as octal, while
* retaining "0x" as indicating a hexidecimal number.
* retaining "0x" as indicating a hexadecimal number.
*/
long int
ParseLong(const char *argPtr, char **endPtr)
Expand Down Expand Up @@ -173,7 +173,7 @@ ParseArgv(argcPtr, argv, argTable, flags)
length = strlen(curArg);

/*
* Loop throught the argument descriptors searching for one with
* Loop through the argument descriptors searching for one with
* the matching key string. If found, leave a pointer to it in
* matchPtr.
*/
Expand Down
2 changes: 1 addition & 1 deletion libcommon/minc2_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:09 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libcommon/minc2_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@DESCRIPTION: File containing error codes for libminc package.
@GLOBALS :
@CALLS :
@CREATED : 17 Feburary, 2004 (Robert Vincent)
@CREATED : 17 February, 2004 (Robert Vincent)
@MODIFIED :
*
* $Log: minc_error.h,v $
Expand Down
2 changes: 1 addition & 1 deletion libcommon/minc_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:09 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libcommon/minc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@DESCRIPTION: File containing error codes for minc package.
@GLOBALS :
@CALLS :
@CREATED : 17 Feburary, 2004 (Robert Vincent)
@CREATED : 17 February, 2004 (Robert Vincent)
@MODIFIED :
*
* $Log: minc_error.h,v $
Expand Down
2 changes: 1 addition & 1 deletion libcommon/time_stamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Fixed log message containing log substitution
*
* Revision 6.1 1999/10/19 14:45:14 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libcommon/time_stamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Fixed log message containing log substitution
*
* Revision 6.1 1999/10/19 14:45:14 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
4 changes: 2 additions & 2 deletions libsrc/dim_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* Use standard labs() and fabs() instead of our private macros
*
* Revision 6.1 1999/10/19 14:45:07 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down Expand Up @@ -537,7 +537,7 @@ PRIVATE int MI_get_dim_bufsize_step(mi_icv_type *icvp, int subsc[])
dimensions
@OUTPUT : (none)
@RETURNS : MI_ERROR if an error occurs
@DESCRIPTION: Sets the variables for dimensions converions
@DESCRIPTION: Sets the variables for dimensions conversions
@METHOD :
@GLOBALS :
@CALLS : NetCDF routines
Expand Down
12 changes: 6 additions & 6 deletions libsrc/hdf_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ hdf_is_dimension_name(struct m2_file *file, const char *varnm)
* may not yet exist in the file.
*/
static hid_t
hdf_path_from_name(struct m2_file *file, const char *varnm, char *varpath)
hdf_path_from_name(struct m2_file *file, const char *varnm, char *varpath, size_t varpathlength)
{
if (!strcmp(varnm, MIimage) ||
!strcmp(varnm, MIimagemax) ||
!strcmp(varnm, MIimagemin)) {
sprintf(varpath, "/minc-2.0/image/%d/", file->resolution);
snprintf(varpath, varpathlength, "/minc-2.0/image/%d/", file->resolution);
}
else if (hdf_is_dimension_name(file, varnm)) {
strcpy(varpath, "/minc-2.0/dimensions/");
Expand Down Expand Up @@ -1102,7 +1102,7 @@ hdf_attput(int fd, int varid, const char *attnm, nc_type val_typ,
char temp[128];
unsigned int i;

sprintf(temp, "junkXXXX");
snprintf(temp, sizeof(temp), "junkXXXX");

new_type_id = H5Tcopy(var->ftyp_id);
if (new_type_id < 0) {
Expand Down Expand Up @@ -1295,7 +1295,7 @@ hdf_vardef(int fd, const char *varnm, nc_type vartype, int ndims,
return (MI_ERROR);
}

if (hdf_path_from_name(file, varnm, varpath) < 0) {
if (hdf_path_from_name(file, varnm, varpath, sizeof(varpath)) < 0) {
return (MI_ERROR);
}

Expand Down Expand Up @@ -2221,7 +2221,7 @@ hdf_open(const char *path, int mode)

/*Set cachine parameters*/
fpid=H5Pcreate( H5P_FILE_ACCESS );
/* Limit file compatability to 1.8.x */
/* Limit file compatibility to 1.8.x */
H5Pset_libver_bounds (fpid, H5F_LIBVER_V18, H5F_LIBVER_V18);

/*setup a bigger cache to work with typical chunking ( MI_MAX_VAR_BUFFER_SIZE )*/
Expand Down Expand Up @@ -2332,7 +2332,7 @@ hdf_create(const char *path, int cmode, struct mi2opts *opts_ptr)

/*Set cachine parameters*/
fpid = H5Pcreate (H5P_FILE_ACCESS);
/* Limit file compatability to 1.8.x */
/* Limit file compatibility to 1.8.x */
H5Pset_libver_bounds (fpid, H5F_LIBVER_V18, H5F_LIBVER_V18);

/*setup a bigger cache to work with typical chunking ( MI_MAX_VAR_BUFFER_SIZE )*/
Expand Down
2 changes: 1 addition & 1 deletion libsrc/image_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:07 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
* Start of modifications to get minc working with netcdf 3.5.
*
* Revision 6.1 1999/10/19 14:45:08 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:08 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
4 changes: 2 additions & 2 deletions libsrc/minc_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:09 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down Expand Up @@ -1342,7 +1342,7 @@ MNCAPI int micreate_group_variable(int cdfid, const char *name)
@INPUT : id - cdf file id
tm_stamp - timestamp as returned by time_stamp() function.
@OUTPUT : (none)
@RETURNS : MI_NOERROR if successfuly
@RETURNS : MI_NOERROR if successful
@DESCRIPTION: Appends the string (which should be in the format returned
by the time_stamp() function) to the global "history"
attribute.
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* #include minc_config.h and minc_error.h
*
* Revision 6.1 1999/10/19 14:45:09 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_routines.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Minor changes for Windows compatibility
*
* Revision 6.1 1999/10/19 14:45:10 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ minc_save_start(char *path, /* Path to the file */
int var_ndims; /* Number of dimensions per variable */
int var_dims[MI_S_NDIMS]; /* Dimension ID's per variable */
int i, j; /* Generic loop counters */
int old_ncopts; /* For supressing fatal error messages */
int old_ncopts; /* For suppressing fatal error messages */
struct file_info *p_file; /* For accessing the file structure */
struct var_info *p_var;
struct att_info *p_att;
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@MODIFIED :
* $Log: minc_structures.h,v $
* Revision 6.1 1999-10-19 14:45:10 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_useful.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Minor changes for Windows compatibility
*
* Revision 6.1 1999/10/19 14:45:10 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/minc_varlists.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@MODIFIED :
* $Log: minc_varlists.h,v $
* Revision 6.1 1999-10-19 14:45:11 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/nd_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* in order to include them in the main minc library.
*
* Revision 6.1 1999/10/19 14:45:13 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/nd_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* in order to include them in the main minc library.
*
* Revision 6.1 1999/10/19 14:45:14 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
4 changes: 2 additions & 2 deletions libsrc/netcdf_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
* For newer versions of glibc, this would cause a seg fault.
*
* Revision 6.2 1999/10/19 14:45:11 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.1 1997/10/06 12:54:08 neelin
* Changed call to tmpnam to tempnam so that TMPDIR variable is checked when
Expand Down Expand Up @@ -257,7 +257,7 @@ PRIVATE int execute_decompress_command(char *command, const char *infile,
/* we now ignore header_only and always uncompress the whole
* file as the previous "header only" hack that used to work
* on MINC1 files doesn't work reliably with MINC2 */
(void) sprintf(whole_command, "exec %s %s > %s 2> /dev/null",
(void) snprintf(whole_command, sizeof(whole_command), "exec %s %s > %s 2> /dev/null",
command, infile, outfile);
status = system(whole_command);

Expand Down
2 changes: 1 addition & 1 deletion libsrc/strdup.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@MODIFIED :
* $Log: strdup.c,v $
* Revision 6.1 1999-10-19 14:45:11 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/type_limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@MODIFIED :
* $Log: type_limits.h,v $
* Revision 6.1 1999-10-19 14:45:12 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/value_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* A few fixes to the configure script.
*
* Revision 6.1 1999/10/19 14:45:12 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:24:54 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/voxel_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
* in their own way.
*
* Revision 6.1 1999/10/19 14:45:15 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc/voxel_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* in their own way.
*
* Revision 6.1 1999/10/19 14:45:16 neelin
* Fixed Log subsitutions for CVS
* Fixed Log substitutions for CVS
*
* Revision 6.0 1997/09/12 13:23:41 neelin
* Release of minc version 0.6
Expand Down
2 changes: 1 addition & 1 deletion libsrc2/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int miget_data_type ( mihandle_t volume, mitype_t *data_type )
return ( MI_NOERROR );
}

/** Return the byte size of the voxel datatytpe
/** Return the byte size of the voxel datatype
*/
int miget_data_type_size ( mihandle_t volume, misize_t *voxel_size )
{
Expand Down
6 changes: 3 additions & 3 deletions libsrc2/dimension.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int micopy_dimension ( midimhandle_t dim_ptr, midimhandle_t *new_dim_ptr )
* enough range to represent detail on the order of 10 Angstroms in
* typical medical imaging applications.
*
* For the detailed defintion of \a class and \a type refer to the MINC 2.0 API
* For the detailed definition of \a class and \a type refer to the MINC 2.0 API
* definition.
* \ingroup mi2Dim
*/
Expand Down Expand Up @@ -1217,7 +1217,7 @@ int miset_dimension_separation ( midimhandle_t dimension, double separation )
* Get the sampling interval (STEP) for a list of dimensions.
* \param dimensions An array of dimension handles.
* \param voxel_order The order in which the voxel indices increase/decrease.
* \param array_length The number of dimensions in the dimesions array.
* \param array_length The number of dimensions in the dimensions array.
* \param separations An array of dimensions sampling intervals (step) values.
*
* Get or Set the scalar separation (sampling interval)
Expand Down Expand Up @@ -1245,7 +1245,7 @@ int miget_dimension_separations ( const midimhandle_t dimensions[],
/**
* Set the sampling interval (STEP) for a list of dimensions.
* \param dimensions An array of dimension handles.
* \param array_length The number of dimensions in the dimesions array.
* \param array_length The number of dimensions in the dimensions array.
* \param separations An array of dimensions sampling intervals (step) values.
*
* Refer to miget_dimension_separations().
Expand Down
Loading

0 comments on commit c3952a8

Please sign in to comment.