From de2ba7f4301502c9ef046a39806ee314fc46bbd7 Mon Sep 17 00:00:00 2001 From: Christian Gaser Date: Sun, 7 Jan 2024 21:39:54 +0100 Subject: [PATCH] Corrected some smaller installation issues --- 3rdparty/volume_io/Prog_utils/time.c | 26 -------------------------- Include/CAT_Kmeans.h | 4 ++++ Lib/CAT_Sanlm.c | 2 -- Lib/CAT_Vol.c | 10 +++++----- Makefile.am | 9 +++++++-- 5 files changed, 16 insertions(+), 35 deletions(-) diff --git a/3rdparty/volume_io/Prog_utils/time.c b/3rdparty/volume_io/Prog_utils/time.c index a7bd045..2468306 100644 --- a/3rdparty/volume_io/Prog_utils/time.c +++ b/3rdparty/volume_io/Prog_utils/time.c @@ -248,32 +248,6 @@ VIOAPI STRING get_clock_time( void ) return( create_string( str ) ); } -/* ----------------------------- MNI Header ----------------------------------- -@NAME : sleep_program -@INPUT : seconds -@OUTPUT : -@RETURNS : -@DESCRIPTION: Make the program sleep for the specified number of seconds. -@METHOD : -@GLOBALS : -@CALLS : -@CREATED : 1993 David MacDonald -@MODIFIED : ----------------------------------------------------------------------------- */ - -VIOAPI void sleep_program( Real seconds ) -{ -#if HAVE_SELECT - struct timeval timeout; - - timeout.tv_sec = (long) seconds; - timeout.tv_usec = (long) (1.0e6 * (seconds - (Real) timeout.tv_sec) + 0.5); - - (void) select( 0, NULL, NULL, NULL, &timeout ); -#else - sleep((unsigned int) seconds); -#endif -} /* ----------------------------- MNI Header ----------------------------------- @NAME : get_date diff --git a/Include/CAT_Kmeans.h b/Include/CAT_Kmeans.h index 11718c1..687c93a 100644 --- a/Include/CAT_Kmeans.h +++ b/Include/CAT_Kmeans.h @@ -12,6 +12,10 @@ #include "CAT_Vol.h" +#ifndef HUGE +#define HUGE 1e15 +#endif + double Kmeans(float *src, unsigned char *label, unsigned char *mask, int NI, int n_clusters, double *mean, double *voxelsize, int *dims, int thresh_mask, int thresh_kmeans); #endif \ No newline at end of file diff --git a/Lib/CAT_Sanlm.c b/Lib/CAT_Sanlm.c index f30c3fc..120ebf8 100644 --- a/Lib/CAT_Sanlm.c +++ b/Lib/CAT_Sanlm.c @@ -609,8 +609,6 @@ void anlm(float* ima, int v, int f, int use_rician, const int* dims) #if defined(_WIN32) - /* printf("Windows system detected\n");fflush(stdout); */ - /* Reserve room for handles of threads in ThreadList*/ ThreadList = (HANDLE*) malloc(Nthreads*sizeof( HANDLE )); ThreadArgs = (myargument*) malloc( Nthreads*sizeof(myargument)); diff --git a/Lib/CAT_Vol.c b/Lib/CAT_Vol.c index 1c80789..5d61afd 100644 --- a/Lib/CAT_Vol.c +++ b/Lib/CAT_Vol.c @@ -384,10 +384,10 @@ double get_masked_mean_array_float(float arr[], int size, unsigned char mask[]) { double sum = 0.0; - int n = 0; + int i, n = 0; /* Calculate mean */ - for(int i = 0; i < size; i++) { + for (i = 0; i < size; i++) { if (!isnan(arr[i]) && ((mask && mask[i] > 0) || !mask)) { sum += arr[i]; n++; @@ -429,10 +429,10 @@ double get_masked_std_array_float(float arr[], int size, unsigned char mask[]) { double mean = 0.0, variance = 0.0; - int n = 0; + int i, n = 0; /* Calculate mean */ - for(int i = 0; i < size; i++) { + for (i = 0; i < size; i++) { if (!isnan(arr[i]) && ((mask && mask[i] > 0) || !mask)) { mean += arr[i]; n++; @@ -441,7 +441,7 @@ get_masked_std_array_float(float arr[], int size, unsigned char mask[]) mean = mean / (double)n; /* Calculate variance */ - for(int i = 0; i < size; i++) + for (i = 0; i < size; i++) if (!isnan(arr[i]) && ((mask && mask[i] > 0) || !mask)) variance += pow(arr[i] - mean, 2); variance /= (double)n; diff --git a/Makefile.am b/Makefile.am index d631755..a8b1fad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,13 @@ SUBDIRS = . Progs AUTOMAKE_OPTIONS = subdir-objects ACLOCAL_AMFLAGS = -I m4 -AM_CFLAGS = -pthread -DHAVE_ZLIB -I$(top_srcdir)/Include -I$(top_srcdir)/3rdparty/MarchingCubes -I$(top_srcdir)/3rdparty/nifti -I$(top_srcdir)/3rdparty/zlib -I$(top_srcdir)/3rdparty/volume_io/Include -I$(top_srcdir)/3rdparty/bicpl-surface/Include -I$(top_srcdir)/3rdparty/bicpl-surface/Include/bicpl -#AM_CPPFLAGS = -pthread -DHAVE_ZLIB -I$(top_srcdir)/Include -I$(top_srcdir)/3rdparty/MarchingCubes -I$(top_srcdir)/3rdparty/nifti -I$(top_srcdir)/3rdparty/zlib -I$(top_srcdir)/3rdparty/bicpl-surface/Include/bicpl +CFLAGS0 = -DHAVE_ZLIB -I$(top_srcdir)/Include -I$(top_srcdir)/3rdparty/MarchingCubes -I$(top_srcdir)/3rdparty/nifti -I$(top_srcdir)/3rdparty/zlib -I$(top_srcdir)/3rdparty/volume_io/Include -I$(top_srcdir)/3rdparty/bicpl-surface/Include -I$(top_srcdir)/3rdparty/bicpl-surface/Include/bicpl + +if WINDOWS + AM_CFLAGS = ${CFLAGS0} +else + AM_CFLAGS = -pthread ${CFLAGS0} +endif lib_LTLIBRARIES = libCAT.la